This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

proposed perf.counter enhancement


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 ()
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]