aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pmcstat
Commit message (Collapse)AuthorAgeFilesLines
* pmcstat: Remove no-op -k optionEd Maste2025-10-281-6/+1
| | | | | | | | | | | Commit 53d0b9e438bc ("pmc: Provide full path to modules from kernel linker") made pmcstat's -k option have no effect, but the option was retained for backwards compatibility (while emitting a warning that -k is not in FreeBSD 15). Reviewed by: jrtc27 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53397
* pmcstat(8): Fix a typo in an error messageGordon Bergling2025-10-261-1/+1
| | | | | | - s/evalation/evaluation/ MFC after: 1 week
* pmcstat(8): Fix a typo in a source code commentGordon Bergling2025-10-221-1/+1
| | | | | | - s/th/the/ MFC after: 3 days
* libpmc: Move libpmc and utils to a new pmc packageLexi Winter2025-09-231-3/+1
| | | | | | | | | Due to the size of libpmc.so.5, this reduces the size of the -utilities package by 10%. MFC after: 1 day Reviewed by: manu, adrian, emaste Differential Revision: https://reviews.freebsd.org/D52662
* The exec(2) man page does not exist; refer to execve(2) which does.Jens Schweikhardt2025-04-191-4/+4
|
* usr.sbin: Remove repeated wordsElyes Haouas2024-04-111-1/+1
| | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/887
* usr.sbin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-277-7/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* pmcstat: fix duplicate event allocation on CPU 0Mitchell Horne2023-09-271-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b6e28991bf3a modified the allocation path for system scope PMCs so that the event was allocated early for CPU 0. The reason is so that the PMC's capabilities could be checked, to determine if pmcstat should allocate the event on every CPU, or just on one CPU in each NUMA domain. In the current scheme, there is no way to determine this information without performing the PMC allocation. This broke the established use-case of log analysis, and so 0aa150775179a was committed to fix the assertion. The result was what appeared to be functional, but in normal counter measurement pmcstat was silently allocating two counters for CPU 0. This cuts the total number of counters that can be allocated from a CPU in half. Additionally, depending on the particular hardware/event, we might not be able to allocate the same event twice on a single CPU. The simplest solution is to release the early-allocated PMC once we have obtained its capabilities, and reallocate it later on. This restores the event list logic to behave as it has for many years, and partially reverts commit b6e28991bf3a. Reported by: alc, kevans Reviewed by: jkoshy, ray MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41978
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-167-14/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-168-16/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* pmcstat(8): Drop .UdMitchell Horne2023-07-101-4/+2
| | | | | | | | | | | This utility has existed for a long time and should not be advertised as "currently under development". While here, fix the one other warning from igor about using a newline for a new sentence. MFC after: 3 days Sponsored by: The FreeBSD Foundation
* pmcstat: Tweak typo fix.John Baldwin2023-06-071-1/+1
| | | | Reviewed by: imp
* pmcstat: Update manpage dateJessica Clarke2023-06-071-1/+1
| | | | Fixes: 53d0b9e438bc ("pmc: Provide full path to modules from kernel linker")
* pmcstat: Fix typosElyes Haouas2023-06-022-2/+2
| | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/653
* pmc: Rework PROCEXEC event to support PIEsJessica Clarke2023-05-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the PROCEXEC event only reports a single address, entryaddr, which is the entry point of the interpreter in the typical dynamic case, and used solely to calculate the base address of the interpreter. For PDEs this is fine, since the base address is known from the program headers, but for PIEs the base address varies at run time based on where the kernel chooses to load it, and so pmcstat has no way of knowing the real address ranges for the executable. This was less of an issue in the past since PIEs were rare, but now they're on by default on 64-bit architectures it's more of a problem. To solve this, pass through what was picked for et_dyn_addr by the kernel, and use that as the offset for the executable's start address just as is done for everything in the kernel. Since we're changing this interface, sanitise the way we determine the interpreter's base address by passing it through directly rather than indirectly via the entry point and having to subtract off whatever the ELF header's e_entry is (and anything that wants the entry point in future can still add that back on as needed; this merely changes the interface to directly provide the underlying variables involved). This will be followed up by a bump to the pmc major version. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D39595
* pmc: Provide full path to modules from kernel linkerJessica Clarke2023-05-302-67/+3
| | | | | | | | | | | | | | | | | This unifies the user object and kernel module paths in libpmcstat, allows modules loaded from non-standard locations (e.g. from a user's home directory when testing) to be found and, since buffer is what all the warnings here use (they were never updated when buffer_modules were added to pick based on where the file was found) has the side-effect of ensuring the messages are correct. This includes obsoleting the now-superfluous -k option in pmcstat. This change breaks the hwpmc ABI and will be followed by a bump to the pmc major version. Reviewed by: jhb, jkoshy, mhorne Differential Revision: https://reviews.freebsd.org/D40048
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1215-15/+15
| | | | | | | | | 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
* pmcstat: augment an error messageMitchell Horne2023-05-061-1/+1
| | | | | | | | | It also applies to the -t argument. Reviewed by: jkoshy MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39907
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-2/+4
|
* pmcstat: Warn about text output format stability.Joseph Koshy2023-03-241-1/+5
| | | | | | | | | The formats for pmcstat(8)'s human-readable output are not part of its user interface definition, and may change in the future. Highlight this in its manual page. Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D39249
* pmcstat: Remove useless return at the end of void functionElyes Haouas2023-03-021-2/+0
| | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/656
* pmcstat: fix log analysisAndrew Gallatin2022-07-041-2/+1
| | | | | | | | | | | | | | | pmcstat has been broken for analyzing logs since D35342 / b6e28991bf3aadb. This is because the pmc for the first CPU is not added when reading logs because unlike its clones, its event id is not invalid. That causes us to fail the assertion at lib/libpmcstat/libpmcstat_logging.c:293 when encountering samples from cpu0. Fix this by removing the check that the PMC is invalid Reviewed by: tsoome Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35709
* System wide and NUMA domain wide counters support. PMC classes for ARM ↵Aleksandr Rybalko2022-06-261-15/+69
| | | | | | | | | | | | DMC-620 and CMN-600. Add support for system wide and NUMA domain wide counters support. Add 3 new PMC classes for ARM DMC-620 and CMN-600 controllers PMU. Reviewed by: mhorne Sponsored By: ARM Sponsored By: Ampere Computing Differential Revision: https://reviews.freebsd.org/D35342
* ncurses: chase dependency changes in the source treeBaptiste Daroussin2021-10-041-1/+1
| | | | Differential Revision: https://reviews.freebsd.org/D32098
* Update a sysctl name to nbuffers_pcpu in hwpmc.4 and pmcstat.cPiotr Pawel Stefaniak2021-08-291-1/+1
| | | | | | | This change was missed in r333509 (e6b475e0af). Differential Revision: https://reviews.freebsd.org/D31704 Reviewed by: mjg
* pmcstat: fix the usage message for -tMitchell Horne2021-04-211-1/+2
| | | | | | | | | A slight mix-up of the flags means this case isn't triggered when it should be. Now, `pmcstat -s event -t 1234` will print the correct error message. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* pmcstat: set initial counter value to zeroMitchell Horne2021-04-211-1/+1
| | | | | | | | | | | | | For an infrequent event, pmcstat may report (u_long)-1 for CPUs where the counter was never incremented. Just set this to zero, instead. ev->ev_count is passed as the 'count' argument to pmc_allocate(3), but this wasn't always the case. Reviewed by: gnn MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29887
* Add the missing pmcstat log entriesAndrew Turner2021-01-051-0/+17
| | | | Sponsored by: Innovate UK
* pmcstat: Fix a typo in the usage messageMateusz Piotrowski2020-11-041-1/+1
| | | | | | | | | Reviewed by: emaste Approved by: emaste Differential Revision: https://reviews.freebsd.org/D26082 Notes: svn path=/head/; revision=367332
* pmcstat.8: Improve description of -TMateusz Piotrowski2020-08-171-6/+35
| | | | Notes: svn path=/head/; revision=364297
* pmcstat: fix build on non-64 bit platformsMateusz Guzik2020-08-051-1/+2
| | | | Notes: svn path=/head/; revision=363932
* pmcstat: implement showing offsets into symbols in top modeMateusz Guzik2020-08-054-23/+58
| | | | | | | | | | | | | The -I option (and hotkey) is reused for this. Skipping symbol resolution is moved to the new -A option (and hotkey). While arguably this violates POLA I think it's a change for the better. ALso note the -I option was added in head. Differential Revision: https://reviews.freebsd.org/D21658 Notes: svn path=/head/; revision=363928
* pmc: Add include path for libpmcstat as it is an internallibEmmanuel Vadot2020-03-251-0/+1
| | | | | | | | Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D24173 Notes: svn path=/head/; revision=359292
* libpmcstat: Try /boot/modules if module not foundRyan Moeller2020-03-121-0/+2
| | | | | | | | | | | | | | | Modules from ports/pkg are commonly installed to /boot/modules rather than to the same directory the kernel resides in. Look there if a module is not found next to the kernel. Submitted by: mmacy Reported by: Nick Principe <nap@iXsystems.com> Approved by: mmacy (mentor) MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=358923
* Regularize the Netflix copyrightWarner Losh2019-02-042-2/+6
| | | | | | | | | | | | | | | Use recent best practices for Copyright form at the top of the license: 1. Remove all the All Rights Reserved clauses on our stuff. Where we piggybacked others, use a separate line to make things clear. 2. Use "Netflix, Inc." everywhere. 3. Use a single line for the copyright for grep friendliness. 4. Use date ranges in all places for our stuff. Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files) Notes: svn path=/head/; revision=343755
* pmc: convert native to jsonl and track TSC value of samplesMatt Macy2018-06-071-1/+1
| | | | | | | | | | | | | | | | | | - add '-j' options to filter to enable converting native pmc log format to json lines format to enable the use of scripts and external tooling % pmc filter -j pmc.log pmc.jsonl - Record the tsc value in sampling interrupts as opposed to recording nanotime when the sample is copied to a global log in hardclock - potentially many milliseconds later. - At initialize record the tsc_freq and the time of day to give us an offset for translating the tsc values in callchain records Notes: svn path=/head/; revision=334749
* hwpmc: add summary command and further metadata extensionsMatt Macy2018-06-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* hwpmc: support sampling both kernel and user stacks when interrupted in kernelMatt Macy2018-06-043-17/+21
| | | | | | | | | | | | | | | | This adds the -U options to pmcstat which will attribute in-kernel samples back to the user stack that invoked the system call. It is not the default, because when looking at kernel profiles it is generally more desirable to merge all instances of a given system call together. Although heavily revised, this change is directly derived from D7350 by Jonathan T. Looney. Obtained from: jtl Sponsored by: Juniper Networks, Limelight Networks Notes: svn path=/head/; revision=334595
* libpmc: allow substring for list and add function for printing event detailsMatt Macy2018-06-011-1/+1
| | | | Notes: svn path=/head/; revision=334464
* pmcstat: suppress uninitialized warning of eventMatt Macy2018-05-271-0/+1
| | | | Notes: svn path=/head/; revision=334256
* pmc(3)/hwpmc(4): update supported Intel processors to rely fully on theMatt Macy2018-05-263-29/+62
| | | | | | | | | | | | | | | | | | vendor provided pmu-events tables and sundry cleanups. The vendor pmu-events tables provide counter descriptions, default sample rates, event, umask, and flag values for all the counter configuration permutations. Using this gives us: - much simpler kernel code for the MD component - helpful long and short event descriptions - simpler user code - sample rates that won't overload the system Update man page with newer sample types and remove unused sample type. Notes: svn path=/head/; revision=334244
* Revert r334242 "pmc(3)/hwpmc(4): update supported Intel processors to rely ↵Matt Macy2018-05-263-62/+29
| | | | | | | | | fully on the" because of squash commit messages Notes: svn path=/head/; revision=334243
* pmc(3)/hwpmc(4): update supported Intel processors to rely fully on theMatt Macy2018-05-263-29/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vendor provided pmu-events tables and sundry cleanups. The vendor pmu-events tables provide counter descriptions, default sample rates, event, umask, and flag values for all the counter configuration permutations. Using this gives us: - much simpler kernel code for the MD component - helpful long and short event descriptions - simpler user code - sample rates that won't overload the system Update man page with newer sample types and remove unused sample type. Squashed commit of the following: commit 4459d43eff815bec08ccc5533dbe5de846f03128 Author: Matt Macy <mmacy@mattmacy.io> Date: Sat May 26 00:06:31 2018 -0700 libpmc: fix pmu function signatures for non amd64 commit a2cb8bbc586c65d41f9b291430a2261ec67b59fe Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 22:38:11 2018 -0700 pmcstat: fix indentation of usage commit f686954b15ff56a833ac80404898977cb80a265b Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 22:19:49 2018 -0700 pmclog(3): add callchain and pmcallocatedyn, remove pcsample commit 73e13a0d2e9498c81c150d14d022050cee7511bb Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 22:19:00 2018 -0700 pmclog.h: GC pcsample field commit 3e93ffd65da641fa657539dad3c48e281f8b5798 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 22:05:57 2018 -0700 hwpmc: make Intel core CPUs use external event tables commit 634f5fae1e1644ac324003136c66cd9c619d1c93 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 22:00:06 2018 -0700 pmclog: update log record types, bump PMC_MAJOR - explicitly make log record types a multiple of 8 bytes - hook in pmu event types for pmc_allocate records - remove references to no longer PCSAMPLE record commit 83d84fcd2d65bdf6ddcb2e155a22f0cfa2a9c225 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 21:52:10 2018 -0700 libpmc: add support for having vendor table driven pmc_allocate commit 9e6ad63c40c2fce8404847ace5078ca6cb33a736 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 19:11:33 2018 -0700 hwpmc_core: add accessors for EVSEL & UMASK, make IAP_UMASK useful to user commit 859dceb93daa6419a48c794db99b6758e5b041c9 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 19:09:45 2018 -0700 pmcstat: update usage and man page as well as make -L consistent with pmccontrol commit 79c7d8597e28c2eb13f5f9113e65ec2792ca57b1 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 18:07:03 2018 -0700 pmu_util: add support for all current intel event keywords commit d8089c7f6a6c8527f38324252b1ffb47004694c6 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 17:45:00 2018 -0700 add description for new arguments commit 058336740bab53c62ec88a3a026ea848cf3878c6 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 17:38:15 2018 -0700 libpmc: move pmu_events table and pmu_utils out of libpmcstat so that they can be used by pmc_allocate commit 049b66b382e2f833c3f47bc8df9e750cb265709f Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 16:12:41 2018 -0700 pmcstat: hook pmu_events counter description utility routines in commit f5e01e7b37a691dc045e1aa16b3ebdd162515de8 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 16:11:59 2018 -0700 pmu_events: add utility routines for listing counters and their descriptions commit cba4d4f8907f772279f86f18f915e0d74d33ac56 Author: Matt Macy <mmacy@mattmacy.io> Date: Fri May 25 16:09:50 2018 -0700 pmu-events: expand out skylake regex to simplify string matches Notes: svn path=/head/; revision=334242
* pmcstat(8)Sean Bruno2018-05-252-3/+14
| | | | | | | | | | | - Document per thread filtering. Submitted by: kbowling Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15549 Notes: svn path=/head/; revision=334215
* pmcstat: add usage strings for -L and -IMatt Macy2018-05-241-0/+2
| | | | Notes: svn path=/head/; revision=334135
* pmcstat top mode + -I - use fully qualified addressMatt Macy2018-05-241-1/+1
| | | | Notes: svn path=/head/; revision=334133
* pmcstat: don't compare signed and unsignedMatt Macy2018-05-241-1/+2
| | | | Notes: svn path=/head/; revision=334131
* libpmcstat: compile in events based on json descriptionMatt Macy2018-05-242-4/+2
| | | | Notes: svn path=/head/; revision=334128