MCPcopy Create free account
hub / github.com/Compaile/ctrack / busy_wait_ns

Function busy_wait_ns

benchmark/ctrack_benchmark.cpp:71–85  ·  view source on GitHub ↗

Precise busy wait function - waits for specified nanoseconds

Source from the content-addressed store, hash-verified

69
70// Precise busy wait function - waits for specified nanoseconds
71void busy_wait_ns(int64_t nanoseconds)
72{
73 auto start = std::chrono::high_resolution_clock::now();
74 auto target_duration = std::chrono::nanoseconds(nanoseconds);
75
76 while (true)
77 {
78 auto now = std::chrono::high_resolution_clock::now();
79 auto elapsed = now - start;
80 if (elapsed >= target_duration)
81 {
82 break;
83 }
84 }
85}
86
87// Benchmark functions with predictable timing
88void leaf_function(int depth)

Callers 8

leaf_functionFunction · 0.85
level_3_functionFunction · 0.85
level_2_functionFunction · 0.85
level_1_functionFunction · 0.85
leaf_function_no_trackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected