LKML Archive on lore.kernel.org
 help / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: rostedt@goodmis.org, tglx@linutronix.de, mhiramat@kernel.org,
	vedang.patel@intel.com, bigeasy@linutronix.de,
	joel@joelfernandes.org, mathieu.desnoyers@efficios.com,
	julia@ni.com, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org, kernel-team@lge.com
Subject: Re: [PATCH v3 4/7] tracing: Add conditional snapshot
Date: Fri, 10 Aug 2018 09:05:50 -0500
Message-ID: <1533909950.1918.10.camel@kernel.org> (raw)
In-Reply-To: <20180810070225.GC479@sejong>

On Fri, 2018-08-10 at 16:02 +0900, Namhyung Kim wrote:
> On Thu, Aug 09, 2018 at 09:34:14AM -0500, Tom Zanussi wrote:
> > From: Tom Zanussi <tom.zanussi@linux.intel.com>
> > 
> > Currently, tracing snapshots are context-free - they capture the
> > ring
> > buffer contents at the time the tracing_snapshot() function was
> > invoked, and nothing else.  Additionally, they're always taken
> > unconditionally - the calling code can decide whether or not to
> > take a
> > snapshot, but the data used to make that decision is kept
> > separately
> > from the snapshot itself.
> > 
> > This change adds the ability to associate with each trace instance
> > some user data, along with an 'update' function that can use that
> > data
> > to determine whether or not to actually take a snapshot.  The
> > update
> > function can then update that data along with any other state (as
> > part
> > of the data presumably), if warranted.
> > 
> > Because snapshots are 'global' per-instance, only one user can
> > enable
> > and use a conditional snapshot for any given trace instance.  To
> > enable a conditional snapshot (see details in the function and data
> > structure comments), the user calls tracing_snapshot_cond_enable().
> > Similarly, to disable a conditional snapshot and free it up for
> > other
> > users, tracing_snapshot_cond_disable() should be called.
> > 
> > To actually initiate a conditional snapshot,
> > tracing_snapshot_cond()
> > should be called.  tracing_snapshot_cond() will invoke the update()
> > callback, allowing the user to decide whether or not to actually
> > take
> > the snapshot and update the user-defined data associated with the
> > snapshot.  If the callback returns 'true', tracing_snapshot_cond()
> > will then actually take the snapshot and return.
> > 
> > This scheme allows for flexibility in snapshot implementations -
> > for
> > example, by implementing slightly different update() callbacks,
> > snapshots can be taken in situations where the user is only
> > interested
> > in taking a snapshot when a new maximum in hit versus when a value
> > changes in any way at all.  Future patches will demonstrate both
> > cases.
> > 
> > Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> > ---
> 
> [SNIP]
> > @@ -1741,9 +1788,16 @@ static inline bool
> > event_command_needs_rec(struct event_command *cmd_ops)
> >  	return cmd_ops->flags & EVENT_CMD_FL_NEEDS_REC;
> >  }
> >  
> > +typedef bool (*cond_update)(struct trace_array *tr, void
> > *cond_data);
> > +
> 
> I think it's better having "fn_t" suffix like 'cond_update_fn_t'.
> 

Yeah, makes sense, will change.

Thanks,

Tom


  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 14:34 [PATCH v3 0/7] tracing: Hist trigger snapshot and onchange additions Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 1/7] tracing: Refactor hist trigger action code Tom Zanussi
2018-08-10  6:58   ` Namhyung Kim
2018-08-10 14:05     ` Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 2/7] tracing: Split up onmatch action data Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 3/7] tracing: Generalize hist trigger onmax and save action Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 4/7] tracing: Add conditional snapshot Tom Zanussi
2018-08-10  7:02   ` Namhyung Kim
2018-08-10 14:05     ` Tom Zanussi [this message]
2018-08-09 14:34 ` [PATCH v3 5/7] tracing: Move hist trigger key printing into a separate function Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 6/7] tracing: Add snapshot action Tom Zanussi
2018-08-10  7:04   ` Namhyung Kim
2018-08-10 14:07     ` Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 7/7] tracing: Add hist trigger onchange() handler Tom Zanussi
2018-08-09 14:47 ` [PATCH v3 0/7] tracing: Hist trigger snapshot and onchange additions Steven Rostedt
2018-08-09 14:51   ` Tom Zanussi
2018-08-09 14:55     ` Steven Rostedt
2018-08-09 14:56       ` Tom Zanussi

Reply instructions:

You may reply publically 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=1533909950.1918.10.camel@kernel.org \
    --to=zanussi@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=joel@joelfernandes.org \
    --cc=julia@ni.com \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vedang.patel@intel.com \
    /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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox