linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] new mmap_read interfaces for ring buffer
@ 2017-10-10 17:20 kan.liang
  2017-10-10 17:20 ` [PATCH 01/10] perf record: new interfaces to read ring buffer to file kan.liang
                   ` (9 more replies)
  0 siblings, 10 replies; 41+ messages in thread
From: kan.liang @ 2017-10-10 17:20 UTC (permalink / raw)
  To: acme, peterz, mingo, linux-kernel
  Cc: jolsa, wangnan0, hekuang, namhyung, alexander.shishkin,
	adrian.hunter, ak, Kan Liang

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

The mmap_read interfaces for ring buffer has some issues
 - Not well organized. For example, perf record maintains some codes in
   builtin-record.c. Other perf tools use perf_mmap__read* functions to
   access ring buffer. Some of the codes should be shared.
 - Only support forward mode. Although there is
   perf_mmap__read_backward, no one use it. It's not well maintained.
   But perf top need to switch to overwrite backward mode for good
   performance.
 - There is bug found on overwrite backward mode.

The patch series will move all the mmap_read related code to evlist.c,
and provide new standard interfaces to access ring buffer.
The new interfaces include,
perf_evlist__mmap_read_init     //wrapper of perf_mmap__read_init
perf_mmap__read_init            //Initialization and calculate the range
perf_mmap__read_to_file		//read the ring buffer and write to file 
perf_mmap__read_event		//read the event in specified range
perf_mmap__read_done		//Update the md->prev for later use

For perf record, it needs to read all available data in ring buffer and
write them to perf.data file.
It can be done as below,
  perf_mmap__read_init
  perf_mmap__read_to_file
  perf_mmap__consume

For other perf tools, it needs to read and process events one by one.
It can be done as below,
  perf_mmap__read_init
  while (event = perf_mmap__read_event) {
    //process the event
    perf_mmap__consume
  }
  perf_mmap__read_done


All the stale interfaces will be removed, which include
perf_evlist__mmap_read
perf_evlist__mmap_read_forward
perf_evlist__mmap_read_backward
perf_evlist__mmap_read_catchup
perf_mmap__read_catchup
perf_mmap__read_forward
perf_mmap__read_backward

The patch series only changes the interfaces. It doesn't change the
core perf_mmap__read function. There is no functional change.

Kan Liang (10):
  perf record: new interfaces to read ring buffer to file
  perf tool: fix: Don't discard prev in backward mode
  perf tool: new functions to read event from ring buffer
  perf tool: perf_mmap__read_init wraper for evlist
  perf top: apply new mmap_read interfaces
  perf trace: apply new mmap_read interfaces
  perf kvm: apply new mmap_read interfaces
  perf python: apply new mmap_read interfaces
  perf tests: apply new mmap_read interfaces
  perf tool: remove stale mmap_read interfaces

 tools/perf/arch/x86/tests/perf-time-to-tsc.c |   9 +-
 tools/perf/builtin-kvm.c                     |  10 +-
 tools/perf/builtin-record.c                  | 111 +++---------
 tools/perf/builtin-top.c                     |   9 +-
 tools/perf/builtin-trace.c                   |   9 +-
 tools/perf/tests/backward-ring-buffer.c      |  10 +-
 tools/perf/tests/bpf.c                       |  10 +-
 tools/perf/tests/code-reading.c              |   8 +-
 tools/perf/tests/keep-tracking.c             |   8 +-
 tools/perf/tests/mmap-basic.c                |   9 +-
 tools/perf/tests/openat-syscall-tp-fields.c  |   9 +-
 tools/perf/tests/perf-record.c               |   9 +-
 tools/perf/tests/sw-clock.c                  |   8 +-
 tools/perf/tests/switch-tracking.c           |   8 +-
 tools/perf/tests/task-exit.c                 |   8 +-
 tools/perf/util/evlist.c                     | 244 +++++++++++++++++----------
 tools/perf/util/evlist.h                     |  31 ++--
 tools/perf/util/python.c                     |   9 +-
 18 files changed, 314 insertions(+), 205 deletions(-)

-- 
2.5.5

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

end of thread, other threads:[~2017-10-13 13:14 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-10 17:20 [PATCH 00/10] new mmap_read interfaces for ring buffer kan.liang
2017-10-10 17:20 ` [PATCH 01/10] perf record: new interfaces to read ring buffer to file kan.liang
2017-10-10 18:24   ` Arnaldo Carvalho de Melo
2017-10-10 18:30   ` Arnaldo Carvalho de Melo
2017-10-11  4:12     ` Liang, Kan
2017-10-11 14:45       ` Arnaldo Carvalho de Melo
2017-10-11 15:16         ` Liang, Kan
2017-10-10 17:20 ` [PATCH 02/10] perf tool: fix: Don't discard prev in backward mode kan.liang
2017-10-10 18:14   ` Arnaldo Carvalho de Melo
2017-10-10 18:18     ` Liang, Kan
2017-10-13 12:55     ` Liang, Kan
2017-10-13 13:13       ` Arnaldo Carvalho de Melo
2017-10-13 13:14         ` Liang, Kan
2017-10-10 18:23   ` Wangnan (F)
2017-10-10 18:50     ` Wangnan (F)
2017-10-10 19:50       ` Liang, Kan
2017-10-10 20:18         ` Wangnan (F)
2017-10-11  2:12           ` Liang, Kan
2017-10-11 14:57             ` Liang, Kan
2017-10-12  1:11               ` Wangnan (F)
2017-10-12 12:49                 ` Liang, Kan
2017-10-12 14:43                   ` Wangnan (F)
2017-10-10 19:36     ` Liang, Kan
2017-10-10 17:20 ` [PATCH 03/10] perf tool: new iterfaces to read event from ring buffer kan.liang
2017-10-10 18:15   ` Arnaldo Carvalho de Melo
2017-10-10 18:28     ` Liang, Kan
2017-10-10 18:34       ` Arnaldo Carvalho de Melo
2017-10-10 18:36         ` Arnaldo Carvalho de Melo
2017-10-10 19:00           ` Arnaldo Carvalho de Melo
2017-10-10 19:10             ` Wangnan (F)
2017-10-10 19:17               ` Arnaldo Carvalho de Melo
2017-10-10 19:22                 ` Wangnan (F)
2017-10-10 19:55                   ` Liang, Kan
2017-10-10 19:59                     ` Wangnan (F)
2017-10-10 17:20 ` [PATCH 04/10] perf tool: perf_mmap__read_init wrapper for evlist kan.liang
2017-10-10 17:20 ` [PATCH 05/10] perf top: apply new mmap_read interfaces kan.liang
2017-10-10 17:20 ` [PATCH 06/10] perf trace: " kan.liang
2017-10-10 17:20 ` [PATCH 07/10] perf kvm: " kan.liang
2017-10-10 17:20 ` [PATCH 08/10] perf python: " kan.liang
2017-10-10 17:20 ` [PATCH 09/10] perf tests: " kan.liang
2017-10-10 17:20 ` [PATCH 10/10] perf tool: remove stale " kan.liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).