Skip to content

Commit

Permalink
perf time-utils: Treat time ranges consistently
Browse files Browse the repository at this point in the history
Currently, options allow only 1 explicit (non-percentage) time range.
In preparation for adding support for multiple explicit time ranges,
treat time ranges consistently.

Instead of treating some time ranges as inclusive and some as excluding
the end time, treat all time ranges as inclusive. This is only a 1
nanosecond change but is necessary to treat multiple explicit time
ranges in a consistent manner.

Note, there is a later patch that adds a test for time-utils.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190604130017.31207-13-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Jun 10, 2019
1 parent 2c47db9 commit f79a768
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tools/perf/util/time-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,12 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
ptime = &ptime_buf[i];

if (timestamp >= ptime->start &&
((timestamp < ptime->end && i < num - 1) ||
(timestamp <= ptime->end && i == num - 1))) {
break;
(timestamp <= ptime->end || !ptime->end)) {
return false;
}
}

return (i == num) ? true : false;
return true;
}

int perf_time__parse_for_ranges(const char *time_str,
Expand Down

0 comments on commit f79a768

Please sign in to comment.