summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/small_demos/fileopen.stp
blob: c1298f9c30bd2ca798dbf98a765bc4fcfb24ce52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env stap

#
# fileopen.stp
#
# This is based on dtrace script from 
# http://www.gnome.org/~gman/blog/2006/Jan
#
# stap  fileopen.stp  -c "zenity --about"
# or
# ./fileopen.stp -c "program or script"

global opens

probe syscall.open {
  if (target() == pid()) opens[filename] ++
}

probe end {
  foreach([name] in opens+) {
    printf("%-70s%5d\n", name, opens[name])
  }
}