[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200402134052.GI2518490@krava>
Date: Thu, 2 Apr 2020 15:40:52 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Petr Mladek <pmladek@...e.com>,
Andrey Zhizhikin <andrey.z@...il.com>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Thomas Gleixner <tglx@...utronix.de>,
Kan Liang <kan.liang@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 5/5] perf synthetic events: Remove use of sscanf from
/proc reading
On Wed, Apr 01, 2020 at 04:39:45PM -0700, Ian Rogers wrote:
> The synthesize benchmark, run on a single process and thread, shows
> perf_event__synthesize_mmap_events as the hottest function with fgets
> and sscanf taking the majority of execution time. fscanf performs
> similarly well. Replace the scanf call with manual reading of each field
> of the /proc/pid/maps line, and remove some unnecessary buffering.
> This change also addresses potential, but unlikely, buffer overruns for
> the string values read by scanf.
>
> Performance before is:
> Average synthesis took: 120.195100 usec
> Average data synthesis took: 156.582300 usec
>
> And after is:
> Average synthesis took: 67.189100 usec
> Average data synthesis took: 102.451600 usec
>
> On a Intel Xeon 6154 compiling with Debian gcc 9.2.1.
I can see the speedup as well, thanks!
jirka
Powered by blists - more mailing lists