perf stat: Add metric-threshold to json output
When the threshold isn't unknown add a value to the json like:
"metric-threshold" : "good"
A more complete example:
```
$ perf stat -a -j -I 1000
{"interval" : 1.
001089747, "counter-value" : "16045.281449", "unit" : "msec", "event" : "cpu-clock", "event-runtime" :
16045355135, "pcnt-running" : 100.00, "metric-value" : "16.045281", "metric-unit" : "CPUs utilized"}
{"interval" : 1.
001089747, "counter-value" : "10003.000000", "unit" : "", "event" : "context-switches", "event-runtime" :
16045314844, "pcnt-running" : 100.00, "metric-value" : "623.423156", "metric-unit" : "/sec"}
{"interval" : 1.
001089747, "counter-value" : "328.000000", "unit" : "", "event" : "cpu-migrations", "event-runtime" :
16045321403, "pcnt-running" : 100.00, "metric-value" : "20.442147", "metric-unit" : "/sec"}
{"interval" : 1.
001089747, "counter-value" : "20114.000000", "unit" : "", "event" : "page-faults", "event-runtime" :
16045355927, "pcnt-running" : 100.00, "metric-value" : "1.253577", "metric-unit" : "K/sec"}
{"interval" : 1.
001089747, "counter-value" : "
4066679471.000000", "unit" : "", "event" : "instructions", "event-runtime" :
16045369123, "pcnt-running" : 100.00, "metric-value" : "1.628330", "metric-unit" : "insn per cycle"}
{"interval" : 1.
001089747, "counter-value" : "
2497454658.000000", "unit" : "", "event" : "cycles", "event-runtime" :
16045374810, "pcnt-running" : 100.00, "metric-value" : "0.155650", "metric-unit" : "GHz"}
{"interval" : 1.
001089747, "counter-value" : "
914974294.000000", "unit" : "", "event" : "branches", "event-runtime" :
16045379877, "pcnt-running" : 100.00, "metric-value" : "57.024509", "metric-unit" : "M/sec"}
{"interval" : 1.
001089747, "counter-value" : "
9237201.000000", "unit" : "", "event" : "branch-misses", "event-runtime" :
16045375017, "pcnt-running" : 100.00, "metric-value" : "1.009559", "metric-unit" : "of all branches", "metric-threshold" : "good"}
{"interval" : 1.
001089747, "event-runtime" :
16045397172, "pcnt-running" : 100.00, "metricgroup" : "TopdownL1"}
{"interval" : 1.
001089747, "metric-value" : "22.036686", "metric-unit" : "% tma_backend_bound", "metric-threshold" : "bad"}
{"interval" : 1.
001089747, "metric-value" : "7.610161", "metric-unit" : "% tma_bad_speculation", "metric-threshold" : "good"}
{"interval" : 1.
001089747, "metric-value" : "36.729687", "metric-unit" : "% tma_frontend_bound", "metric-threshold" : "bad"}
{"interval" : 1.
001089747, "metric-value" : "33.623465", "metric-unit" : "% tma_retiring"}
...
```
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Cc: Will Deacon <will@kernel.org>
Cc: James Clark <james.clark@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20241017175356.783793-7-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>