From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Andi Kleen <ak@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH V2 6/6] perf intel-pt: Support itrace d+o option to direct debug log to stdout
Date: Tue, 26 Oct 2021 12:01:52 +0300 [thread overview]
Message-ID: <20211026090152.357591-7-adrian.hunter@intel.com> (raw)
In-Reply-To: <20211026090152.357591-1-adrian.hunter@intel.com>
It can be useful to see debug output in between normal output.
Add support for AUXTRACE_LOG_FLG_USE_STDOUT to Intel PT.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/Documentation/perf-intel-pt.txt | 1 +
tools/perf/util/intel-pt-decoder/intel-pt-log.c | 8 ++++----
tools/perf/util/intel-pt.c | 5 +++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/perf/Documentation/perf-intel-pt.txt b/tools/perf/Documentation/perf-intel-pt.txt
index 81dd27be3d09..b94dca105ebd 100644
--- a/tools/perf/Documentation/perf-intel-pt.txt
+++ b/tools/perf/Documentation/perf-intel-pt.txt
@@ -948,6 +948,7 @@ by flags which affect what debug messages will or will not be logged. Each flag
must be preceded by either '+' or '-'. The flags support by Intel PT are:
-a Suppress logging of perf events
+a Log all perf events
+ +o Output to stdout instead of "intel_pt.log"
By default, logged perf events are filtered by any specified time ranges, but
flag +a overrides that.
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-log.c b/tools/perf/util/intel-pt-decoder/intel-pt-log.c
index 09feb5b07d32..5f5dfc8753f3 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-log.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-log.c
@@ -82,10 +82,10 @@ static int intel_pt_log_open(void)
if (f)
return 0;
- if (!log_name[0])
- return -1;
-
- f = fopen(log_name, "w+");
+ if (log_name[0])
+ f = fopen(log_name, "w+");
+ else
+ f = stdout;
if (!f) {
intel_pt_enable_logging = false;
return -1;
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 57e49b23ad25..793bac850268 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -3659,8 +3659,6 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
if (err)
goto err_free;
- intel_pt_log_set_name(INTEL_PT_PMU_NAME);
-
if (session->itrace_synth_opts->set) {
pt->synth_opts = *session->itrace_synth_opts;
} else {
@@ -3675,6 +3673,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
pt->synth_opts.thread_stack = opts->thread_stack;
}
+ if (!(pt->synth_opts.log_plus_flags & AUXTRACE_LOG_FLG_USE_STDOUT))
+ intel_pt_log_set_name(INTEL_PT_PMU_NAME);
+
pt->session = session;
pt->machine = &session->machines.host; /* No kvm support */
pt->auxtrace_type = auxtrace_info->type;
--
2.25.1
next prev parent reply other threads:[~2021-10-26 9:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 9:01 [PATCH V2 0/6] perf dlfilter: Add dlfilter-show-cycles Adrian Hunter
2021-10-26 9:01 ` [PATCH V2 1/6] perf auxtrace: Add missing Z option to ITRACE_HELP Adrian Hunter
2021-10-26 9:01 ` [PATCH V2 2/6] perf auxtrace: Add itrace A option to approximate IPC Adrian Hunter
2021-10-26 9:01 ` [PATCH V2 3/6] perf intel-pt: Support " Adrian Hunter
2021-10-26 17:03 ` Andi Kleen
2021-10-26 9:01 ` [PATCH V2 4/6] perf dlfilter: Add dlfilter-show-cycles Adrian Hunter
2021-10-26 9:01 ` [PATCH V2 5/6] perf auxtrace: Add itrace d+o option to direct debug log to stdout Adrian Hunter
2021-10-26 9:01 ` Adrian Hunter [this message]
[not found] ` <dd9f91af-8b74-bf75-b3a4-c3826be7b190@linux.intel.com>
2021-10-27 18:59 ` [PATCH V2 6/6] perf intel-pt: Support " Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211026090152.357591-7-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.