aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pmc
Commit message (Collapse)AuthorAgeFilesLines
* Fix build with GCC 8.1.Ruslan Bukin2018-10-011-0/+1
| | | | | | | | | | | | | GCC 8.1 failed to build LLVM's libc++ when -Wshadow is set, so lower down WARNS flag to 3. This is similar to dtc(1) which uses libc++ and sets WARNS to 3. Approved by: re (gjb) Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=339064
* pmc: remove trailing whitespaceEitan Adler2018-06-131-1/+1
| | | | | | | Reported by: swills Notes: svn path=/head/; revision=335045
* pmc gcc fixupsRyan Libby2018-06-112-5/+5
| | | | | | | | | | | Fix the build of lib/libpmc and usr.sbin/pmc for gcc on amd64. Reviewed by: mmacy Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D15723 Notes: svn path=/head/; revision=334957
* pmc: mark some dead functions as suchEitan Adler2018-06-095-8/+10
| | | | | | | | | Also change a single instance of the comma operator to a semi-colon. Reviewed by: mmacy Notes: svn path=/head/; revision=334874
* pmc: convert native to jsonl and track TSC value of samplesMatt Macy2018-06-072-15/+37
| | | | | | | | | | | | | | | | | | - 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-066-14/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: log name->pid, name->tid mappingsMatt Macy2018-06-053-37/+121
| | | | | | | | | | | | | | By logging all threads and processes 'pmc filter' can now filter on process or thread name, relieving the user of the burden of determining which tid or pid was which when the sample was taken. % pmc filter -T if_io_tqg -P nginx pmc.log pmc-iflib.log % pmc filter -x -T idle pmc.log pmc-noidle.log Notes: svn path=/head/; revision=334647
* 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 filter: avoid spurious gcc uninitialized warningMatt Macy2018-06-041-1/+1
| | | | Notes: svn path=/head/; revision=334609
* pmc: add filter commandMatt Macy2018-06-044-1/+273
| | | | | | | | | | | | | | pmc filter allows the user to select event types, threads, and processes from a sample. % pmcstat -S unhalted_core_cycles -S llc-misses -S -S resource_stalls.any -O pmc.log % pmc filter -e llc-misses pmc.log pmc-llc-misses.log % pmc filter -e unhalted_core_cycles -t 100339 pmc.log pmc-core-cycles.log etc... % pmcstat -R pmc-core-cycles.log -G pmc-core-cycles.stacks Notes: svn path=/head/; revision=334601
* pmc: add list-events commandMatt Macy2018-06-014-2/+134
| | | | Notes: svn path=/head/; revision=334465
* pmc stat: fix format strings for 32-bitMatt Macy2018-05-302-11/+9
| | | | Notes: svn path=/head/; revision=334404
* pmc: don't break build with format issuesMatt Macy2018-05-301-0/+1
| | | | Notes: svn path=/head/; revision=334361
* 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-295-0/+825
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