[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACbG30-ymdXDoMKSGvFDGBvnF5chHrbGOHXy5bxRM0L+uOrR9w@mail.gmail.com>
Date: Wed, 22 Jun 2016 09:33:05 -0500
From: Nilay Vaish <nilayvaish@...il.com>
To: Wang Nan <wangnan0@...wei.com>
Cc: acme@...nel.org, Linux Kernel list <linux-kernel@...r.kernel.org>,
pi3orama@....com, He Kuang <hekuang@...wei.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Jiri Olsa <jolsa@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Zefan Li <lizefan@...wei.com>
Subject: Re: [PATCH v9 5/8] perf record: Toggle overwrite ring buffer for reading
On 22 June 2016 at 04:08, Wang Nan <wangnan0@...wei.com> wrote:
> @@ -549,17 +573,72 @@ static struct perf_event_header finished_round_event = {
> .type = PERF_RECORD_FINISHED_ROUND,
> };
>
> -static int record__mmap_read_all(struct record *rec)
> +static void
> +record__toggle_overwrite_evsels(struct record *rec,
> + enum overwrite_evt_state state)
> +{
> + struct perf_evlist *evlist = rec->overwrite_evlist;
> + enum overwrite_evt_state old_state = rec->overwrite_evt_state;
> + enum action {
> + NONE,
> + PAUSE,
> + RESUME,
> + } action = NONE;
> +
> + switch (old_state) {
> + case OVERWRITE_EVT_RUNNING:
> + if (state != OVERWRITE_EVT_RUNNING)
> + action = PAUSE;
> + break;
> + case OVERWRITE_EVT_DATA_PENDING:
> + if (state == OVERWRITE_EVT_RUNNING)
> + action = RESUME;
> + break;
> + case OVERWRITE_EVT_EMPTY:
> + if (state == OVERWRITE_EVT_RUNNING)
> + action = RESUME;
> + if (state == OVERWRITE_EVT_DATA_PENDING)
> + state = OVERWRITE_EVT_EMPTY;
else if (state == OVERWRITE_EVT_DATA_PENDING)
> + break;
> + default:
> + WARN_ONCE(1, "Shouldn't get there\n");
> + }
> +
> + rec->overwrite_evt_state = state;
> +
> + if (action == NONE)
> + return;
I think the above two lines are not required. The switch below should
be enough.
> +
> + if (!evlist)
> + return;
> +
> + switch (action) {
> + case PAUSE:
> + perf_evlist__pause(evlist);
> + break;
> + case RESUME:
> + perf_evlist__resume(evlist);
> + break;
> + case NONE:
> + default:
> + break;
> + }
> +}
> +
--
Nilay
Powered by blists - more mailing lists