Information Technology Reference
In-Depth Information
Box 5.
nt main(int argc, char* argv[])
{
executable* exec = new executable(argv[1]);
exec->read_contents();
routine* r;
foreach_routine (r, exec->routines())
{
instrument(r);
while(!exec->hidden_routines()->is_empty())
{
r = exec->hidden_routines()->irst();
exec->hidden_routines()->remove(r);
instrument(r);
exec->routines()->add(r);
}
}
addr x = exec->edited_addr(exec->start_address());
exec->write_edited_executable(st_cat(argv[1], “.count”), x);
return (0);
}
void instrument(routine* r)
{
static long num = 0;
cfg* g = r->control_low_graph();
bb* b;
foreach_bb (b, g->blocks())
{
if (1 < b->succ()->size())
{
edge* e;
foreach_edge (e, b->succ())
{
// incr_count is the user-defined code snippet
e->add_code_along(incr_count(num));
num += 1;
}
}
}
r->produce_edited_routine();
r->delete_control_low_graph();
}
The Paradyn work from the University of
Wisconsin, Madison (Miller, Callaghan, Car-
gille, Hollingsworth, Irvin, & Karavanic, 1995)
was designed specifically for measuring the
performance of parallel programs. Paradyn uses
dynamic instrumentation to apply trace function-
ality according to a set of resource hierarchies,
as shown in Figure 3 (shaded nodes represent an
example focus, all spin locks in CPU#1, in any
procedure). Entities within the resource hierar-
 
Search WWH ::




Custom Search