Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754362AbdIZGt4 (ORCPT ); Tue, 26 Sep 2017 02:49:56 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36865 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752393AbdIZGty (ORCPT ); Tue, 26 Sep 2017 02:49:54 -0400 X-Google-Smtp-Source: AOwi7QDqcd10XYMIH4IVQj7fkqHCoY/tz7kCRFjyiwghG/gcuMSqyI1SGxBcyjIpgIhUn2PFsaKkZQ== From: yuzhoujian X-Google-Original-From: yuzhoujian To: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, dsahern@gmail.com, namhyung@kernel.org, milian.wolff@kdab.com, arnaldo.melo@gmail.com, yuzhoujian@didichuxing.com Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/4] perf script: Add script per-event-dump support Date: Tue, 26 Sep 2017 14:48:58 +0800 Message-Id: <1506408542-23564-1-git-send-email-yuzhoujian@didichuxing.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1760 Lines: 38 Introduce a new option to print trace output to files named by the monitored events and update perf-script documentation accordingly. Shown below is output of perf script command with the newly introduced option. $perf record -e cycles -e cs -ag -- sleep 10 $perf script --per-event-dump $ls perf.data-script-dump-cycles.txt perf.data-script-dump-cs.txt Without per-event-dump support, drawing flamegraphs for different events would be a very troublesome thing. You can monitor only one event at a time if you want to get flamegraphs for different events. Using this option, you can get the trace output files named by the monitored events, and could draw flamegraphs according to the event's name. yuzhoujian (4): Patch 1: Add a new element for the struct perf_tool, and add the --per-event-dump option for perf script. Patch 2: Add fp argument to print functions. Patch 3: Replace printf with fprintf for all print functions. Patch 4: Make all print functions receive the fp argument, and opens a dump file in process_event. changes since v1: - Patch 1: Remove the set of script.tool.per_event_dump variable. - Patch 2: Add the __maybe_unused attribute for the fp argument in the second patch. - Patch 3: remove the fp_selection_helper function for setting the fp argument. - Patch 2: split the original second patch(Makes all those related functions receive the FILE pointer) to two patches. - Patch 4: modify the file name of per-event-dump to -script-dump-.txt tools/perf/builtin-script.c | 452 ++++++++++++++++++++++++-------------------- tools/perf/util/tool.h | 1 + 2 files changed, 250 insertions(+), 203 deletions(-) -- 1.8.3.1