aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pmc/cmd_pmc_stat.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in main: (cherry picked from commit 1d386b48a555)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-251-1/+1
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* libpmc: eliminate pmc_pmu_stat_mode()Mitchell Horne2021-07-291-4/+11
| | | | | | | | | | | | | There is a single consumer, the pmc utility, that clearly has knowledge of which counters it is expecting. Remove this function and have it use common counter aliases instead. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30528 (cherry picked from commit ec66cc955b629e614cf493bf168048de033f6a2c)
* pmc: mark some dead functions as suchEitan Adler2018-06-091-3/+5
| | | | | | | | | Also change a single instance of the comma operator to a semi-colon. Reviewed by: mmacy Notes: svn path=/head/; revision=334874
* hwpmc: add summary command and further metadata extensionsMatt Macy2018-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=334701
* pmc stat: add debug option for intermediate stateMatt Macy2018-06-041-24/+36
| | | | Notes: svn path=/head/; revision=334644
* pmc stat: fix offset of specified counterMatt Macy2018-06-041-1/+2
| | | | Notes: svn path=/head/; revision=334641
* pmc stat: fix format strings for 32-bitMatt Macy2018-05-301-10/+9
| | | | Notes: svn path=/head/; revision=334404
* pmc: silence scan-build warningsMatt Macy2018-05-291-10/+7
| | | | Notes: svn path=/head/; revision=334353
* pmc: Add new sub-command structured "pmc" utilityMatt Macy2018-05-291-0/+478
This will manage pmc functionality with a more manageable structure of subcommands rather than the gradually accreted spaghetti logic of overlapping flags that exists in pmcstat. This is intended to ultimately have all the same functionality as pmcannotate+pmccontrol+pmcstat. Currently it just has "stat" and "system-stat" - counters for the process itself and counters for the system as a whole respectively (i.e. system-stat includes kernel threads). Note that the rusage results (page faults/context switches/ user/sys) for stat-system will not account for the system as a whole - only for the child process specified on the command line. Implementing stat was suggested by mjg@ and the output is based on that from Linux's "perf stat". % pmc stat -- make -j32 buildkernel -DNO_MODULES -ss > /dev/null 9598393 page faults # 0.674 M/sec 387085 voluntary csw # 0.027 M/sec 106989 involuntary csw # 0.008 M/sec 2763965982317 cycles 2542953049760 instructions # 0.920 inst/cycle 511562750157 branches 12917006881 branch-misses # 2.525% 17944429878 cache-references # 0.007 refs/inst 2205119560 cache-misses # 12.289% 43.74 real # 2019.72% cpu 795.09 user # 1817.72% cpu 88.35 sys # 202.00% cpu % make -j32 buildkernel -DNO_MODULES -ss > /dev/null & % sudo pmc stat-system cat ^C 103 page faults # 0.811 M/sec 4 voluntary csw # 0.031 M/sec 0 involuntary csw # 0.000 M/sec 2843639070514 cycles 2606171217438 instructions # 0.916 inst/cycle 522450422783 branches 13092862839 branch-misses # 2.506% 18592101113 cache-references # 0.007 refs/inst 2562878667 cache-misses # 13.785% 44.85 real # 0.00% cpu 0.00 user # 0.00% cpu 0.00 sys # 0.00% cpu Notes: svn path=/head/; revision=334350