public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Josh Stone <jistone@redhat.com>
Cc: systemtap@sourceware.org
Subject: Flushing systemtap output without restarting (was: Re: Rapidly running systemtap causing hangs or oops)
Date: Thu, 23 Jun 2011 10:12:00 -0000	[thread overview]
Message-ID: <20110623101217.GH18438@amd.home.annexia.org> (raw)
In-Reply-To: <20110623075126.GJ803@amd.home.annexia.org>

On Thu, Jun 23, 2011 at 08:51:26AM +0100, Richard W.M. Jones wrote:
> Unfortunately for the real program I'm writing, I really do need a way
> to box stap around each test.  The problem I was having before was
> that there was quite a long delay between my test running and stap
> probes firing (or at least, seeing stap output).  I need the stap
> output from one test to be clearly distinct from the stap output from
> the next test.  If there was a way to run the test and then say to
> stap "now flush all your output" before running the next test, then
> that would be acceptable.
> 
> I thought about using the process ID, but ideally my tests will all
> run as the same pid.

My first idea for "flushing" stap output involves putting a timestamp
at the start of each stap line, then matching up those timestamps with
when the tests were run.

In my test I have:

  for pass in `seq 1 1000`; do
    d=$(date +'%s.%N')
    echo $d: mount
    mount -o loop /tmp/fs /tmp/mnt
    umount /tmp/mnt
    sync
  done

In my probe I have:

  probe module("ext2").statement ("*@*.c:*")
  {
    us = gettimeofday_us();
    printf ("%d.%d: %s\n", us/1000000, us%1000000, pp());
  }

My aggregated output is supposed to look like this:

  1308822712.884907138: mount
  1308822712.920008: module("ext2").statement("ext2_mount@fs/ext2/super.c:1378")
  1308822712.920015: module("ext2").statement("ext2_mount@fs/ext2/super.c:1379")
  [etc]

Unfortunately this doesn't work.  It seems like the probes don't run
synchronously.  Are they running asynchronously in a bottom half /
softirq / {whatever Linux is calling them this week}?

It certainly looks like they run asynch, because my actual output
(sometimes) looks like:

1308822714.015994546: mount
1308822714.424888519: mount
1308822714.43626: module("ext2").statement("ext2_mount@fs/ext2/super.c:1378")
1308822714.43634: module("ext2").statement("ext2_mount@fs/ext2/super.c:1379")
1308822714.442957: module("ext2").statement("ext2_mount@fs/ext2/super.c:1378")
1308822714.442965: module("ext2").statement("ext2_mount@fs/ext2/super.c:1379")

The output from two tests is mixed together, and the timestamps aren't
accurate.  That's no good for the testing I had in mind.

So is there a way to flush systemtap output without restarting it?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top

  reply	other threads:[~2011-06-23 10:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22 23:00 Rapidly running systemtap causing hangs or oops Richard W.M. Jones
2011-06-22 23:52 ` Josh Stone
2011-06-23  7:51   ` Richard W.M. Jones
2011-06-23 10:12     ` Richard W.M. Jones [this message]
2011-06-23 12:45       ` Flushing systemtap output without restarting (was: Re: Rapidly running systemtap causing hangs or oops) Richard W.M. Jones
2011-06-23 14:13     ` Rapidly running systemtap causing hangs or oops Frank Ch. Eigler
2011-06-23 16:16     ` Josh Stone
2011-06-23 16:28       ` Richard W.M. Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110623101217.GH18438@amd.home.annexia.org \
    --to=rjones@redhat.com \
    --cc=jistone@redhat.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).