albertnetymk
11/11/2015 - 11:20 PM

hello.stp

global gc_major
global gc_minor
global gc_major_count
global gc_minor_count
global stat
global count_stat

probe process("/home/albert/github/otp/bin/x86_64-unknown-linux-gnu/beam.smp").mark("gc_major__start")
{
    gc_major[user_string($arg1)] = gettimeofday_ms() - gc_major[user_string($arg1)]
}
probe process("/home/albert/github/otp/bin/x86_64-unknown-linux-gnu/beam.smp").mark("gc_major__end")
{
    gc_major[user_string($arg1)] = gettimeofday_ms() - gc_major[user_string($arg1)]
    gc_major_count[user_string($arg1)]++
}

probe process("/home/albert/github/otp/bin/x86_64-unknown-linux-gnu/beam.smp").mark("gc_minor__start")
{
    gc_minor[user_string($arg1)] = gettimeofday_ms() - gc_minor[user_string($arg1)]
}
probe process("/home/albert/github/otp/bin/x86_64-unknown-linux-gnu/beam.smp").mark("gc_minor__end")
{
    gc_minor[user_string($arg1)] = gettimeofday_ms() - gc_minor[user_string($arg1)]
    gc_minor_count[user_string($arg1)]++
}

probe end
{
    foreach(x in gc_major) {
        stat <<< gc_major[x]
    }
    foreach(x in gc_major_count) {
        count_stat <<< gc_major_count[x]
    }
    printf("gc_major: sum:%d num:%d\n", @sum(stat), @sum(count_stat))
    delete stat
    delete count_stat
    foreach(x in gc_minor) {
        stat <<< gc_minor[x]
    }
    foreach(x in gc_minor_count) {
        count_stat <<< gc_minor_count[x]
    }
    printf("gc_minor: sum:%d num:%d\n", @sum(stat), @sum(count_stat))
}