intel / xpumanager

MIT License
87 stars 18 forks source link

"xpumcli stats" JSON format is awkward #51

Open eero-t opened 1 year ago

eero-t commented 1 year ago

xpumcli stats JSON output puts all metric types to a same array. That makes it hard to retrieve specific metric in automated way, as one can gets basically a random metric type (here it happens to be power):

$ xpumcli stats --json --device 0 | jq .device_level[0]
{
  "avg": 40.12,
  "max": 41.15,
  "metrics_type": "XPUM_STATS_POWER",
  "min": 40.11,
  "value": 40.63
}

If each metric type would be under its own key, it would be trivial to get specific metric values:

$ xpumcli stats --json --device 0 | jq .device_level.XPUM_STATS_POWER[].avg
40.12

(If there were multiple power values, above jq clause would list them all.)