From: Lukas Berk <lberk@redhat.com>
To: systemtap@sourceware.org
Subject: Event-Counting Script
Date: Tue, 03 May 2011 19:47:00 -0000 [thread overview]
Message-ID: <20110503194728.GA17548@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
Hey All,
I put together eventcount.stp (attached) to address PR12508 which allows
for per event counting in the format of 'stap eventcount.stp
syscall.exit syscall.exit_group process.end ...'. The event count is
reported with the corresponding thread id to support multi-threaded
applications. You can find it in testsuite/systemtap.examples/general/.
Please check it out!
Lukas Berk
[-- Attachment #2: eventcount.stp --]
[-- Type: text/plain, Size: 1586 bytes --]
#! /usr/bin/env stap
global c
probe %($# == 0 || $# > 32 %? begin %: never %)
{
printf("Please specify between 1 and 32 events to count.\n")
exit()
}
//paramaterize up to 32 arguments
probe %($# >= 1 %? $1 %: never %),
%($# >= 2 %? $2 %: never %),
%($# >= 3 %? $3 %: never %),
%($# >= 4 %? $4 %: never %),
%($# >= 5 %? $5 %: never %),
%($# >= 6 %? $6 %: never %),
%($# >= 7 %? $7 %: never %),
%($# >= 8 %? $8 %: never %),
%($# >= 9 %? $9 %: never %),
%($# >= 10 %? $10 %: never %),
%($# >= 11 %? $11 %: never %),
%($# >= 12 %? $12 %: never %),
%($# >= 13 %? $13 %: never %),
%($# >= 14 %? $14 %: never %),
%($# >= 15 %? $15 %: never %),
%($# >= 16 %? $16 %: never %),
%($# >= 17 %? $17 %: never %),
%($# >= 18 %? $18 %: never %),
%($# >= 19 %? $19 %: never %),
%($# >= 20 %? $20 %: never %),
%($# >= 21 %? $21 %: never %),
%($# >= 22 %? $22 %: never %),
%($# >= 23 %? $23 %: never %),
%($# >= 24 %? $24 %: never %),
%($# >= 25 %? $25 %: never %),
%($# >= 26 %? $26 %: never %),
%($# >= 27 %? $27 %: never %),
%($# >= 28 %? $28 %: never %),
%($# >= 29 %? $29 %: never %),
%($# >= 30 %? $30 %: never %),
%($# >= 31 %? $32 %: never %),
%($# >= 32 %? $32 %: never %)
{
if (target() && pid() != target())
next
c[tid(), pn()]<<<1
}
probe end {
printf("%s\t%s\n", "TID", "EVENT: COUNT")
foreach([tid+, name] in c)
printf("%5d\t%s: %d\n",tid, name, @count(c[tid, name]))
delete c
}
next reply other threads:[~2011-05-03 19:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 19:47 Lukas Berk [this message]
2011-05-04 1:31 ` Lukas Berk
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=20110503194728.GA17548@redhat.com \
--to=lberk@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).