This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
discussion about registering task_finder in user space probing
- From: Wenji Huang <wenji dot huang at oracle dot com>
- To: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Tue, 24 Mar 2009 17:06:36 +0800
- Subject: discussion about registering task_finder in user space probing
- Reply-to: wenji dot huang at oracle dot com
Hi,
I found our task_finder embedded in each stap_uprob_spec even it is
same. That will cause many times registering similar task_finder. For
example,
$stap -p4 -vve 'probe
process("/home/wjhuang/Download/git-1.5.6/git*").function("xmalloc"){}'
The generated C code is like,
[snip]
static struct stap_uprobe_spec {
struct stap_task_finder_target finder;
unsigned long address;
const char *pathname;
const char *pp;
void (*ph) (struct context*);
unsigned return_p:1;
} stap_uprobe_specs [] = {
{ .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", },
.address=(unsigned long)0x804b180ULL,
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc@/home/wjhuang/Download/git-1.5.6/git-compat-util.h:256\")",
.ph=&probe_1383, },
{ .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", },
.address=(unsigned long)0x804b9cfULL,
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc@/home/wjhuang/Download/git-1.5.6/git-compat-util.h:256\")",
.ph=&probe_1383, },
{ .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", },
.address=(unsigned long)0x804c05cULL,
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc@/home/wjhuang/Download/git-1.5.6/git-compat-util.h:256\")",
.ph=&probe_1383, },
{ .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", },
.address=(unsigned long)0x804c3b0ULL,
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc\")",
.ph=&probe_1383, },
[snip]
for (i=0; i<220; i++) {
struct stap_uprobe_spec *sups = & stap_uprobe_specs[i];
probe_point = sups->pp;
if (sups->finder.pathname) sups->finder.callback = &
stap_uprobe_process_found;
else if (sups->pathname) sups->finder.vm_callback = &
stap_uprobe_vmchange_found;
rc = stap_register_task_finder_target (& sups->finder);
if (rc) break;
}
[snip]
So we will have 220 times registering similar task_finder. I think
the probe point is irrelevant to task_finder. Can we just keep only one
and invoke callbacks to register all the stap_uprobes[i] once interested
process found?
Regards,
Wenji