public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 0/6] event synthesization multithreading for perf record
@ 2017-10-20 20:05 kan.liang
  2017-10-20 20:05 ` [PATCH V3 1/6] perf tools: pass thread info to process function kan.liang
                   ` (6 more replies)
  0 siblings, 7 replies; 27+ messages in thread
From: kan.liang @ 2017-10-20 20:05 UTC (permalink / raw)
  To: acme, mingo, linux-kernel
  Cc: peterz, jolsa, wangnan0, hekuang, namhyung, alexander.shishkin,
	adrian.hunter, ak, Kan Liang

From: Kan Liang <Kan.liang@intel.com>

The event synthesization multithreading is introduced in
("perf top optimization") https://lkml.org/lkml/2017/9/29/269
But it was not enabled for perf record. Because the process function
process_synthesized_event was not multithreading friendly.

The patch series temporarily stores the process result in per-thread file,
which make the processing in parallel. Then it dumps the file one by one to
the perf.data at the end of event synthesization.

The source code is also available at
https://github.com/kliang2/perf.git perf_record_opt

Usually, the event synthesization only happens once on either start or end.
With the snapshotting code, we synthesize events multiple times, once per
each new perf.data file. Both of the cases are verified.

Here are the latency test result on Knights Mill and Skylake server

The workload is to compile Linux kernel as below
"sudo nice make -j$(grep -c '^processor' /proc/cpuinfo)"
Then, "sudo perf record -e cycles -a -- sleep 1"

The latency is the time cost of __machine__synthesize_threads or
its multithreading replacement, record__multithread_synthesize.

Original:              original single thread synthesize
With patch(not merge): multithread synthesize without final file merge
                       (intermediate results for scalability measurement)
With patch(merge):     multithread synthesize with file merge
                       (final result)

- Latency on Knights Mill (272 CPUs)

Original(s)	With patch(not merge)(s)	With patch(merge)(s)
12.7		6.6				7.76

- Latency on Skylake server (192 CPUs)

Original(s)	With patch(not merge)(s)	With patch(merge)(s)
0.34		0.21				0.23

Changes since V2:
 - Introduce a new interface to automatically generate tmp file.(Patch 4/6)
   Remove the tmp file when it close. (jirka)
 - Move all checks to record__multithread_synthesize (jirka)
 - Minor changes for record__multithread_synthesize
 - Update test data (Ingo)

Changes since V1:
 - Dump the synthesized result to per-thread file and merge them to perf.data
   at the end. (Arnaldo)

Kan Liang (6):
  perf tools: pass thread info to process function
  perf tools: pass thread info in event synthesization
  perf tools: expose copyfile_offset()
  perf tools: add perf_data_file__open_tmp
  perf record: synthesize event multithreading support
  perf record: add option to set the number of thread for event
    synthesize

 tools/perf/Documentation/perf-record.txt |   4 ++
 tools/perf/arch/x86/util/tsc.c           |   2 +-
 tools/perf/builtin-inject.c              |  12 +++-
 tools/perf/builtin-record.c              | 114 ++++++++++++++++++++++++++++---
 tools/perf/builtin-sched.c               |  12 ++--
 tools/perf/builtin-stat.c                |   3 +-
 tools/perf/builtin-trace.c               |   3 +-
 tools/perf/tests/cpumap.c                |   6 +-
 tools/perf/tests/dwarf-unwind.c          |   6 +-
 tools/perf/tests/event_update.c          |  12 ++--
 tools/perf/tests/stat.c                  |   9 ++-
 tools/perf/tests/thread-map.c            |   3 +-
 tools/perf/util/auxtrace.c               |   2 +-
 tools/perf/util/data.c                   |  26 +++++++
 tools/perf/util/data.h                   |   2 +
 tools/perf/util/event.c                  | 111 ++++++++++++++++++------------
 tools/perf/util/event.h                  |  19 ++++--
 tools/perf/util/header.c                 |  16 ++---
 tools/perf/util/intel-bts.c              |   3 +-
 tools/perf/util/intel-pt.c               |   3 +-
 tools/perf/util/session.c                |   4 +-
 tools/perf/util/util.c                   |   2 +-
 tools/perf/util/util.h                   |   2 +
 23 files changed, 284 insertions(+), 92 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-10-25  9:07 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-20 20:05 [PATCH V3 0/6] event synthesization multithreading for perf record kan.liang
2017-10-20 20:05 ` [PATCH V3 1/6] perf tools: pass thread info to process function kan.liang
2017-10-20 20:05 ` [PATCH V3 2/6] perf tools: pass thread info in event synthesization kan.liang
2017-10-20 20:05 ` [PATCH V3 3/6] perf tools: expose copyfile_offset() kan.liang
2017-10-20 20:05 ` [PATCH V3 4/6] perf tools: add perf_data_file__open_tmp kan.liang
2017-10-23 16:13   ` Jiri Olsa
2017-10-23 16:19     ` Liang, Kan
2017-10-23 16:26       ` Jiri Olsa
2017-10-23 18:05         ` Liang, Kan
2017-10-24  7:26           ` Jiri Olsa
2017-10-24  7:26   ` Jiri Olsa
2017-10-20 20:05 ` [PATCH V3 5/6] perf record: synthesize event multithreading support kan.liang
2017-10-20 20:05 ` [PATCH V3 6/6] perf record: add option to set the number of thread for event synthesize kan.liang
2017-10-23 11:48 ` [PATCH V3 0/6] event synthesization multithreading for perf record Ingo Molnar
2017-10-23 13:43   ` Liang, Kan
2017-10-23 14:25     ` acme
2017-10-23 18:45       ` Liang, Kan
2017-10-24  9:22     ` Ingo Molnar
2017-10-24 11:47       ` Jiri Olsa
2017-10-24 12:47         ` Liang, Kan
2017-10-24 12:59         ` Ingo Molnar
2017-10-24 13:08           ` Arnaldo Carvalho de Melo
2017-10-24 13:25             ` Ingo Molnar
2017-10-25  2:35               ` Namhyung Kim
2017-10-25  9:02                 ` Jiri Olsa
2017-10-25  9:00           ` Jiri Olsa
2017-10-25  9:07             ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox