public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] tracing: Add 'hash' event trigger command
Date: Thu, 03 Apr 2014 17:43:19 -0500	[thread overview]
Message-ID: <1396564999.3047.65.camel@empanada> (raw)
In-Reply-To: <533D22E6.4000607@hitachi.com>

Hi Masami,

On Thu, 2014-04-03 at 17:59 +0900, Masami Hiramatsu wrote:
> Hi Tom,
> 
> (2014/03/27 13:54), Tom Zanussi wrote:
> > Hash triggers allow users to continually hash events which can then be
> > dumped later by simply reading the trigger file.  This is done
> > strictly via one-liners and without any kind of programming language.
> > 
> > The syntax follows the existing trigger syntax:
> > 
> >   # echo hash:key(s):value(s)[:sort_keys()][ if filter] > event/trigger
> > 
> > The values used as keys and values are just the fields that define the
> > trace event and available in the event's 'format' file.  For example,
> > the kmalloc event:
> > 
> > root@ie:/sys/kernel/debug/tracing/events/kmem/kmalloc# cat format
> > name: kmalloc
> > ID: 370
> > format:
> >         field:unsigned short common_type;       offset:0;       size:2; signed:0;
> >         field:unsigned char common_flags;       offset:2;       size:1; signed:0;
> >         field:unsigned char common_preempt_count;       offset:3;       size:1;signed:0;
> >         field:int common_pid;   offset:4;       size:4; signed:1;
> > 
> >         field:unsigned long call_site;  offset:8;       size:4; signed:0;
> >         field:const void * ptr; offset:12;      size:4; signed:0;
> >         field:size_t bytes_req; offset:16;      size:4; signed:0;
> >         field:size_t bytes_alloc;       offset:20;      size:4; signed:0;
> >         field:gfp_t gfp_flags;  offset:24;      size:4; signed:0;
> > 
> > The key can be made up of one or more of these fields and any number of
> > values can specified - these are automatically tallied in the hash entry
> > any time the event is hit.  Stacktraces can also be used as keys.
> > 
> > For example, the following uses the stacktrace leading up to a kmalloc
> > as the key for hashing kmalloc events.  For each hash entry a tally of
> > the bytes_alloc field is kept.  Dumping out the trigger shows the sum
> > of bytes allocated for each execution path that led to a kmalloc:
> > 
> >   # echo 'hash:call_site:bytes_alloc' > /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
> >   # cat /sys/kernel/debug/tracing/events/kmem/kmalloc/trigger
> 
> I like the basic idea :) but I'm confused the interface what you're introduced.
> I suppose that the "trigger" file is for control triggers on the event, so that
> user can check what trigger rules are set on the event and remove it.
> But in this patch, that is also used for a data path.
> 
> I'd like to suggest adding new "hash" file under events/GROUP/EVENT/, which is
> only for dumping the hash data, and keep the "trigger" as a control path.
> This makes users easier to build their own tools on the ftrace facility.
> 

I was really trying to avoid adding a new file - my thinking was that
the trigger file is just sitting there doing nothing besides either
listing available triggers when inactive or listing active triggers when
active, which it would still do even if also providing a conduit for the
output.

I agree that it would be cleaner to have a separate file, but I don't
know if it's worth a dedicated file.  Another possibility would be to
have it exist only when a hash trigger is active..

Tom


> Thank you,
> 
> 



  reply	other threads:[~2014-04-03 22:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  4:54 [PATCH 0/5] tracing: Hash triggers Tom Zanussi
2014-03-27  4:54 ` [PATCH 1/5] tracing: Make ftrace_event_field checking functions available Tom Zanussi
2014-03-27  4:54 ` [PATCH 2/5] tracing: Add event record param to trigger_ops.func() Tom Zanussi
2014-03-27  4:54 ` [PATCH 3/5] tracing: Add get_syscall_name() Tom Zanussi
2014-03-27  4:54 ` [PATCH 4/5] tracing: Add hash trigger to Documentation Tom Zanussi
2014-03-27  4:54 ` [PATCH 5/5] tracing: Add 'hash' event trigger command Tom Zanussi
2014-03-28 16:54   ` Andi Kleen
2014-03-28 19:13     ` Tom Zanussi
2014-04-03  8:59   ` Masami Hiramatsu
2014-04-03 22:43     ` Tom Zanussi [this message]
2014-04-04  1:44       ` Masami Hiramatsu

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=1396564999.3047.65.camel@empanada \
    --to=tom.zanussi@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.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