tud-zih-energy / lo2s

Linux OTF2 Sampling - A Lightweight Node-Level Performance Monitoring Tool
https://tu-dresden.de/zih/forschung/projekte/lo2s?set_language=en
GNU General Public License v3.0
47 stars 13 forks source link

feat (counter): Support for cpumask #271

Closed cvonelm closed 10 months ago

cvonelm commented 1 year ago

This PR adds support for the cpumask field of PMU events.

Some PMUs do not refer to a core component but to some piece of uncore, such as the amd_iommu_0 PMU found on modern AMD processors.

To be able to still measure them, perf associates every uncore PMU with a logical core. This relationship is recorded in the cpumask field.

This PR makes lo2s respect this cpumask field, only opening the PMU events on the cores recorded in cpumask.

Note that this works as both -E and --userspace-metric-event.

This PR is marked DRAFT for these reasons:

Currently it prints something like this:

List of Kernel PMU events:

  amd_iommu_0/cmd_processed/ # [ UNCORE ]
  amd_iommu_0/cmd_processed_inv/ # [ UNCORE ]
  amd_iommu_0/ign_rd_wr_mmio_1ff8h/ # [ UNCORE ]
  amd_iommu_0/int_dte_hit/ # [ UNCORE ]
  amd_iommu_0/int_dte_mis/ # [ UNCORE ]
  amd_iommu_0/mem_dte_hit/ # [ UNCORE ]
  amd_iommu_0/mem_dte_mis/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pde_hit/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pde_mis/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pte_hit/ # [ UNCORE ]
  amd_iommu_0/mem_iommu_tlb_pte_mis/ # [ UNCORE ]
  amd_iommu_0/mem_pass_excl/ # [ UNCORE ]
  amd_iommu_0/mem_pass_pretrans/ # [ UNCORE ]
  amd_iommu_0/mem_pass_untrans/ # [ UNCORE ]
  amd_iommu_0/mem_target_abort/ # [ UNCORE ]
  amd_iommu_0/mem_trans_total/ # [ UNCORE ]
  amd_iommu_0/page_tbl_read_gst/ # [ UNCORE ]
  amd_iommu_0/page_tbl_read_nst/ # [ UNCORE ]
  amd_iommu_0/page_tbl_read_tot/ # [ UNCORE ]
  amd_iommu_0/smi_blk/ # [ UNCORE ]
  amd_iommu_0/smi_recv/ # [ UNCORE ]
  amd_iommu_0/tlb_inv/ # [ UNCORE ]
  amd_iommu_0/vapic_int_guest/ # [ UNCORE ]
  amd_iommu_0/vapic_int_non_guest/ # [ UNCORE ]
  cpu/branch-instructions/
  cpu/branch-misses/
  cpu/cache-misses/
  cpu/cache-references/
  cpu/cpu-cycles/
  cpu/instructions/
  cpu/stalled-cycles-backend/
  cpu/stalled-cycles-frontend/
  msr/aperf/
  msr/irperf/
  msr/mperf/
  msr/tsc/
  power/energy-pkg/ # [ UNCORE ]

(* Only available in process-monitoring mode
(# Only available in system-monitoring mode

This PR does not address the second part of Issue #262, which is support for uncore events in process mode.

I think before we attempt to band-aid fix support for such a system-mode event in process mode we should have a discussion about a more general solution to combining system-mode and process mode measurements.

cvonelm commented 1 year ago

Also the question is if this should be recorded on a new "uncore" location, instead of "core X"

cvonelm commented 10 months ago

As this PR is completely based on an EventDescription Rework which turned out to be a cluttery mess, I am closing this PR in favour of an implementation on the current EventDescription or a properly reworked version.