perf jevents: Drop or simplify small integer values
authorIan Rogers <irogers@google.com>
Wed, 31 Jan 2024 20:14:29 +0000 (12:14 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 2 Feb 2024 21:09:30 +0000 (13:09 -0800)
commitb8db070f389c902f48e83ee7a94952e9557199e8
treee5a49a2d79525b48fe425c9c60cf4f480f792f4e
parentfd7b8e8fb20f51d60dfee7792806548f3c6a4c2c
perf jevents: Drop or simplify small integer values

Prior to this patch '0' would be dropped as the config values default
to 0. Some json values are hex and the string '0' wouldn't match '0x0'
as zero. Add a more robust is_zero test to drop these event terms.

When encoding numbers as hex, if the number is between 0 and 9
inclusive then don't add a 0x prefix.

Update test expectations for these changes.

On x86 this reduces the event/metric C string by 58,411 bytes.

Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Cc: Edward Baker <edward.baker@intel.com>
Cc: Perry Taylor <perry.taylor@intel.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Veronika Molnarova <vmolnaro@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240131201429.792138-1-irogers@google.com
tools/perf/pmu-events/jevents.py
tools/perf/tests/pmu-events.c