Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does dtrace4linux support USDT probes? #23

Open
msabramo opened this issue Mar 4, 2012 · 0 comments
Open

Does dtrace4linux support USDT probes? #23

msabramo opened this issue Mar 4, 2012 · 0 comments

Comments

@msabramo
Copy link
Contributor

msabramo commented Mar 4, 2012

I ask because I've been trying to see if I can get a patch to add USDT probes to Python (http://bugs.python.org/issue13405) working with dtrace4linux.

I can get Python to build with this patch, but so far I haven't had success getting it to recognize the probes.

marca@ubuntu:~/src/python-dtrace/cpython-2011$ cat track.d
unsigned long int tam;
unsigned int num;

pid$target::PyCode_New:entry
{
    self->flag=1;
}

pid$target::PyCode_New:return
{
    self->flag=0;
}

pid$target::PyMem_Malloc:entry
/self->flag/
{
    self->tam=arg0;
    tam+=arg0;
    num+=1;
    printf("%d %d", num, tam);
}

pid$target::PyMem_Malloc:return
/self->flag/
{
    pos[arg1]=self->tam;
    self->tam=0;
}

pid$target::PyMem_Free:entry
/pos[arg0]/
{
    num-=1;
    tam-=pos[arg0];
    pos[arg0]=0;
}

marca@ubuntu:~/src/python-dtrace/cpython-2011$ sudo dtrace -s track.d -c "/Users/marca/custom/bin/pydoc foo"
...

found section .shstrtab
found section .symtab
found section .strtab
plt at 0x9e29938
sym_by_name_binary: NOT found _PROCEDURE_LINKAGE_TABLE_
Pxlookup_by_name 'main' a.out 0x9e2935c 0x9e28550
sym_by_name_binary: found main
dtrace: failed to compile script track.d: line 4: probe description pid2780::PyCode_New:entry does not match any probes
dt_proc_destroy flags=37748737

If USDT probes aren't supported yet, then I won't spend more time on this, but if they are supposed to work, then I might take a look at the patch itself and see if it needs fixes.

By the way, here's the output of the command I showed using a patched Python on OS X:

[last: 0] marca@SCML-MarcA:~/python/dtrace$ sudo dtrace -s track.d -c "/Users/marca/custom/bin/pydoc foo"
dtrace: script 'track.d' matched 5 probes
no Python documentation found for 'foo'

dtrace: pid 38014 has exited
CPU     ID                    FUNCTION:NAME
  0 146268               PyMem_Malloc:entry 35 19604
  0 146268               PyMem_Malloc:entry 36 19788
  0 146268               PyMem_Malloc:entry 37 19916
  0 146268               PyMem_Malloc:entry 38 20062
  0 146268               PyMem_Malloc:entry 39 20208
  0 146268               PyMem_Malloc:entry 40 20378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant