All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Wang Nan <wangnan0@huawei.com>
Cc: acme@kernel.org, jolsa@redhat.com, linux-kernel@vger.kernel.org,
	pi3orama@163.com, Adrian Hunter <adrian.hunter@intel.com>,
	He Kuang <hekuang@huawei.com>, Jiri Olsa <jolsa@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Zefan Li <lizefan@huawei.com>
Subject: Re: [PATCH v5 1/6] perf tools: Derive trigger class from auxtrace_snapshot
Date: Wed, 20 Apr 2016 22:20:23 +0900	[thread overview]
Message-ID: <20160420132023.GB29186@danjae.aot.lge.com> (raw)
In-Reply-To: <1460991332-185772-2-git-send-email-wangnan0@huawei.com>

Hello,

On Mon, Apr 18, 2016 at 02:55:27PM +0000, Wang Nan wrote:
> Use 'trigger' to model operations which need to be executed when
> an event (a signal, for example) is observed.
> 
> States and transits:
> 
>  OFF--(on)--> READY --(toggle)--> TOGGLED
>                 ^                    |
>                 |                 (ready)
>                 |                    |
>                  \__________________/
> 
> is_toggled and is_ready are two key functions to query the state of
> a trigger. is_toggled means the event already happen; is_ready means the
> trigger is waiting for the event.

Not sure 'toggle' is the right word in this case.  Maybe 'set/reset'
or 'ready/hit' can be used, if each operation is one-way.  But this is
not a big deal anyway.

Btw why not split this patch into two parts - introducing trigger
logic and replacing snapshot code with the trigger?


> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> ---

[SNIP]
> +#define __TRIGGER_VAR(n) n##_state
> +#define __DEF_TRIGGER_VOID_FUNC(n, op)	\
> +static inline void n##_##op(void) {trigger_##op(&__TRIGGER_VAR(n)); }
> +#define __DEF_TRIGGER_BOOL_FUNC(n, op)	\
> +static inline bool n##_##op(void) {return trigger_##op(&__TRIGGER_VAR(n)); }
> +
> +#define DEFINE_TRIGGER(n)					\
> +struct trigger n##_state = {.state = TRIGGER_OFF, .name = #n};	\
> +__DEF_TRIGGER_VOID_FUNC(n, on)					\
> +__DEF_TRIGGER_VOID_FUNC(n, ready)				\
> +__DEF_TRIGGER_VOID_FUNC(n, toggle)				\
> +__DEF_TRIGGER_VOID_FUNC(n, off)					\
> +__DEF_TRIGGER_VOID_FUNC(n, error)				\
> +__DEF_TRIGGER_BOOL_FUNC(n, is_ready)				\
> +__DEF_TRIGGER_BOOL_FUNC(n, is_toggled)				\
> +__DEF_TRIGGER_BOOL_FUNC(n, is_error)

Why did you define all functions for each trigger variable?  Wouldn't
it be better using generic trigger code and passing the trigger instead?

Thanks,
Namhyung

  parent reply	other threads:[~2016-04-20 13:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 14:55 [PATCH v5 0/6] perf tools: Use SIGUSR2 control data dumpping Wang Nan
2016-04-18 14:55 ` [PATCH v5 1/6] perf tools: Derive trigger class from auxtrace_snapshot Wang Nan
2016-04-20  7:46   ` Jiri Olsa
2016-04-20 13:20   ` Namhyung Kim [this message]
2016-04-18 14:55 ` [PATCH v5 2/6] perf record: Split output into multiple files via '--switch-output' Wang Nan
2016-04-20  7:54   ` Jiri Olsa
2016-04-18 14:55 ` [PATCH v5 3/6] perf record: Force enable --timestamp-filename when --switch-output is provided Wang Nan
2016-04-20  7:59   ` Jiri Olsa
2016-04-20  8:21     ` Wangnan (F)
2016-04-20 12:29       ` Jiri Olsa
2016-04-18 14:55 ` [PATCH v5 4/6] perf record: Disable buildid cache options by default in switch output mode Wang Nan
2016-04-18 14:55 ` [PATCH v5 5/6] perf record: Re-synthesize tracking events after output switching Wang Nan
2016-04-18 14:55 ` [PATCH v5 6/6] perf record: Generate tracking events for process forked by perf Wang Nan

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=20160420132023.GB29186@danjae.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mhiramat@kernel.org \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.