![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /proc/thread-self/root/opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/general/ |
#!/opt/rh/gcc-toolset-11/root/usr/bin/stap probe begin { printf ("%%DataSet:cpu 100 00ff00 bar\n"); printf ("%%DataSet:kbd 75 ff0000 discreet\n"); printf ("%%DataSet:pty 50 0000ff discreet\n"); printf ("cpu %%Title:CPU utilization\n"); printf ("cpu %%XAxisTitle:Time\n"); printf ("cpu %%YAxisTitle:Percent\n"); printf ("%%LineEnd:0\n"); } # CPU utilization probe begin { qnames["cpu"] ++; qsq_start ("cpu") } probe scheduler.cpu_on { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }} probe scheduler.cpu_off { if (!idle) qs_done ("cpu") } global qnames function qsq_util_reset(q) { u=qsq_utilization (q, 100) qsq_start (q) return u } probe timer.ms(100) { # collect utilization percentages frequently foreach (q in qnames) printf("cpu %d %d%c", gettimeofday_ms(), qsq_util_reset(q), 0) } probe kernel.function("kbd_event") { if ($event_type == 1 && $value) printf("kbd %d %d\n0x%x%c", gettimeofday_ms(), $event_code, $event_code, 0) } probe kernel.function("pty_write") { count = @defined($c) ? $c : $count if (count > 0) { printf("pty %d ", gettimeofday_ms()) str = $buf for (i = 0; i < count; ++i) { if (i > 1) printf("\n") c = kernel_char(str + i) printf("%c", c) } printf("%c", 0) } }