@@ -249,9 +249,22 @@ static void intel_pt_dump_sample(struct perf_session *session,
249
249
intel_pt_dump (pt , sample -> aux_sample .data , sample -> aux_sample .size );
250
250
}
251
251
252
- static bool intel_pt_log_events (struct intel_pt * pt )
252
+ static bool intel_pt_log_events (struct intel_pt * pt , u64 tm )
253
253
{
254
- return !(pt -> synth_opts .log_minus_flags & AUXTRACE_LOG_FLG_ALL_PERF_EVTS );
254
+ struct perf_time_interval * range = pt -> synth_opts .ptime_range ;
255
+ int n = pt -> synth_opts .range_num ;
256
+
257
+ if (pt -> synth_opts .log_plus_flags & AUXTRACE_LOG_FLG_ALL_PERF_EVTS )
258
+ return true;
259
+
260
+ if (pt -> synth_opts .log_minus_flags & AUXTRACE_LOG_FLG_ALL_PERF_EVTS )
261
+ return false;
262
+
263
+ /* perf_time__ranges_skip_sample does not work if time is zero */
264
+ if (!tm )
265
+ tm = 1 ;
266
+
267
+ return !n || !perf_time__ranges_skip_sample (range , n , tm );
255
268
}
256
269
257
270
static int intel_pt_do_fix_overlap (struct intel_pt * pt , struct auxtrace_buffer * a ,
@@ -2747,7 +2760,7 @@ static int intel_pt_process_event(struct perf_session *session,
2747
2760
if (!err && event -> header .type == PERF_RECORD_TEXT_POKE )
2748
2761
err = intel_pt_text_poke (pt , event );
2749
2762
2750
- if (intel_pt_enable_logging && intel_pt_log_events (pt )) {
2763
+ if (intel_pt_enable_logging && intel_pt_log_events (pt , sample -> time )) {
2751
2764
intel_pt_log ("event %u: cpu %d time %" PRIu64 " tsc %#" PRIx64 " " ,
2752
2765
event -> header .type , sample -> cpu , sample -> time , timestamp );
2753
2766
intel_pt_log_event (event );
0 commit comments