[PATCH v5 0/5] Hwmon PMUs

Ian Rogers posted 5 patches 1 month, 1 week ago
There is a newer version of this series
tools/lib/api/io.h                     |   1 +
tools/perf/Documentation/perf-list.txt |  15 +
tools/perf/tests/Build                 |   1 +
tools/perf/tests/builtin-test.c        |   1 +
tools/perf/tests/hwmon_pmu.c           | 243 ++++++++
tools/perf/tests/tests.h               |   1 +
tools/perf/util/Build                  |   1 +
tools/perf/util/evsel.c                |   9 +
tools/perf/util/hwmon_pmu.c            | 820 +++++++++++++++++++++++++
tools/perf/util/hwmon_pmu.h            | 154 +++++
tools/perf/util/pmu.c                  |  20 +
tools/perf/util/pmu.h                  |   2 +
tools/perf/util/pmus.c                 |   9 +
tools/perf/util/pmus.h                 |   3 +
14 files changed, 1280 insertions(+)
create mode 100644 tools/perf/tests/hwmon_pmu.c
create mode 100644 tools/perf/util/hwmon_pmu.c
create mode 100644 tools/perf/util/hwmon_pmu.h
[PATCH v5 0/5] Hwmon PMUs
Posted by Ian Rogers 1 month, 1 week ago
Following the convention of the tool PMU, create a hwmon PMU that
exposes hwmon data for reading. For example, the following shows
reading the CPU temperature and 2 fan speeds alongside the uncore
frequency:
```
$ perf stat -e temp_cpu,fan1,hwmon_thinkpad/fan2/,tool/num_cpus_online/ -M UNCORE_FREQ -I 1000
     1.001153138              52.00 'C   temp_cpu
     1.001153138              2,588 rpm  fan1
     1.001153138              2,482 rpm  hwmon_thinkpad/fan2/
     1.001153138                  8      tool/num_cpus_online/
     1.001153138      1,077,101,397      UNC_CLOCK.SOCKET                 #     1.08 UNCORE_FREQ
     1.001153138      1,012,773,595      duration_time
...
```

Additional data on the hwmon events is in perf list:
```
$ perf list
...
hwmon:
...
  temp_core_0 OR temp2
       [Temperature in unit coretemp named Core 0. crit=100'C,max=100'C crit_alarm=0'C. Unit:
        hwmon_coretemp]
...
```

v5: Fix asan issue in parse_hwmon_filename caught by a TMA metric.
v4: Drop merged patches 1 to 10. Separate adding the hwmon_pmu from
    the update to perf_pmu to use it. Try to make source of literal
    strings clearer via named #defines. Fix a number of GCC warnings.
v3: Rebase, add Namhyung's acked-by to patches 1 to 10.
v2: Address Namhyung's review feedback. Rebase dropping 4 patches
    applied by Arnaldo, fix build breakage reported by Arnaldo.

Ian Rogers (5):
  tools api io: Ensure line_len_out is always initialized
  perf hwmon_pmu: Add a tool PMU exposing events from hwmon in sysfs
  perf pmu: Add calls enabling the hwmon_pmu
  perf test: Add hwmon "PMU" test
  perf docs: Document tool and hwmon events

 tools/lib/api/io.h                     |   1 +
 tools/perf/Documentation/perf-list.txt |  15 +
 tools/perf/tests/Build                 |   1 +
 tools/perf/tests/builtin-test.c        |   1 +
 tools/perf/tests/hwmon_pmu.c           | 243 ++++++++
 tools/perf/tests/tests.h               |   1 +
 tools/perf/util/Build                  |   1 +
 tools/perf/util/evsel.c                |   9 +
 tools/perf/util/hwmon_pmu.c            | 820 +++++++++++++++++++++++++
 tools/perf/util/hwmon_pmu.h            | 154 +++++
 tools/perf/util/pmu.c                  |  20 +
 tools/perf/util/pmu.h                  |   2 +
 tools/perf/util/pmus.c                 |   9 +
 tools/perf/util/pmus.h                 |   3 +
 14 files changed, 1280 insertions(+)
 create mode 100644 tools/perf/tests/hwmon_pmu.c
 create mode 100644 tools/perf/util/hwmon_pmu.c
 create mode 100644 tools/perf/util/hwmon_pmu.h

-- 
2.47.0.105.g07ac214952-goog