KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/share/doc/systemtap-client-1.8/examples/profiling/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/systemtap-client-1.8/examples/profiling/periodic.stp
#!/usr/bin/stap
# Copyright (C) 2011 Red Hat, Inc.
# Written by William Cohen <wcohen@redhat.com>
#
# This script give an idea what periodic things are running on
# the system. Usage:
#
# stap --all-modules periodic.stp

global last_expire, period, funct, data

probe kernel.trace("timer_expire_entry")
{
  old_expire = last_expire[$timer]
  new_expire = gettimeofday_us()
  if (old_expire) {
    elapsed = new_expire - old_expire
    period[$timer] <<< elapsed
    funct[$timer] = $timer->function
    data[$timer] = $timer->data
  }
  last_expire[$timer] = new_expire
}

function output()
{
  printf("%-7s %-50s %11s %9s\n", "#type", "function", "period(us)", "count")
  # print out the various timers firing
  foreach([timer] in period-) {
    fname = symname(funct[timer])
    if (fname == "process_timeout") {
      fname = sprintf("%s(%d)",
        kernel_string_n(@cast(data[timer], "struct task_struct")->comm, 16),
        @cast(data[timer], "struct task_struct")->pid)
      type="process"
    } else if (fname == "delayed_work_timer_fn") {
      faddr = @defined(@cast(data[timer], "struct delayed_work")->work->func)
        ? @cast(data[timer], "struct delayed_work")->work->func
	: @cast(data[timer], "struct work_struct")->func
      fname = sprintf("%s", symname(faddr))
      type="work_q"
    } else {
      fname = sprintf("%s", symdata(funct[timer]))
      type="kernel"
    }
    printf("%-7s %-50.50s %11d %9d\n", type, fname,
           @avg(period[timer]), @count(period[timer]))
  }
}

probe begin
{
  printf("#monitoring timer periods (press control-c for output)\n")
}

probe end { output() }

# allow optional period output from script
%( $# > 0 %?
probe timer.s($1)
{
  output();
  delete last_expire
  delete period
  delete funct
  delete data
}
%)

Anon7 - 2021