This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

updated bootprobe


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

Dan Berrange's bootprobe script provides a nice example of systemtap use
that Dan has kindly agreed can be used in examples, training materials etc.

I've made a slightly modified version to add a GPL header (with Dan's
permission!) and update the probepoints to use the new tapsets.

If anyone has any comments/corrections for this version, I'd be very
happy to receive them.

The original, along with the perl post-processing scripts are still
available here:

http://people.redhat.com/berrange/systemtap/bootprobe/

Thanks,

Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFE01yL6YSQoMYUY94RAtBlAKCWiqtBd/Sp9JSxyMjJ1+N+goMPAwCglwqD
bJ8a0GSytfqoZ6EYvPzPOac=
=9fu3
-----END PGP SIGNATURE-----
/*
 * Copyright (C) 2006 Daniel Berrange, Red Hat Inc.
 * 
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU General Public License v.2.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
*/
global indent

function get_usertime:long() %{
  THIS->__retvalue = current->utime + current->signal->utime;
%}

function get_systime:long() %{
  THIS->__retvalue = current->stime + current->signal->stime;
%}

function timestamp:string() {
  return sprintf("%d %s", gettimeofday_ms(), indent[pid()])
}

function proc:string() {
  return sprintf("%d (%s)", pid(), execname())
}

function push(pid, ppid) {
  indent[pid] = indent[ppid] . "  "
}

function pop(pid) {
  delete indent[pid]
}

probe syscall.fork.return {
  print(timestamp() . proc() . " forks " . sprint(retval) . "\n")
  push(retval, pid())
}

probe syscall.execve {
  print(timestamp() . proc() . " execs " . kernel_string($filename) . "\n")
}

probe syscall.open {
  if ($flags & 1) {
    print(timestamp() . proc() . " writes " . user_string($filename) . "\n")
  } else {
    print(timestamp() . proc() . " reads " . user_string($filename) . "\n")
  }
} 

probe syscall.exit {
  print(timestamp() . proc() . " exit with user " . sprint(get_usertime()) .
	" sys " . sprint(get_systime()) . "\n")
  pop(pid())
}

probe timer.jiffies(100) {
  if (pid() != 0) {
    print(timestamp() . proc() . " tick with user " . sprint(get_usertime()) .
	" sys " . sprint(get_systime()) . "\n")
  }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]