• Adrian Hunter's avatar
    perf tests: Add a test for time-utils · e39a12cb
    Adrian Hunter authored
    Test time ranges work as expected.
    
    Committer testing:
    
      $ perf test "time utils"
      59: time utils                                            : Ok
      $ perf test -v "time utils"
      59: time utils                                            :
      --- start ---
      test child forked, pid 31711
    
      parse_nsec_time("0")
      0
    
      parse_nsec_time("1")
      1000000000
    
      parse_nsec_time("0.000000001")
      1
    
      parse_nsec_time("1.000000001")
      1000000001
    
      parse_nsec_time("123456.123456")
      123456123456000
    
      parse_nsec_time("1234567.123456789")
      1234567123456789
    
      parse_nsec_time("18446744073.709551615")
      18446744073709551615
    
      perf_time__parse_str("1234567.123456789,1234567.123456789")
      start time 1234567123456789, end time 1234567123456789
    
      perf_time__parse_str("1234567.123456789,1234567.123456790")
      start time 1234567123456789, end time 1234567123456790
    
      perf_time__parse_str("1234567.123456789,")
      start time 1234567123456789, end time 0
    
      perf_time__parse_str(",1234567.123456789")
      start time 0, end time 1234567123456789
    
      perf_time__parse_str("0,1234567.123456789")
      start time 0, end time 1234567123456789
    
      perf_time__parse_for_ranges("1234567.123456789,1234567.123456790")
      start time 1234567123456789, end time 1234567123456790
    
      perf_time__parse_for_ranges("10%/1")
      first_sample_time 7654321000000000 last_sample_time 7654321000000100
      start time 0: 7654321000000000, end time 0: 7654321000000009
    
      perf_time__parse_for_ranges("10%/2")
      first_sample_time 7654321000000000 last_sample_time 7654321000000100
      start time 0: 7654321000000010, end time 0: 7654321000000019
    
      perf_time__parse_for_ranges("10%/1,10%/2")
      first_sample_time 11223344000000000 last_sample_time 11223344000000100
      start time 0: 11223344000000000, end time 0: 11223344000000009
      start time 1: 11223344000000010, end time 1: 11223344000000019
    
      perf_time__parse_for_ranges("10%/1,10%/3,10%/10")
      first_sample_time 11223344000000000 last_sample_time 11223344000000100
      start time 0: 11223344000000000, end time 0: 11223344000000009
      start time 1: 11223344000000020, end time 1: 11223344000000029
      start time 2: 11223344000000090, end time 2: 11223344000000100
    
      test child finished with 0
      ---- end ----
      time utils: Ok
      $
    Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jin Yao <yao.jin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Link: http://lkml.kernel.org/r/20190604130017.31207-19-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    e39a12cb
Build 2.81 KB