linux/tools
Jiri Olsa 14d3d54052 perf session: Try to read pipe data from file
Ian came with the idea of having support to read the pipe data also from
file. Currently pipe mode files fail like:

  $ perf record -o - sleep 1 > /tmp/perf.pipe.data
  $ perf report -i /tmp/perf.pipe.data
  incompatible file format (rerun with -v to learn more)

This patch adds the support to do that by trying the pipe header first,
and if its successfully detected, switching the perf data to pipe mode.

Committer testing:

  # ls
  # perf record -a -o - sleep 1 > /tmp/perf.pipe.data
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.000 MB - ]
  # ls
  # perf report -i /tmp/perf.pipe.data | head -25
  # To display the perf.data header info, please use --header/--header-only options.
  #
  #
  # Total Lost Samples: 0
  #
  # Samples: 511  of event 'cycles'
  # Event count (approx.): 178447276
  #
  # Overhead  Command   Shared Object      Symbol
  # ........  ........  .................  ...........................................................................................
  #
      65.49%  swapper   [kernel.kallsyms]  [k] native_safe_halt
       6.45%  chromium  libblink_core.so   [.] blink::SelectorChecker::CheckOne
       4.08%  chromium  libblink_core.so   [.] blink::SelectorQuery::ExecuteForTraverseRoot<blink::AllElementsSelectorQueryTrait>
       2.25%  chromium  libblink_core.so   [.] blink::SelectorQuery::FindTraverseRootsAndExecute<blink::AllElementsSelectorQueryTrait>
       2.11%  chromium  libblink_core.so   [.] blink::SelectorChecker::MatchSelector
       1.91%  chromium  libblink_core.so   [.] blink::Node::OwnerShadowHost
       1.31%  chromium  libblink_core.so   [.] blink::Node::parentNode@plt
       1.22%  chromium  libblink_core.so   [.] blink::Node::parentNode
       0.59%  chromium  libblink_core.so   [.] blink::AnyAttributeMatches
       0.58%  chromium  libv8.so           [.] v8::internal::GlobalHandles::Create
       0.58%  chromium  libblink_core.so   [.] blink::NodeTraversal::NextAncestorSibling
       0.55%  chromium  libv8.so           [.] v8::internal::RegExpGlobalCache::RegExpGlobalCache
       0.55%  chromium  libblink_core.so   [.] blink::Node::ContainingShadowRoot
       0.55%  chromium  libblink_core.so   [.] blink::NodeTraversal::NextAncestorSibling@plt
  #

Original-patch-by: Ian Rogers <irogers@google.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Khuong <pvk@pvk.ca>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200507095024.2789147-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-05-28 10:03:25 -03:00
..
accounting SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
arch tools arch x86: Sync asm/cpufeatures.h with the kernel sources 2020-04-14 09:08:23 -03:00
bootconfig tools/bootconfig: Fix apply_xbc() to return zero on success 2020-05-11 17:00:26 -04:00
bpf tools/runqslower: Ensure own vmlinux.h is picked up first 2020-04-24 17:45:20 -07:00
build perf: cs-etm: Update to build with latest opencsd version. 2020-05-05 16:35:32 -03:00
cgroup iocost: protect iocg->abs_vdebt with iocg->waitq.lock 2020-05-05 09:23:18 -06:00
debugging
edid tools/edid: Move EDID data sets from Documentation/ 2020-02-19 04:10:32 -07:00
firewire
firmware
gpio This is the bulk of GPIO development for the v5.7 kernel cycle. 2020-04-04 10:27:00 -07:00
hv Tools: hv: Reopen the devices if read() or write() returns errors 2020-01-26 22:10:10 -05:00
iio .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
include Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-04-24 19:17:30 -07:00
io_uring
kvm/kvm_stat tools/kvm_stat: add command line switch '-c' to log in csv format 2020-03-23 15:44:21 -04:00
laptop change email address for Pali Rohár 2020-04-10 15:36:22 -07:00
leds .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
lib Linux 5.7-rc7 2020-05-28 07:58:12 +02:00
memory-model .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
nfsd
objtool A set of fixes for x86: 2020-05-10 11:59:53 -07:00
pci tools: PCI: Add 'e' to clear IRQ 2020-04-02 17:57:10 +01:00
pcmcia .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
perf perf session: Try to read pipe data from file 2020-05-28 10:03:25 -03:00
power pm-graph v5.6 2020-04-20 10:37:02 +02:00
scripts Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-03-25 18:58:11 -07:00
spi SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
testing Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-05-23 17:16:18 -07:00
thermal/tmon - Convert tsens configuration DT binding to yaml (Rajeshwari) 2020-04-07 20:00:16 -07:00
time
usb .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
virtio tools/virtio: make asm/barrier.h self contained 2020-04-17 06:05:29 -04:00
vm tools/vm: fix cross-compile build 2020-04-21 11:11:56 -07:00
wmi
Makefile tools: bootconfig: Add bootconfig command 2020-01-13 13:19:39 -05:00