Skip to content

Instantly share code, notes, and snippets.

@brendangregg
Created March 8, 2012 01:56
Show Gist options
  • Save brendangregg/1997991 to your computer and use it in GitHub Desktop.
Save brendangregg/1997991 to your computer and use it in GitHub Desktop.
systemtap comparing profiling rates on fedora
[root@fedora1 admin]# stap -e 'global s, last; probe begin { last = gettimeofday_ns(); } probe timer.profile { now = gettimeofday_ns(); s <<< now - last; last = now; } probe timer.s(10) { printf("ns\n"); print(@hist_linear(s, 900000, 1100000, 10000)); exit(); }'
ns
value |-------------------------------------------------- count
<900000 | 80
900000 | 17
910000 | 15
920000 | 7
930000 | 8
940000 | 17
950000 | 15
960000 | 20
970000 |@ 99
980000 |@@@@@@@@@@ 907
990000 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4296
1000000 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3080
1010000 |@@@@@@@@@@@@@ 1124
1020000 |@ 137
1030000 | 15
1040000 | 17
1050000 | 23
1060000 | 10
1070000 | 15
1080000 | 11
1090000 | 15
1100000 | 3
>1100000 | 69
[root@fedora1 admin]# stap -e 'global s, last; probe begin { last = gettimeofday_ns(); } probe perf.sw.cpu_clock { now = gettimeofday_ns(); s <<< now - last; last = now; } probe timer.s(10) { printf("ns\n"); print(@hist_linear(s, 900000, 1100000, 10000)); exit(); }'
ns
value |-------------------------------------------------- count
<900000 | 1
900000 | 1
910000 | 3
920000 | 3
930000 | 13
940000 | 26
950000 | 34
960000 |@ 98
970000 |@@@@@@@ 471
980000 |@@@@@@@@@@@@@@@@@@@@@@@@@ 1495
990000 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2944
1000000 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2738
1010000 |@@@@@@@@@@@@@@@@@@@@@@@@@ 1504
1020000 |@@@@@@@ 468
1030000 |@ 109
1040000 | 49
1050000 | 22
1060000 | 13
1070000 | 5
1080000 | 1
1090000 | 0
1100000 | 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment