-
Notifications
You must be signed in to change notification settings - Fork 4
/
rubygc.stp
51 lines (44 loc) · 1.27 KB
/
rubygc.stp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# ruby GC
# @ton31337
global times;
global total;
global nested;
global gc;
global slow_gc;
global skip=1;
probe process("/opt/rbenv/versions/2.2.2/bin/ruby").mark("gc__sweep__begin")
{
times[tid(), nested[tid()]++] = gettimeofday_us();
}
probe process("/opt/rbenv/versions/2.2.2/bin/ruby").mark("gc__sweep__end")
{
ftime = times[tid(), --nested[tid()]];
etime = gettimeofday_us() - ftime;
gc <<< etime;
if (etime > 1000000) {
slow_gc[etime] = ctime(gettimeofday_s());
skip = 0;
}
}
probe timer.s(1)
{
ansi_clear_screen();
printf("GC %d run/s\n", @count(gc));
printf("GC average took <%d.%06d>\n", (@avg(gc) / 1000000), (@avg(gc) % 1000000));
printf("\nGC in real-time (microseconds) \n");
printf("=================================\n");
print(@hist_linear(gc, 0, 200, 10));
total += @count(gc);
delete gc;
}
probe timer.s(30)
{
printf("Total runs per minute: %d\n", total);
if (!skip) {
printf("Slowest runs: \n");
foreach(etime in slow_gc- limit 10) {
printf("%s <%d.%06d>\n", slow_gc[etime], (etime / 1000000), (etime % 1000000));
}
}
exit();
}