Spamworldpro Mini Shell
Spamworldpro


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 :  /opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/general/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/general/cpu_throttle.stp
#!/opt/rh/gcc-toolset-11/root/usr/bin/stap
# Copyright (C) 2018 Red Hat, Inc.
# Written by William Cohen <[email protected]>
#
# cpu_throttle.stp provides total milliseconds each Intel x86
# processor performance is restricted due to power or thermal
# constraints formatted for consumption by prometheus.
# The data is read from /proc/systemtap/*/cpu_throttle.stp
#
# Run the script with:
#   stap cpu_throttle.stp
#
# control-c to exit data collection

global throttled_time, throttled_state

probe begin {
    // Make sure there is an instance in the throttled_time
    throttled_time[0] = 0
}

probe kprobe.function("therm_throt_process") {
    now = gettimeofday_ns()
    // just started throttling
    if (ulong_arg(1) && !(cpu() in throttled_state)) {
        throttled_state[cpu()] = now
    }
    // just ending throttling
    if (!ulong_arg(1) && cpu() in throttled_state) {
        throttled_time[cpu()] += now - throttled_state[cpu()]
        delete throttled_state[cpu()]
    }
}

probe prometheus {
    now = gettimeofday_ns()
    $value .= "# HELP cpu_throttle_time accumulated time process is performance limited in ms.\n"
    $value .= "# TYPE cpu_throttle_time counter\n"
    foreach (cpu in throttled_time){
      k = throttled_time[cpu]
      // add in any existing throttled time
      if (cpu in throttled_state)
          k += now - throttled_state[cpu]
          k /= 1000000 // scale from ns to ms
      $value .= "cpu_throttle_time{cpu=\"".sprint(cpu)."\"} ".sprint(k)."\n"
    }
}

Spamworldpro Mini