Skip to content

[BUG] Perf counters not multiplexed #1813

@jan-wassenberg

Description

@jan-wassenberg

Describe the bug

We do not seem to fully support multiplexing in benchmark perf_counters, which can result in undercounting by a factor of 2..3.

There is an attempt to have multiple 'leaders' and we do specify PERF_FORMAT_GROUP, but not PERF_FORMAT_TOTAL_TIME_ENABLED nor PERF_FORMAT_TOTAL_TIME_RUNNING. The latter two are required to extrapolate the counter values according to how long they are running.

System

  • OS: Linux
  • Compiler and version: clang near trunk

To reproduce
Request many (>6) counters.

Expected behavior
Values are scaled according to the relative time during which the counter was enabled/bound to HW.

Additional context

From the manual:

If PERF_FORMAT_GROUP was specified to allow reading all events
in a group at once:

          struct read_format {
              u64 nr;            /* The number of events */
              u64 time_enabled;  /* if PERF_FORMAT_TOTAL_TIME_ENABLED */
              u64 time_running;  /* if PERF_FORMAT_TOTAL_TIME_RUNNING */
              struct {
                  u64 value;     /* The value of the event */

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions