public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* proposed perf.counter enhancement
@ 2012-10-22 18:38 Stan Cox
  2012-10-23 20:49 ` Frank Ch. Eigler
  0 siblings, 1 reply; 5+ messages in thread
From: Stan Cox @ 2012-10-22 18:38 UTC (permalink / raw)
  To: systemtap

This is a proposed syntax for extending the perf counters so that perf 
counter snapshots can be read.  The proposal uses a new probe suffix 
"counter" and generates implicit reads.

		
// Define a perf counter of type X, config Y, sample_freq 0,
// and task T.  Create a global z[cpu, i] to hold the counters.
// Does not call _stp_perf_init as perf.type.config does, but calls it 
// later in process.begin

probe perf.type(0).config(0).counter("y")
{
}

probe perf.type(0).config(0).counter("z")
{
}

// Define a reading counter probe.  Init the probe for the task:
// _stp_perf_init (spr_perf_probes[n], task);
// and generate an implicit read into the counter collector "z", ie
//  for (i = 0; i < %{ num_online_cpus() %}; i++) {
//      z[i, z_dims[i]++] = %{ _stp_perf_read(l->l_i) %}

probe process("pwd").begin.counter("z")
{
}

// generate implicit read as above the term the counter: _stp_perf_del

probe process("pwd").end.counter("z")
{
}

// generate implicit read for process.function[.return]

probe process("pwd").function("main").counter("y").counter("z")
{
}

probe process("pwd").function("main").return.counter("y").counter("z")
{
}

// Another thought is to use on demand reads using stat
// syntax via a perf_read predefined function

probe process("pwd").function("main").counter("y").counter("z")
{
    z <<< perf_read("z")
}

probe end ()
{
    foreach (perf in z)
       printf ("counter[%d] = %d\n", z[perf])
}

probe timer.ms(20000) {
   exit ()
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-11-19 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-22 18:38 proposed perf.counter enhancement Stan Cox
2012-10-23 20:49 ` Frank Ch. Eigler
2012-11-02 18:54   ` Stan Cox
2012-11-19  4:58     ` Stan Cox
2012-11-19 19:16       ` Frank Ch. Eigler

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).