Skip to content

Instantly share code, notes, and snippets.

@erickt
Created December 3, 2010 22:44
Show Gist options
  • Select an option

  • Save erickt/727666 to your computer and use it in GitHub Desktop.

Select an option

Save erickt/727666 to your computer and use it in GitHub Desktop.
global tids
global bytecount
global exes
probe syscall.read {
exes[tid()] = execname();
tids[tid()] = fd;
}
probe syscall.read.return {
t = tid()
if (t in tids) {
fd = tids[t];
if (!([t, fd] in bytecount))
bytecount[t, fd] = 0;
bytecount[t, fd] += strtol(retstr, 10);
delete tids[t];
}
}
probe timer.ms(%d) {
foreach ([t, fd] in bytecount)
printf("%%d %%d %%s %%d\\n", t, fd, exes[t], bytecount[t, fd]);
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment