public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Mike Mason <mmlnx@us.ibm.com>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: systemtap@sources.redhat.com
Subject: Re: Fwd: Any way to find the network usage by a process?
Date: Fri, 06 Oct 2006 01:10:00 -0000	[thread overview]
Message-ID: <4525AD02.10301@us.ibm.com> (raw)
In-Reply-To: <20061006000023.GA24096@redhat.com>

Frank Ch. Eigler wrote:
> Hi -
> 
> On Thu, Oct 05, 2006 at 04:28:10PM -0700, Mike Mason wrote:
>> [...]
>> ERROR: empty aggregate near identifier 'execname' at nettop.stp:35:4
>> WARNING: Number of errors: 1, skipped probes: 0
>> Apparently using @sum on empty aggregates isn't allowed. I expected 0's to 
>> be returned. 
> 
> As a judgement call, to be consistent with other extractors like @avg,
> the @sum etc. of an empty set was deemed to be undefined.
> 
>> The only way to avoid the error is use @sum only if @count > 
>> 0, which makes the printf too complex in my opinion.
> 
> Maybe so.  It's worth considering some syntactic sugar to express a
> undefined=>0 intent.

Actually, the following works fine and doesn't complicate it too much:

         foreach ([pid, dev] in ifpid-) {
                 n_xmit = @count(ifxmit[pid, dev])
                 n_recv = @count(ifrecv[pid, dev])
                 printf("%5d %5d %-7s %7d %7d %7d %7d %-15s\n",
                         pid, user[pid], dev, n_xmit, n_recv,
                         n_xmit ? @sum(ifxmit[pid, dev])/1024 : 0,
                         n_recv ? @sum(ifrecv[pid, dev])/1024 : 0,
                         execname[pid])
         }

I'll update the wiki page.  Thanks for the suggestions.

- Mike


  reply	other threads:[~2006-10-06  1:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3420082f0610030114o5b44b8ak7797483e02002614@mail.gmail.com>
     [not found] ` <3420082f0610030114o4c6998en907bccce81d28c59@mail.gmail.com>
2006-10-03 15:49   ` Jose R. Santos
2006-10-04 20:54     ` Mike Mason
2006-10-05 21:22       ` Frank Ch. Eigler
2006-10-05 23:28         ` Mike Mason
2006-10-06  0:00           ` Frank Ch. Eigler
2006-10-06  1:10             ` Mike Mason [this message]
2006-10-06 15:30               ` Frank Ch. Eigler
2006-10-06  1:08 Stone, Joshua I

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=4525AD02.10301@us.ibm.com \
    --to=mmlnx@us.ibm.com \
    --cc=fche@redhat.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).