Skip to content

Perf: Differ groups by the id. #2866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Creatone
Copy link
Collaborator

Part of #2865

Signed-off-by: Paweł Szulik [email protected]

@google-cla google-cla bot added the cla: yes label May 10, 2021
@Creatone
Copy link
Collaborator Author

/ok-to-test

Signed-off-by: Paweł Szulik <[email protected]>
@eero-t
Copy link
Contributor

eero-t commented Jul 14, 2021

Perf seems to support both metric/event group IDs, and cgroup IDs [1]. Which kind of perf group(s) this PR is about?

[1] perf-list:

EVENT GROUPS

       Perf supports time based multiplexing of events, when the number
       of events active exceeds the number of hardware performance
       counters. Multiplexing can cause measurement errors when the
       workload changes its execution profile.

       When metrics are computed using formulas from event counts, it is
       useful to ensure some events are always measured together as a
       group to minimize multiplexing errors. Event groups can be
       specified using { }.

perf-record:

       -e, --event=
           Select the PMU event. Selection can be:
...
           •   a group of events surrounded by a pair of brace
               ("{event1,event2,...}"). Each event is separated by
               commas and the group should be quoted to prevent the
               shell interpretation. You also need to use --group on
               "perf report" to view group events together.
...
       --group
           Put all events in a single event group. This precedes the
           --event option and remains only for backward compatibility.
...
       -G name,..., --cgroup name,...
           monitor only in the container (cgroup) called "name". This
           option is available only in per-cpu mode. The cgroup
           filesystem must be mounted. All threads belonging to
           container "name" are monitored when they run on the monitored
           CPUs. Multiple cgroups can be provided.
...
       If wanting to monitor, say, cycles for a cgroup and also for
       system wide, this command line can be used: perf stat -e cycles
       -G cgroup_name -a -e cycles.

       --namespaces
           Record events of type PERF_RECORD_NAMESPACES. This enables
           cgroup_id sort key.

       --all-cgroups
           Record events of type PERF_RECORD_CGROUP. This enables cgroup
           sort key.

perf-report:

       -s, --sort=
           Sort histogram entries by given key(s) - multiple keys can be
           specified in CSV format. Following sort keys are available:
           pid, comm, dso, symbol, parent, cpu, socket, srcline, weight,
           local_weight, cgroup_id.
...
           •   cgroup_id: ID derived from cgroup namespace device and
               inode numbers.

           •   cgroup: cgroup pathname in the cgroupfs.
...
       --group
           Show event group information together. It forces group output
           also if there are no groups defined in data file.

       --group-sort-idx
           Sort the output by the event at the index n in group. If n is
           invalid, sort by the first event. It can support multiple
           groups with different amount of events. WARNING: This should
           be used on grouped events.

@Creatone
Copy link
Collaborator Author

@eero-t You're completely right.
cAdvisor perf collector counts events for every cgroup_id (container). It's possible to match events in groups to be gathered at the same time.
The group_id label is needed to differ the same events gathered at different times in different groups.

@eero-t
Copy link
Contributor

eero-t commented Jul 15, 2021

cAdvisor perf collector counts events for every cgroup_id (container). It's possible to match events in groups to be gathered at the same time.
The group_id label is needed to differ the same events gathered at different times in different groups.

If it's about per-cgroup perf data (instead of per-event-group perf data), IMHO group_id should be be renamed to cgroup_id, to match perf documentation, and to clarify this confusion. GroupID could then be renamed e.g. to CgroupID.

@Creatone
Copy link
Collaborator Author

The group_id is not equal to cgroup_id. cAdvisor uses both parameters. Firstly differ events through the containers (cgroup_id [or "id" label in Prometheus format]), secondly through groups (group_id).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants