public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: David A Sperry <David_A_Sperry@raytheon.com>
To: fche@redhat.com (Frank Ch. Eigler), Li Guanglei <guanglei@cn.ibm.com>
Cc: systemtap@sources.redhat.com
Subject: Re: Another Newbie question about measuring time in a sys call
Date: Wed, 08 Feb 2006 13:46:00 -0000	[thread overview]
Message-ID: <OF9AAAFE6C.18319C24-ON8525710F.004934D3-8525710F.004BA3FC@mck.us.ray.com> (raw)
In-Reply-To: <y0my80mni9a.fsf@ton.toronto.redhat.com>

Thanks Frank and Li,

Both of your examples work and are a big help!

Frank, I like your example using tid() instead of pid() and the @ave()
function. I modified your script to add @min() and @max() just to see what
would happen and it worked! I got
syscall ioctl count 38 avg 19 min 16 max 23
syscall gettimeofday count 19 avg 11 min 11 max 12
syscall llseek count 38 avg 10 min 9 max 13
syscall fstat64 count 19 avg 11 min 11 max 13
syscall fcntl64 count 722 avg 11 min 7 max 26
syscall creat count 3211 avg 38 min 33 max 1760
syscall stat64 count 1577 avg 32 min 29 max 80
syscall lseek count 57 avg 9 min 8 max 12
syscall getdents count 38 avg 56 min 29 max 80

From this quick test I can see that syscall creat  has at least one call
that took a long time. Really cool!

Dave


systemtap-owner@sourceware.org wrote on 02/08/2006 07:32:17 AM:

>
> David_A_Sperry wrote:
>
> > probe kernel.syscall.* {
> >         if (execname() == "top")
> >                 called[name] = gettimeofday_us()
> > }
> > probe kernel.syscall.*.return {
> >         if (execname() == "top")
> >                 ttime[name] +=  gettimeofday_us() - called[name]
> > }
>
> Indeed, the "name" value exported from the syscalls tapset has been
> changed, for better or for worse.  Plus there are still some
> "kernel.syscall.*" stragglers in the syscalls*stp files, so there is
> plenty of reason for confusion.
>
> Here's how the script might work today.
>
>
> probe kernel.syscall.* {
>    if (execname() != "top") next
>    callee[tid()] = name # saved because .return probe changes name
>    calltime[tid()] = gettimeofday_us()
> }
>
> probe kernel.syscall.*.return {
>    if (execname() != "top") next
>    c=calltime[tid()]
>    if (!c) next
>    delete calltime[tid()]
>    ttime[callee[tid()]] <<< gettimeofday_us() - c
> }
>
> # Note: code like the above probe pair could go into a higher layer
> # standard tapset.
>
> probe end {
>    foreach (x in ttime)
>      printf("syscall %s count %d avg %d\n", x,
>        @count(ttime[x]), @avg(ttime[x]))
> }
>
> global callee, calltime, ttime
>
>
> - FChE

  reply	other threads:[~2006-02-08 13:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08  1:29 David A Sperry
2006-02-08  1:52 ` Li Guanglei
2006-02-08  5:56 ` Li Guanglei
2006-02-08 12:32 ` Frank Ch. Eigler
2006-02-08 13:46   ` David A Sperry [this message]
2006-02-08 15:18     ` Frank Ch. Eigler
2006-02-08 15:54       ` David A Sperry
2006-02-08 16:24         ` Frank Ch. Eigler
2006-02-08 17:38           ` Martin Hunt
2006-02-08 21:14   ` Martin Hunt

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=OF9AAAFE6C.18319C24-ON8525710F.004934D3-8525710F.004BA3FC@mck.us.ray.com \
    --to=david_a_sperry@raytheon.com \
    --cc=fche@redhat.com \
    --cc=guanglei@cn.ibm.com \
    --cc=systemtap@sources.redhat.com \
    /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).