Bug 12508 - event-counting command line option
Summary: event-counting command line option
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Lukas Berk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-23 12:58 UTC by Frank Ch. Eigler
Modified: 2011-05-03 19:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2011-02-23 12:58:01 UTC
People seem to find useful the basic "perf -e EVENT -e EVENT2 CMD" type of
invocation, where the tool reports overall event counts.  We could support
such a shortcut too, for example:

    stap -E perf.sw_clock -E 'syscall.*' -c CMD

to be rewritten into something close to

    stap -e 'global c; probe perf.sw_clock,syscall.* { c[pn()]<<<1 }'
         -c CMD

except perhaps the automatic global-c printing loop could restrict itself
to @count() only.
Comment 1 Frank Ch. Eigler 2011-04-27 23:55:14 UTC
Note that this may be achievable with no translator code changes,
but rather just a systemtap script that's parametrized with the
probe points, ie.

% stap eventcount.stp perf.sw_clock 'syscall.*'
Comment 2 Lukas Berk 2011-05-03 19:25:22 UTC
commit: eb521ae66706271bd0687db92fcb346cff3fee90

An eventcount.stp script has now been added which allows for event
counting in the format of 'stap eventcount.stp syscall.* process.end ...'
with a printout of tid's event and count.

NEWS - news blurb
testsuite/systemtap.examples/general/eventcount.meta - meta file
testsuite/systemtap.examples/general/eventcount.stp - script itself