Skip to content

Commit 8b83fcc

Browse files
ahunter6acmel
authored andcommitted
perf intel-pt: Use itrace debug log flags to suppress some messages
The "d" option may be followed 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 Suppressing perf events is useful for decreasing the size of the log. Signed-off-by: Adrian Hunter <[email protected]> Reviewed-by: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 935aac2 commit 8b83fcc

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

tools/perf/Documentation/perf-intel-pt.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,10 @@ For example, for errors but not overflow or data lost errors:
882882

883883
The "d" option will cause the creation of a file "intel_pt.log" containing all
884884
decoded packets and instructions. Note that this option slows down the decoder
885-
and that the resulting file may be very large.
885+
and that the resulting file may be very large. The "d" option may be followed
886+
by flags which affect what debug messages will or will not be logged. Each flag
887+
must be preceded by either '+' or '-'. The flags support by Intel PT are:
888+
-a Suppress logging of perf events
886889

887890
In addition, the period of the "instructions" event can be specified. e.g.
888891

tools/perf/util/intel-pt.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ static void intel_pt_dump_sample(struct perf_session *session,
249249
intel_pt_dump(pt, sample->aux_sample.data, sample->aux_sample.size);
250250
}
251251

252+
static bool intel_pt_log_events(struct intel_pt *pt)
253+
{
254+
return !(pt->synth_opts.log_minus_flags & AUXTRACE_LOG_FLG_ALL_PERF_EVTS);
255+
}
256+
252257
static int intel_pt_do_fix_overlap(struct intel_pt *pt, struct auxtrace_buffer *a,
253258
struct auxtrace_buffer *b)
254259
{
@@ -2586,10 +2591,6 @@ static int intel_pt_context_switch(struct intel_pt *pt, union perf_event *event,
25862591
return -EINVAL;
25872592
}
25882593

2589-
intel_pt_log("context_switch: cpu %d pid %d tid %d time %"PRIu64" tsc %#"PRIx64"\n",
2590-
cpu, pid, tid, sample->time, perf_time_to_tsc(sample->time,
2591-
&pt->tc));
2592-
25932594
ret = intel_pt_sync_switch(pt, cpu, tid, sample->time);
25942595
if (ret <= 0)
25952596
return ret;
@@ -2746,9 +2747,11 @@ static int intel_pt_process_event(struct perf_session *session,
27462747
if (!err && event->header.type == PERF_RECORD_TEXT_POKE)
27472748
err = intel_pt_text_poke(pt, event);
27482749

2749-
intel_pt_log("event %u: cpu %d time %"PRIu64" tsc %#"PRIx64" ",
2750-
event->header.type, sample->cpu, sample->time, timestamp);
2751-
intel_pt_log_event(event);
2750+
if (intel_pt_enable_logging && intel_pt_log_events(pt)) {
2751+
intel_pt_log("event %u: cpu %d time %"PRIu64" tsc %#"PRIx64" ",
2752+
event->header.type, sample->cpu, sample->time, timestamp);
2753+
intel_pt_log_event(event);
2754+
}
27522755

27532756
return err;
27542757
}

0 commit comments

Comments
 (0)