• Jiri Olsa's avatar
    perf tests: Add parse metric test for ipc metric · 0a507af9
    Jiri Olsa authored
    Adding new test that process metrics code and checks the expected
    results. Starting with easy ipc metric.
    
    Committer testing:
    
      # perf test "Parse and process metrics"
      67: Parse and process metrics                             : Ok
      #
      # perf test -v "Parse and process metrics"
      67: Parse and process metrics                             :
      --- start ---
      test child forked, pid 103402
      metric expr inst_retired.any / cpu_clk_unhalted.thread for IPC
      found event inst_retired.any
      found event cpu_clk_unhalted.thread
      adding {inst_retired.any,cpu_clk_unhalted.thread}:W
      test child finished with 0
      ---- end ----
      Parse and process metrics: Ok
      #
    
    Had to fix it to initialize that 'struct value' array sentinel with a
    named initializer to fix the build with some versions of clang:
    
      tests/parse-metric.c:135:7: error: missing field 'val' initializer [-Werror,-Wmissing-field-initializers]
                    { 0 },
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Acked-by: default avatarIan Rogers <irogers@google.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lore.kernel.org/lkml/20200602214741.1218986-13-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    0a507af9
parse-metric.c 3.15 KB