freebsd-dev/sys/dev/hwpmc
Matt Macy b2ca2e50b9 hwpmc: add summary command and further metadata extensions
metadata changes:
- log pmc sample rate with pmcallocate
- log proc flags with thread / process logging
  to identify user vs kernel threads

fixes:
- use log cpuid to translate event id to event name

Implement rudimentary summary command to track sample
counts by thread and process name within a pmc log.

% make -j4 buildkernel >& /dev/null &
% sudo pmcstat -S unhalted_core_cycles -S llc-misses -O foo sleep 15
% pmc summary foo
cpu_clk_unhalted.thread_p_any:
        idle: 138108207162
        clang-6.0: 105336158004
        sh: 72340108510
        make: 8642012963
        kernel: 7754011631
longest_lat_cache.miss:
        clang-6.0: 87502625
        sh: 40901227
        make: 5500165
        kernel: 3300099
        awk: 2000060

%  pmc summary -f ~/foo
idx: 278 name: cpu_clk_unhalted.thread_p_any rate: 2000003
idle: 69054
clang-6.0: 52668
sh: 36170
make: 4321
kernel: 3877
hwpmc: proc(7445): 3319
awk: 1289
xargs: 357
rand_harvestq: 181
mtree: 102
intr: 53
zfskern: 31
usb: 7
pagedaemon: 4
ntpd: 3
syslogd: 1
acpi_thermal: 1
logger: 1
syncer: 1
snmptrapd: 1
sleep: 1
idx: 17 name: longest_lat_cache.miss rate: 100003
clang-6.0: 875
sh: 409
make: 55
kernel: 33
awk: 20
hwpmc: proc(7445): 14
xargs: 9
idle: 8
intr: 3
zfskern: 2
2018-06-06 02:48:09 +00:00
..
hwpmc_amd.c hwpmc(9): Make pmclog buffer pcpu and update constants 2018-05-12 01:26:34 +00:00
hwpmc_amd.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_arm64_md.c
hwpmc_arm64.c
hwpmc_arm64.h
hwpmc_arm.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_armv7.c Fix HWPMC interrupt handling in Counting Mode 2017-06-13 18:51:23 +00:00
hwpmc_armv7.h
hwpmc_core.c hwpmc: fix fixed counters checks 2018-06-04 04:49:06 +00:00
hwpmc_core.h hwpmc: ABI fixes 2018-06-04 02:05:48 +00:00
hwpmc_e500.c hwpmc(9): Make pmclog buffer pcpu and update constants 2018-05-12 01:26:34 +00:00
hwpmc_intel.c hwpmc: remove unused pre-table driven bits for intel 2018-05-31 22:41:07 +00:00
hwpmc_logging.c hwpmc: add summary command and further metadata extensions 2018-06-06 02:48:09 +00:00
hwpmc_mips24k.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_mips74k.c sys: use our nitems() macro when param.h is available. 2016-04-21 19:40:10 +00:00
hwpmc_mips.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_mod.c hwpmc: add summary command and further metadata extensions 2018-06-06 02:48:09 +00:00
hwpmc_mpc7xxx.c hwpmc(9): Make pmclog buffer pcpu and update constants 2018-05-12 01:26:34 +00:00
hwpmc_octeon.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_powerpc.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_powerpc.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_ppc970.c hwpmc(9): Make pmclog buffer pcpu and update constants 2018-05-12 01:26:34 +00:00
hwpmc_riscv.h Welcome the RISC-V 64-bit kernel. 2016-01-29 15:12:31 +00:00
hwpmc_soft.c hwpmc(9): Make pmclog buffer pcpu and update constants 2018-05-12 01:26:34 +00:00
hwpmc_soft.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_sparc64.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_tsc.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_tsc.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_uncore.c hwpmc: remove unused pre-table driven bits for intel 2018-05-31 22:41:07 +00:00
hwpmc_uncore.h hwpmc: remove unused pre-table driven bits for intel 2018-05-31 22:41:07 +00:00
hwpmc_x86.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_xscale.c sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
hwpmc_xscale.h sys/dev: further adoption of SPDX licensing ID tags. 2017-11-27 14:52:40 +00:00
pmc_events.h hwpmc: remove unused pre-table driven bits for intel 2018-05-31 22:41:07 +00:00