[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201024154357.GD2589351@krava>
Date: Sat, 24 Oct 2020 17:43:57 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 12/15] perf record: introduce thread local variable
for trace streaming
On Wed, Oct 21, 2020 at 07:07:00PM +0300, Alexey Budankov wrote:
>
> Introduce thread local variable and use it for threaded trace streaming.
>
> Signed-off-by: Alexey Budankov <alexey.budankov@...ux.intel.com>
> ---
> tools/perf/builtin-record.c | 71 ++++++++++++++++++++++++++++++++-----
> 1 file changed, 62 insertions(+), 9 deletions(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 89cb8e913fb3..3b7e9026f25b 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -101,6 +101,8 @@ struct thread_data {
> u64 bytes_written;
> };
>
> +static __thread struct thread_data *thread;
> +
> struct record {
> struct perf_tool tool;
> struct record_opts opts;
> @@ -587,7 +589,11 @@ static int record__pushfn(struct mmap *map, void *to, void *bf, size_t size)
> }
> }
>
> - rec->samples++;
> + if (thread)
> + thread->samples++;
> + else
> + rec->samples++;
this is really wrong, let's keep just single samples counter
ditto for all the other places in this patch
SNIP
> - if (hits == rec->samples) {
> + if (thread)
> + hits1 = thread->samples;
> + else
> + hits1 = rec->samples;
> +
> + if (hits0 == hits1) {
> if (done || draining)
> break;
> - err = evlist__poll(rec->evlist, -1);
> +
> + if (thread)
> + err = fdarray__poll(&thread->pollfd, -1);
> + else
> + err = evlist__poll(rec->evlist, -1);
same here, why do we have the __thread struct then?
jirka
Powered by blists - more mailing lists