aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pmcstat/pmcstat.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Two bugs fixed:Fabien Thomas2011-11-011-2/+4
| | | | | | | | | | - Do not close stdout or stderr when redirecting to file. - Correctly handle error code to detect when no buffer available. MFC after: 1 month Notes: svn path=/head/; revision=226986
* Add a flush of the current PMC log buffer before displaying the next top.Fabien Thomas2011-10-181-8/+10
| | | | | | | | | | | As the underlying block is 4KB if the PMC throughput is low the measurement will be reported on the next tick. pmcstat(8) use the modified flush API to reclaim current buffer before displaying next top. MFC after: 1 month Notes: svn path=/head/; revision=226514
* Convert pmcstat about using cpuset_t rather than relying on plain 32 bitAttilio Rao2011-08-071-69/+76
| | | | | | | | | | | | | | | | | | | ints. That fixes a first bug where pmcstat wasn't using the old cpumask_t interface and now also brings the full support for more than 32 cpus. While here, make the functions pmcstat_clone_event_descriptor() and pmcstat_get_cpumask() private to pmcstat. The problem of assuming cpu dense masks still persists and should be eventually fixed, as reported by avg. Tested by: pluknet Reviewed by: gnn Approved by: re (kib) Notes: svn path=/head/; revision=224698
* pmcstat, pmccontrol: catch up with removal of machdep.hlt_cpus sysctlAndriy Gapon2011-07-151-10/+2
| | | | | | | | | Reported by: Pan Tsu <inyaoo@gmail.com> Reviewed by: attilio No objections: gnn Notes: svn path=/head/; revision=224057
* - Do not use the runtime mask when logfile is specified.Fabien Thomas2010-08-031-0/+8
| | | | | | | | | - Revert the fix on rtld path that is not necessary. MFC after: 1 week Notes: svn path=/head/; revision=210797
* Allow file as a top source, it works with socket now.Fabien Thomas2010-08-031-47/+34
| | | | | | | | | | | | | | | | | | | | This will allow top monitoring using socket/ssh tunnelling of system without local symbols. client: pmcstat -R <ip>:<port> -T -r <symbolspath> monitored device: pmcstat -Sinstructions -O <ip>:<port> - Move the file read in the event loop - Initialize and clean log in all cases - Preserve global stats value during top refresh - Fix the rtld/line resolver that ignore '-r' prefix - Support socket for '-R' (server mode) - Display the statistics when exiting top mode Notes: svn path=/head/; revision=210794
* Fix warnings found by Coverity.Fabien Thomas2010-06-051-1/+2
| | | | | | | | Found with: Coverity Prevent(tm) MFC after: 1 month Notes: svn path=/head/; revision=208858
* Bug fixed:Fabien Thomas2010-03-051-0/+3
| | | | | | | | | | | - no display on serial terminal in top mode. - display alignment for continuation string. - correct invalid value used for display limit. MFC after: 3 days Notes: svn path=/head/; revision=204783
* - Reorganize code in 'plugin' to share log processing.Fabien Thomas2010-02-111-81/+205
| | | | | | | | | | | - Kcachegrind (calltree) support with assembly/source code mapping and call count estimator (-F). - Top mode for calltree and callgraph plugin (-T). MFC after: 1 month Notes: svn path=/head/; revision=203790
* Close the read side of the pipe to self when exiting.Joseph Koshy2008-12-231-0/+3
| | | | Notes: svn path=/head/; revision=186425
* Add the -m option to pmcstat.Attilio Rao2008-11-251-2/+24
| | | | | | | | | | | | This option prints the list of sampled PCs along with the function name, the start and end addresses of this where their live within. Reviewed by: jkoshy Tested by: gnn Sponsored by: Nokia Notes: svn path=/head/; revision=185322
* As a matter of good programming style, stop PMCs before releasingJoseph Koshy2008-11-191-0/+3
| | | | | | | them. Notes: svn path=/head/; revision=185079
* - Avoid a spurious error when a command line is specified withoutJoseph Koshy2008-10-071-2/+3
| | | | | | | | any process scope PMCs. - Change the -c '*' option to denote non-halted CPUs. Notes: svn path=/head/; revision=183672
* Bring the usage message in sync with the manual page.Joseph Koshy2008-09-191-1/+2
| | | | Notes: svn path=/head/; revision=183186
* Fix a regression: attach process PMCs to the process created whenJoseph Koshy2008-07-011-2/+2
| | | | | | | a command line is specified. Notes: svn path=/head/; revision=180148
* Fix non-SMP kernel regression introduced in the previous commit.Jung-uk Kim2008-01-101-4/+7
| | | | | | | Reviewed by: jkoshy Notes: svn path=/head/; revision=175215
* Introduce pmcstat(8) changes for summarizing hwpmc(4) callchain records inJoseph Koshy2007-12-071-29/+92
| | | | | | | | | | | in textual form and in gmon.out format. Update manual page. Sponsored by: FreeBSD Foundation and Google Inc. Notes: svn path=/head/; revision=174396
* MFP4: Enhancements to pmcstat(8):Joseph Koshy2007-04-271-49/+148
| | | | | | | | | | | | | - Allow the "-t" option to take a regular expression naming command line processes to attach process PMCs to. - Update the manual page and add an example showing the use of the new functionality. - Update the (c) year on the affected source files. Notes: svn path=/head/; revision=169069
* MFP4: Enhancements and bug-fixes to pmcstat(8):Joseph Koshy2007-04-221-108/+189
| | | | | | | | | | | | | | | | | | | - The '-c' option now takes a comma-separated list of CPU numbers, or a literal '*' denoting all CPUs in the system. Subsequent system PMCs are allocated on the CPUs so specified. Change the default behaviour to allocate system PMCs on all CPUs, not just CPU 0. Update the manual page and add an example of how to use the new functionality. - Attach PMCs to a (commandline) child process more reliably. This fixes a long standing bug in counting events incurred by short-lived processes. Notes: svn path=/head/; revision=168949
* Correct a sanity check.Joseph Koshy2007-04-211-1/+1
| | | | Notes: svn path=/head/; revision=168927
* Line up usage output.Ruslan Ermilov2006-09-291-1/+1
| | | | Notes: svn path=/head/; revision=162804
* - Teach pmcstat(8) to log over the network; the -O option nowJoseph Koshy2006-04-021-11/+6
| | | | | | | | | | | | | | takes a host:port specification. - Update the manual page and add an example showing how log over the network using pmcstat(8) and nc(1). Document the current inability to process logs in cross-platform manner. - Have pmcstat_open_log() call err(3) directly in case of an error; this simplifies error handling in its caller. MFC after: 1 week Notes: svn path=/head/; revision=157406
* MFP4: Support for profiling dynamically loaded objects.Joseph Koshy2006-03-261-17/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel changes: Inform hwpmc of executable objects brought into the system by kldload() and mmap(), and of their removal by kldunload() and munmap(). A helper function linker_hwpmc_list_objects() has been added to "sys/kern/kern_linker.c" and is used by hwpmc to retrieve the list of currently loaded kernel modules. The unused `MAPPINGCHANGE' event has been deprecated in favour of separate `MAP_IN' and `MAP_OUT' events; this change reduces space wastage in the log. Bump the hwpmc's ABI version to "2.0.00". Teach hwpmc(4) to handle the map change callbacks. Change the default per-cpu sample buffer size to hold 32 samples (up from 16). Increment __FreeBSD_version. libpmc(3) changes: Update libpmc(3) to deal with the new events in the log file; bring the pmclog(3) manual page in sync with the code. pmcstat(8) changes: Introduce new options to pmcstat(8): "-r" (root fs path), "-M" (mapfile name), "-q"/"-v" (verbosity control). Option "-k" now takes a kernel directory as its argument but will also work with the older invocation syntax. Rework string handling in pmcstat(8) to use an opaque type for interned strings. Clean up ELF parsing code and add support for tracking dynamic object mappings reported by a v2.0.00 hwpmc(4). Report statistics at the end of a log conversion run depending on the requested verbosity level. Reviewed by: jhb, dds (kernel parts of an earlier patch) Tested by: gallatin (earlier patch) Notes: svn path=/head/; revision=157144
* - Don't print an errno string when reporting dropped samples.Joseph Koshy2005-12-241-3/+4
| | | | | | | | - Prevent an unsuccessful exec() of a target program from triggering a false 'dropped samples' message. Notes: svn path=/head/; revision=153704
* Warn the user if the kernel driver dropped samples or ran out of event buffersJoseph Koshy2005-10-211-2/+27
| | | | | | | during a data collection run. Notes: svn path=/head/; revision=151542
* Improve an error message.Joseph Koshy2005-09-051-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=149805
* Correctly print system-wide PMC counts for short-lived command lines.Joseph Koshy2005-08-041-0/+3
| | | | | | | | Reported by: cracauer MFC after: 3 days Notes: svn path=/head/; revision=148688
* Sync usage message with the code and manual page.Joseph Koshy2005-07-231-0/+1
| | | | | | | Submitted by: maxim Notes: svn path=/head/; revision=148329
* Fix a bug that affected on-the-fly gmon.out file generation.Joseph Koshy2005-07-091-6/+5
| | | | | | | Approved by: re (scottl) Notes: svn path=/head/; revision=147863
* MFP4:Joseph Koshy2005-06-301-347/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - pmcstat(8) gprof output mode fixes: lib/libpmc/pmclog.{c,h}, sys/sys/pmclog.h: + Add a 'is_usermode' field to the PMCLOG_PCSAMPLE event + Add an 'entryaddr' field to the PMCLOG_PROCEXEC event, so that pmcstat(8) can determine where the runtime loader /libexec/ld-elf.so.1 is getting loaded. sys/kern/kern_exec.c: + Use a local struct to group the entry address of the image being exec()'ed and the process credential changed flag to the exec handling hook inside hwpmc(4). usr.sbin/pmcstat/*: + Support "-k kernelpath", "-D sampledir". + Implement the ELF bits of 'gmon.out' profile generation in a new file "pmcstat_log.c". Move all log related functions to this file. + Move local definitions and prototypes to "pmcstat.h" - Other bug fixes: + lib/libpmc/pmclog.c: correctly handle EOF in pmclog_read(). + sys/dev/hwpmc_mod.c: unconditionally log a PROCEXIT event to all attached PMCs when a process exits. + sys/sys/pmc.h: correct a function prototype. + Improve usage checks in pmcstat(8). Approved by: re (blanket hwpmc) Notes: svn path=/head/; revision=147708
* MFP4:Joseph Koshy2005-06-091-114/+476
| | | | | | | | | | | | | | | | | | | - Implement sampling modes and logging support in hwpmc(4). - Separate MI and MD parts of hwpmc(4) and allow sharing of PMC implementations across different architectures. Add support for P4 (EMT64) style PMCs to the amd64 code. - New pmcstat(8) options: -E (exit time counts) -W (counts every context switch), -R (print log file). - pmc(3) API changes, improve our ability to keep ABI compatibility in the future. Add more 'alias' names for commonly used events. - bug fixes & documentation. Notes: svn path=/head/; revision=147191
* Neaten usage message.Joseph Koshy2005-05-021-1/+1
| | | | Notes: svn path=/head/; revision=145796
* Add convenience APIs pmc_width() and pmc_capabilities() to -lpmc.Joseph Koshy2005-05-011-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Have pmcstat(8) and pmccontrol(8) use these APIs. Return PMC class-related constants (PMC widths and capabilities) with the OP GETCPUINFO call leaving OP PMCINFO to return only the dynamic information associated with a PMC (i.e., whether enabled, owner pid, reload count etc.). Allow pmc_read() (i.e., OPS PMCRW) on active self-attached PMCs to get upto-date values from hardware since we can guarantee that the hardware is running the correct PMC at the time of the call. Bug fixes: - (x86 class processors) Fix a bug that prevented an RDPMC instruction from being recognized as permitted till after the attached process had context switched out and back in again after a pmc_start() call. Tighten the rules for using RDPMC class instructions: a GETMSR OP is now allowed only after an OP ATTACH has been done by the PMC's owner to itself. OP GETMSR is not allowed for PMCs that track descendants, for PMCs attached to processes other than their owner processes. - (P4/HTT processors only) Fix a bug that caused the MI and MD layers to get out of sync. Add a new MD operation 'get_config()' as part of this fix. - Allow multiple system-mode PMCs at the same row-index but on different CPUs to be allocated. - Reject allocation of an administratively disabled PMC. Misc. code cleanups and refactoring. Improve a few comments. Notes: svn path=/head/; revision=145774
* Bring a working snapshot of hwpmc(4), its associated libraries, userland ↵Joseph Koshy2005-04-191-0/+728
utilities and documentation into -CURRENT. Bump FreeBSD_version. Reviewed by: alc, jhb (kernel changes) Notes: svn path=/head/; revision=145256