MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / affinity_pinned_worker

Function affinity_pinned_worker

tests/system_test/balance_test.cpp:144–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142std::atomic<uint64_t> g_affinity_cores_mask{0};
143
144void affinity_pinned_worker(void* /*arg*/) {
145 for (int round = 0; round < 100; ++round) {
146 for (int j = 0; j < 10; ++j) {
147 auto core_id = cpu_io::GetCurrentCoreId();
148 g_affinity_cores_mask.fetch_or(1UL << core_id, std::memory_order_relaxed);
149 (void)sys_yield();
150 }
151 (void)sys_sleep(1);
152 }
153
154 g_affinity_done.fetch_add(1, std::memory_order_release);
155 sys_exit(0);
156}
157
158void test_balance_respects_affinity(void* /*arg*/) {
159 klog::Info("=== Balance: Respects Affinity Test ===");

Callers

nothing calls this directly

Calls 4

GetCurrentCoreIdFunction · 0.85
sys_yieldFunction · 0.85
sys_sleepFunction · 0.85
sys_exitFunction · 0.85

Tested by

no test coverage detected