This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
visit_target_symbol() for derived_probes
- From: William Cohen <wcohen at redhat dot com>
- To: "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: Tue, 22 Aug 2006 11:30:05 -0400
- Subject: visit_target_symbol() for derived_probes
Hi all,
For the perfmon access to the performance monitoring hardware there
needs to be a way of know which performance counter is being used to
count a specified event. Because of the constraints of some performance
monitoring hardware libpfm needs to pick out the appropriate register to
store the counter. This information need to be relayed back to the
systemtap script. I was thinking about using something like the
$return,e.g. $counter in script to have the following:
global handle
global cycles_start, cycles_end
probe perfmon.counter("CPU_CLK_UNHALTED") {handle=counter}
probe begin { cycles_start = read_counter(handle) }
probe end
{
cycles_end = read_counter(handle);
elapsed = cycles_start - cycles_end;
printf("%d cycles\n", elapsed);
}
I have been looking at how target symbols and $return are handled in the
dwarf_derived_probe. However, this code code is only used for probes
using dwarf_derived_probes. The default from elaborate.cxx gets used
instead.
void
typeresolution_info::visit_target_symbol (target_symbol* e)
{
// This occurs only if a target symbol was not resolved over in
// tapset.cxx land, that error was properly suppressed, and the
// later unused-expression-elimination pass didn't get rid of it
// either. So we have a target symbol that is believed to be of
// genuine use, yet unresolved by the provider.
throw semantic_error("unresolved target-symbol expression", e->tok);
}
How is the node in the tree generated for the target symbol? Is there
some outline on how to make new tapsets handle the target symbols (or
other specific nodes)?
-Will