summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/small_demos/sched_snoop.stp
blob: 623643dd58d003c5ea0b107dbf1594466d5b012f (plain)
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
#!/usr/bin/env stap

global start_ts

probe begin {
    start_ts = gettimeofday_us()
    printf("%12s  %3s  %5s  %5s  %-16s  ACTION\n",
            "TIMESTAMP", "CPU", "PID", "TID", "EXECNAME")
}

function report(action:string) {
    printf("%3d  %12d  %5d  %5d  %-16s  %s\n",
            gettimeofday_us() - start_ts, cpu(),
            pid(), tid(), execname(), action)
}

probe scheduler.cpu_off {
    report(sprintf("cpu_off%s", idle? " [idle]" : ""))
}

probe scheduler.cpu_on {
    report(sprintf("cpu_on%s", idle? " [idle]" : ""))
}

probe scheduler.tick {
    report(sprintf("tick%s", idle? " [idle]" : ""))
}

probe scheduler.migrate ? {
    report("migrate")
}

probe scheduler.balance ? {
    report("balance")
}