public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frank Ch. Eigler" <fche@redhat.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "Pekka Enberg" <penberg@cs.helsinki.fi>,
	"Ingo Molnar" <mingo@elte.hu>, acme <acme@redhat.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Eduard-Gabriel Munteanu" <eduard.munteanu@linux360.ro>,
	roland <roland@redhat.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Masami Hiramatsu" <mhiramat@redhat.com>,
	"Mathieu Desnoyers" <mathieu.desnoyers@polymtl.ca>,
	linux-kernel@vger.kernel.org
Subject: Re: malloc() tracing in perf?
Date: Thu, 6 Aug 2009 07:20:59 -0400	[thread overview]
Message-ID: <20090806112059.GD18768@redhat.com> (raw)
In-Reply-To: <1249546610.32113.35.camel@twins>

Hi -

On Thu, Aug 06, 2009 at 10:16:50AM +0200, Peter Zijlstra wrote:
> [...]
> > But then it hit me, why can't I have kmemtrace + perf but for 
> > user-space? Something like the "Malloc Trace" shown here:
> > [...]

> I seem to have heard people are working on such a thing, but I can't
> seem to find a single LKML post with 'uprobe' in the subject in the
> past two years [...]

That work is ongoing, and being discussed on utrace-devel@redhat.com,
since it is a prerequisite.  One of the widgets that is being proposed
for it is an ftrace engine frontend for uprobes, paralleling the one
mhiramat wrote for kprobes.


> Now doing probes on userspace is hard because you need to know more
> about the userspace bits than a kernel really ought to be interested
> in.  [...]  Anyway, like you say, it has uses (potentially very
> powerful ones), Sun/Apple do it with Dtrace, Linux wants it but I
> don't think we quite agreed on how to do it :-)

While these deliberations are ongoing, you can use systemtap.  Probing
random places in userspace is about as casual as probing the kernel:


# stap -e '
   probe process("/lib/libc.so.6").function("malloc").return,
         process("/lib/libc.so.6").function("free").return
   { println(probfunc()," ",$$parms," ",$$return) }
' -c 'ls'   # -c 'CMD ARGS'

__libc_malloc bytes=0x238  return=0x1524010 
__libc_malloc bytes=0x238  return=0x1524010 
__libc_malloc bytes=0x78  return=0x1524250 
__libc_malloc bytes=0xa  return=0x15242d0 
__libc_free mem=0x1524250  
__libc_free mem=0x1524010  
__libc_malloc bytes=0x64  return=0x1524010 
__libc_malloc bytes=0x16  return=0x1524080 
__libc_free mem=0x1524010  
__libc_malloc bytes=0x64  return=0x1524010 
[...]
__libc_free mem=0x1524490  
__libc_free mem=0x1524500  
__libc_free mem=0x15245e0  
__libc_free mem=0x1524620  
__libc_free mem=0x1524430  
__libc_free mem=0x1524570  
__libc_free mem=0x1524660  
__libc_free mem=0x15246d0  
__libc_free mem=0x15242d0  

You can google some other success stories or ask for more help at
systemtap@sourceware.org.


- FChE

  parent reply	other threads:[~2009-08-06 11:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4A7A8ADD.4080208@cs.helsinki.fi>
     [not found] ` <1249546610.32113.35.camel@twins>
2009-08-06  8:20   ` malloc() tracing in perf? Pekka Enberg
     [not found]   ` <4A7A9F7F.7080405@cs.helsinki.fi>
2009-08-06  9:19     ` Pekka Enberg
2009-08-06  9:42       ` Peter Zijlstra
2009-08-06 11:20   ` Frank Ch. Eigler [this message]
2009-08-06 11:28     ` Peter Zijlstra
2009-08-06 11:55       ` Frank Ch. Eigler
2009-08-06 12:59         ` Peter Zijlstra
2009-08-06 13:47           ` Steven Rostedt
2009-08-06 14:17           ` Frank Ch. Eigler
2009-08-06 13:35   ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090806112059.GD18768@redhat.com \
    --to=fche@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=eduard.munteanu@linux360.ro \
    --cc=fweisbec@gmail.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox