File tree Expand file tree Collapse file tree
scenarios/python_spiky_3.11 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,4 +9,20 @@ Two threads run concurrently for the same duration:
99## Expected behavior
1010
1111- ** wall-time** : both threads contribute ~ 50% each, since both run for the same duration
12- - ** cpu-time** : only ` cpu_work ` appears (~ 90%+), since sleeping does not consume CPU
12+ - ** cpu-time** : only ` cpu_work ` appears (~ 99%+), since sleeping does not consume CPU
13+
14+ ## CPU usage over time
15+
16+ Execution alternates CPU spikes (busy-looping on ` math.factorial ` , ~ 100% CPU)
17+ with sleep periods (~ 0% CPU). Spike/sleep lengths are random, but each half of
18+ the run sums to ` EXECUTION_TIME_SEC / 2 ` , so the mean CPU usage is exactly 50%.
19+
20+ ``` text
21+ CPU
22+ 100% ┤ ┌──┐ ┌─┐ ┌──┐ ┌─┐ ┌──┐ ┌─┐ ┌──┐
23+ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
24+ 50% ┼─┼──┼───┼─┼──┼──┼──┼─┼───┼──┼──┼─┼──┼──┼── mean = 50%
25+ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
26+ 0% ┴─┘ └───┘ └──┘ └──┘ └───┘ └──┘ └──┘ └──▶ time
27+ cpu sleep cpu sleep ... (each half sums to 50%)
28+ ```
Original file line number Diff line number Diff line change 2121 "stack-content" : [
2222 {
2323 "regular_expression" : " .*cpu_spike" ,
24- "percent" : 90 ,
25- "error_margin" : 10
24+ "percent" : 99 ,
25+ "error_margin" : 5
26+ },
27+ {
28+ "regular_expression" : " .*sleep_period" ,
29+ "percent" : 0 ,
30+ "error_margin" : 5
2631 }
2732 ]
2833 }
You can’t perform that action at this time.
0 commit comments