diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2019-06-04 16:00:17 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-06-10 16:20:13 -0300 |
commit | a77a05e2337df1347f4de96bfa313db7008fe8bd (patch) | |
tree | fe2b2112319ea8ed48a12c215d83687d74118084 /tools/perf/tests/time-utils-test.c | |
parent | e39a12cbd2496edb4cab0f99efb0d217c55ba273 (diff) |
perf time-utils: Add support for multiple explicit time intervals
Currently only a single explicit time range is accepted. Add support for
multiple ranges separated by spaces, which requires the string to be
quoted. Update the time utils test accordingly.
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-20-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/time-utils-test.c')
-rw-r--r-- | tools/perf/tests/time-utils-test.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/tests/time-utils-test.c b/tools/perf/tests/time-utils-test.c index 7504046b111c..4f53006233a1 100644 --- a/tools/perf/tests/time-utils-test.c +++ b/tools/perf/tests/time-utils-test.c @@ -169,6 +169,23 @@ int test__time_utils(struct test *t __maybe_unused, int subtest __maybe_unused) } { + u64 b = 1234567123456789ULL; + u64 c = 7654321987654321ULL; + u64 e = 8000000000000000ULL; + struct test_data d = { + .str = "1234567.123456789,1234567.123456790 " + "7654321.987654321,7654321.987654444 " + "8000000,8000000.000000005", + .ptime = { {b, b + 1}, {c, c + 123}, {e, e + 5}, }, + .num = 3, + .skip = { b - 1, b + 2, c - 1, c + 124, e - 1, e + 6 }, + .noskip = { b, b + 1, c, c + 123, e, e + 5 }, + }; + + pass &= test__perf_time__parse_for_ranges(&d); + } + + { u64 b = 7654321ULL * NSEC_PER_SEC; struct test_data d = { .str = "10%/1", |