Commit bd2cdf2
perf sched: Move curr_pid and cpu_last_switched initialization to perf_sched__{lat|map|replay}()
The curr_pid and cpu_last_switched are used only for the
'perf sched replay/latency/map'. Put their initialization in
perf_sched__{lat|map|replay () to reduce unnecessary actions in other
commands.
Simple functional testing:
# perf sched record perf bench sched messaging
# Running 'sched/messaging' benchmark:
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.209 [sec]
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 16.456 MB perf.data (147907 samples) ]
# perf sched lat
-------------------------------------------------------------------------------------------------------------------------------------------
Task | Runtime ms | Switches | Avg delay ms | Max delay ms | Max delay start | Max delay end |
-------------------------------------------------------------------------------------------------------------------------------------------
sched-messaging:(401) | 2990.699 ms | 38705 | avg: 0.661 ms | max: 67.046 ms | max start: 456532.624830 s | max end: 456532.691876 s
qemu-system-x86:(7) | 179.764 ms | 2191 | avg: 0.152 ms | max: 21.857 ms | max start: 456532.576434 s | max end: 456532.598291 s
sshd:48125 | 0.522 ms | 2 | avg: 0.037 ms | max: 0.046 ms | max start: 456532.514610 s | max end: 456532.514656 s
<SNIP>
ksoftirqd/11:82 | 0.063 ms | 1 | avg: 0.005 ms | max: 0.005 ms | max start: 456532.769366 s | max end: 456532.769371 s
kworker/9:0-mm_:34624 | 0.233 ms | 20 | avg: 0.004 ms | max: 0.007 ms | max start: 456532.690804 s | max end: 456532.690812 s
migration/13:93 | 0.000 ms | 1 | avg: 0.004 ms | max: 0.004 ms | max start: 456532.512669 s | max end: 456532.512674 s
-----------------------------------------------------------------------------------------------------------------
TOTAL: | 3180.750 ms | 41368 |
---------------------------------------------------
# echo $?
0
# perf sched map
*A0 456532.510141 secs A0 => migration/0:15
*. 456532.510171 secs . => swapper:0
. *B0 456532.510261 secs B0 => migration/1:21
. *. 456532.510279 secs
<SNIP>
L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 *L7 . . . . 456532.785979 secs
L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 *L7 . . . 456532.786054 secs
L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 *L7 . . 456532.786127 secs
L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 *L7 . 456532.786197 secs
L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 L7 *L7 456532.786270 secs
# echo $?
0
# perf sched replay
run measurement overhead: 108 nsecs
sleep measurement overhead: 66473 nsecs
the run test took 1000002 nsecs
the sleep test took 1082686 nsecs
nr_run_events: 49334
nr_sleep_events: 50054
nr_wakeup_events: 34701
target-less wakeups: 165
multi-target wakeups: 766
task 0 ( swapper: 0), nr_events: 15419
task 1 ( swapper: 1), nr_events: 1
task 2 ( swapper: 2), nr_events: 1
<SNIP>
task 715 ( sched-messaging: 110248), nr_events: 1438
task 716 ( sched-messaging: 110249), nr_events: 512
task 717 ( sched-messaging: 110250), nr_events: 500
task 718 ( sched-messaging: 110251), nr_events: 537
task 719 ( sched-messaging: 110252), nr_events: 823
------------------------------------------------------------
#1 : 1325.288, ravg: 1325.29, cpu: 7823.35 / 7823.35
#2 : 1363.606, ravg: 1329.12, cpu: 7655.53 / 7806.56
#3 : 1349.494, ravg: 1331.16, cpu: 7544.80 / 7780.39
#4 : 1311.488, ravg: 1329.19, cpu: 7495.13 / 7751.86
#5 : 1309.902, ravg: 1327.26, cpu: 7266.65 / 7703.34
#6 : 1309.535, ravg: 1325.49, cpu: 7843.86 / 7717.39
#7 : 1316.482, ravg: 1324.59, cpu: 7854.41 / 7731.09
#8 : 1366.604, ravg: 1328.79, cpu: 7955.81 / 7753.57
#9 : 1326.286, ravg: 1328.54, cpu: 7466.86 / 7724.90
#10 : 1356.653, ravg: 1331.35, cpu: 7566.60 / 7709.07
# echo $?
0
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240206083228.172607-5-yangjihong1@huawei.com1 parent 5e89527 commit bd2cdf2
1 file changed
+61
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3167 | 3167 | | |
3168 | 3168 | | |
3169 | 3169 | | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
3170 | 3196 | | |
3171 | 3197 | | |
| 3198 | + | |
3172 | 3199 | | |
3173 | 3200 | | |
3174 | 3201 | | |
3175 | 3202 | | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
3176 | 3206 | | |
3177 | | - | |
| 3207 | + | |
3178 | 3208 | | |
3179 | 3209 | | |
3180 | 3210 | | |
| |||
3203 | 3233 | | |
3204 | 3234 | | |
3205 | 3235 | | |
3206 | | - | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
3207 | 3241 | | |
3208 | 3242 | | |
3209 | 3243 | | |
| |||
3270 | 3304 | | |
3271 | 3305 | | |
3272 | 3306 | | |
3273 | | - | |
| 3307 | + | |
3274 | 3308 | | |
3275 | 3309 | | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
3276 | 3313 | | |
3277 | 3314 | | |
3278 | 3315 | | |
| |||
3296 | 3333 | | |
3297 | 3334 | | |
3298 | 3335 | | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
3299 | 3339 | | |
3300 | 3340 | | |
3301 | 3341 | | |
| |||
3309 | 3349 | | |
3310 | 3350 | | |
3311 | 3351 | | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
3312 | 3356 | | |
3313 | 3357 | | |
3314 | 3358 | | |
3315 | 3359 | | |
3316 | 3360 | | |
3317 | 3361 | | |
3318 | 3362 | | |
3319 | | - | |
| 3363 | + | |
3320 | 3364 | | |
3321 | 3365 | | |
3322 | 3366 | | |
| |||
3342 | 3386 | | |
3343 | 3387 | | |
3344 | 3388 | | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
3345 | 3392 | | |
3346 | 3393 | | |
3347 | 3394 | | |
| |||
3580 | 3627 | | |
3581 | 3628 | | |
3582 | 3629 | | |
3583 | | - | |
3584 | | - | |
3585 | | - | |
3586 | | - | |
3587 | | - | |
3588 | | - | |
3589 | | - | |
3590 | | - | |
3591 | | - | |
3592 | | - | |
3593 | | - | |
3594 | | - | |
3595 | | - | |
3596 | | - | |
3597 | | - | |
| 3630 | + | |
3598 | 3631 | | |
3599 | 3632 | | |
3600 | 3633 | | |
| |||
3605 | 3638 | | |
3606 | 3639 | | |
3607 | 3640 | | |
3608 | | - | |
| 3641 | + | |
3609 | 3642 | | |
3610 | | - | |
| 3643 | + | |
3611 | 3644 | | |
3612 | 3645 | | |
3613 | 3646 | | |
| |||
3616 | 3649 | | |
3617 | 3650 | | |
3618 | 3651 | | |
3619 | | - | |
| 3652 | + | |
3620 | 3653 | | |
3621 | 3654 | | |
3622 | 3655 | | |
| |||
3625 | 3658 | | |
3626 | 3659 | | |
3627 | 3660 | | |
3628 | | - | |
| 3661 | + | |
3629 | 3662 | | |
3630 | 3663 | | |
3631 | 3664 | | |
3632 | 3665 | | |
3633 | 3666 | | |
3634 | 3667 | | |
3635 | 3668 | | |
3636 | | - | |
| 3669 | + | |
3637 | 3670 | | |
3638 | 3671 | | |
3639 | 3672 | | |
| |||
3649 | 3682 | | |
3650 | 3683 | | |
3651 | 3684 | | |
3652 | | - | |
3653 | | - | |
| 3685 | + | |
3654 | 3686 | | |
3655 | 3687 | | |
3656 | 3688 | | |
3657 | | - | |
| 3689 | + | |
3658 | 3690 | | |
3659 | | - | |
| 3691 | + | |
3660 | 3692 | | |
3661 | 3693 | | |
3662 | 3694 | | |
3663 | 3695 | | |
3664 | | - | |
3665 | | - | |
3666 | | - | |
3667 | | - | |
3668 | | - | |
| 3696 | + | |
3669 | 3697 | | |
0 commit comments