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/io/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/systemtap-client-1.8/examples/io/iostats.stp
#!/usr/bin/stap
global opens, reads, writes, totals

probe begin { printf("starting probe\n") }

probe syscall.open {
  e=execname();
  opens[e] <<< 1 # statistics array
}

probe syscall.read.return {
  count = $return
  if ( count >= 0 ) {
    e=execname();
    reads[e] <<< count # statistics array
    totals[e] += count
  }
}

probe syscall.write.return {
  count = $return
  if (count >= 0 ) {
    e=execname();
    writes[e] <<< count # statistics array
    totals[e] += count
  }
}

probe end {
  printf("\n%16s %8s %8s %8s %8s %8s %8s %8s\n",
    "", "", "", "read", "read", "", "write", "write")
  printf("%16s %8s %8s %8s %8s %8s %8s %8s\n",
    "name", "open", "read", "KB tot", "B avg", "write", "KB tot", "B avg")
  foreach (name in totals- limit 20) { # sort by total io
    printf("%16s %8d %8d %8d %8d %8d %8d %8d\n",
      name, @count(opens[name]),
      @count(reads[name]),
      (@count(reads[name]) ? @sum(reads[name])>>10 : 0 ),
      (@count(reads[name]) ? @avg(reads[name]) : 0 ),
      @count(writes[name]),
      (@count(writes[name]) ? @sum(writes[name])>>10 : 0 ),
      (@count(writes[name]) ? @avg(writes[name]) : 0 ))
  }
}

Anon7 - 2021