public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* how to filter unnecessary info from stap output?
@ 2012-03-15  2:51 ch huang
  2012-03-15 10:48 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: ch huang @ 2012-03-15  2:51 UTC (permalink / raw)
  To: systemtap

i want observer ext module action, i write the following script


# cat exec.stp -o file
probe module("ext3").function("*").call {
printf("%s -> %s\n", thread_indent(1), probefunc())
}
probe module("ext3").function("*").return {
printf("%s <- %s\n", thread_indent(-1), probefunc())
}

but i want stap output in file,when i run like 'echo "aaa" > ufile '
command ,not always flood the output file with like
'   10 pdflush(32612): <- ext3_write_super
     0 pdflush(32612): -> ext3_write_inode
     4 pdflush(32612): <- ext3_write_inode
     0 pdflush(32612): -> ext3_write_inode
     3 pdflush(32612): <- ext3_write_inode
     0 pdflush(32612): -> ext3_write_inode
     3 pdflush(32612): <- ext3_write_inode
     0 pdflush(32612): -> ext3_write_inode
     3 pdflush(32612): <- ext3_write_inode ' such unnecessary info ,any help?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how to filter unnecessary info from stap output?
  2012-03-15  2:51 how to filter unnecessary info from stap output? ch huang
@ 2012-03-15 10:48 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2012-03-15 10:48 UTC (permalink / raw)
  To: ch huang; +Cc: systemtap

On Thu, 2012-03-15 at 10:51 +0800, ch huang wrote:
> i want observer ext module action, i write the following script
> 
> 
> # cat exec.stp -o file
> probe module("ext3").function("*").call {
> printf("%s -> %s\n", thread_indent(1), probefunc())
> }
> probe module("ext3").function("*").return {
> printf("%s <- %s\n", thread_indent(-1), probefunc())
> }
> 
> but i want stap output in file,when i run like 'echo "aaa" > ufile '
> command ,not always flood the output file with like
> '   10 pdflush(32612): <- ext3_write_super
>      0 pdflush(32612): -> ext3_write_inode
>      4 pdflush(32612): <- ext3_write_inode
>      0 pdflush(32612): -> ext3_write_inode
>      3 pdflush(32612): <- ext3_write_inode
>      0 pdflush(32612): -> ext3_write_inode
>      3 pdflush(32612): <- ext3_write_inode
>      0 pdflush(32612): -> ext3_write_inode
>      3 pdflush(32612): <- ext3_write_inode ' such unnecessary info ,any help?

Do you want to filter out kernel probes triggered from stap itself or
just pdflush? The program stapio is responsible for writing out the
file. If so then you can filter those two out using something like:

probe module("ext3").function("*").call {
  if (execname() == "stapio" || execname() == "pdflush")
    next;

  printf("%s -> %s\n", thread_indent(1), probefunc());
}

You can also use a similar mechanism for selecting only a specific
target process that you are interested in. For example to see the probes
just for the execution of 'echo "aaa" > ufile' of the above you could
do:

probe module("ext3").function("*").call {
  if (target() == pid())
    printf("%s -> %s\n", thread_indent(1), probefunc())
}
probe module("ext3").function("*").return {
  if (target() == pid())
    printf("%s <- %s\n", thread_indent(-1), probefunc())
}

$ stap script.stp -c 'echo "aaa" > ufile'

Where target() is the process id target process (given with -c above).

Cheers,

Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-15 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-15  2:51 how to filter unnecessary info from stap output? ch huang
2012-03-15 10:48 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).