Commit Graph

62 Commits

Author SHA1 Message Date
fabient
757a8d026a When an asm location cannot be resolved to a function the cost
will be spread as small value and then filtered by the threshold.
As a first step solution display the number of event that cannot
be resolved as a valid function location.

MFC after:	1week
2010-09-03 13:54:02 +00:00
fabient
3327e87142 - Do not use the runtime mask when logfile is specified.
- Revert the fix on rtld path that is not necessary.

MFC after:	1 week
2010-08-03 13:46:25 +00:00
fabient
94897ca080 Allow file as a top source, it works with socket now.
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
2010-08-03 09:23:53 +00:00
fabient
796dcddd18 Fix the calltree top view that incorrectly filter out some nodes.
MFC after:	1 week
2010-08-02 13:40:19 +00:00
fabient
0ecf60c0b7 Fix warnings found by Coverity.
Found with:   Coverity Prevent(tm)
MFC after:	1 month
2010-06-05 22:57:53 +00:00
fabient
1e4578001f Rework the calltree top view by critical callchain.
The percentage show is the sum of the cost for the codepath.

MFC after: 1 week
2010-05-07 19:48:50 +00:00
fabient
e56405ea52 Exclude undefined symbol from ELF file when doing function resolve.
MFC after: 3 days
2010-05-06 20:54:19 +00:00
fabient
6f1324bb0a Apply threshold filter to root node in calltree view.
MFC after: 3days
2010-04-21 11:50:13 +00:00
fabient
d7c34a15b8 Move fatal error at the right place.
Fix exit from top mode when checking if PMC is available.

MFC after: 3 days
2010-04-14 21:53:27 +00:00
uqs
3960614646 mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
fabient
e8a282c847 Improve "top" header by:
- Display sample received per PMCs (or merged PMCs).
- Display percentage vs all samples
2010-04-02 13:34:28 +00:00
fabient
da13321f03 Wait for pmc name in the log before displaying data.
This will solve an abort in case of low throughput PMCs.

MFC after: 3days
2010-03-28 22:46:56 +00:00
fabient
b1b316fa5b Do not overflow the term in the case of multi-line display.
MFC after: 3days
2010-03-26 14:29:57 +00:00
fabient
a8460cce17 Change the way shutdown is handled for log file.
pmc_flush_logfile is now non-blocking and just ask the kernel
to shutdown the file. From that point, no more data is
accepted by the log thread and when the last buffer is flushed
the file is closed.

This will remove a deadlock between pmcstat asking for
flush while it cannot flush the pipe itself.

MFC after: 3 days
2010-03-08 19:58:00 +00:00
fabient
3d20760d98 Bug fixed:
- no display on serial terminal in top mode.
- display alignment for continuation string.
- correct invalid value used for display limit.

MFC after:	3 days
2010-03-05 23:08:19 +00:00
ru
4d27ff91d0 Fixed dependencies (make checkdpadd). 2010-02-25 20:24:19 +00:00
fabient
2d898efa0f - Reorganize code in 'plugin' to share log processing.
- 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
2010-02-11 22:51:44 +00:00
ed
073cafdd42 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
antoine
bfd388c026 (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR:		137213
Submitted by:	Eygene Ryabinkin (initial version)
MFC after:	1 month
2009-12-28 22:56:30 +00:00
jkoshy
50a949cca0 Catch up with the times: "mozilla" -> "firefox". 2009-06-02 04:45:56 +00:00
jkoshy
dbc2a99f2f Close the read side of the pipe to self when exiting. 2008-12-23 12:08:06 +00:00
attilio
eff98a06a3 Add the -m option to pmcstat.
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
2008-11-25 23:24:29 +00:00
jkoshy
9a63cf3a86 As a matter of good programming style, stop PMCs before releasing
them.
2008-11-19 02:22:34 +00:00
jkoshy
de3502c946 - Avoid a spurious error when a command line is specified without
any process scope PMCs.
- Change the -c '*' option to denote non-halted CPUs.
2008-10-07 17:28:52 +00:00
jkoshy
99d8d99aa0 Bring the usage message in sync with the manual page. 2008-09-19 14:51:41 +00:00
jkoshy
7b7904fe0c Add an example illustrating the use sleep(1) for performing timed
measurements.
2008-09-19 13:17:22 +00:00
jkoshy
ef261a0536 Fix a regression: attach process PMCs to the process created when
a command line is specified.
2008-07-01 15:20:15 +00:00
jkoshy
0eb008c767 Document messages printed in verbose mode.
Requested by:	Fabien Thomas <fabien.thomas at netasq dot com>
2008-06-29 10:30:06 +00:00
jkoshy
a232f0b6df Fix 'make checkdpadd'. 2008-02-22 06:25:49 +00:00
jkim
951f756a2b Fix non-SMP kernel regression introduced in the previous commit.
Reviewed by:	jkoshy
2008-01-10 16:31:14 +00:00
jkoshy
2aef7957ec Introduce pmcstat(8) changes for summarizing hwpmc(4) callchain records in
in textual form and in gmon.out format.

Update manual page.

Sponsored by:	FreeBSD Foundation and Google Inc.
2007-12-07 08:26:21 +00:00
jkoshy
4244e63960 When printing the contents of a HWPMC log in human readable form:
- Print a warning if the version number recorded in the log is not what the
  tool expects.
- Print a tidier error message when an unrecognized event is encountered
  in the log.
- Don't print a spurious 'Unknown error: 0' when exiting after a parse
  error.
2007-12-03 10:29:49 +00:00
ru
0de18b1b0a Fixed "make checkdpadd" (missing library dependencies).
Approved by:	re (kensmith)
2007-10-01 18:15:11 +00:00
jkoshy
0dfc773563 MFP4: Enhancements to pmcstat(8):
- 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.
2007-04-27 12:09:31 +00:00
jkoshy
bf9c7e516d MFP4: Enhancements and bug-fixes to pmcstat(8):
- 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.
2007-04-22 15:00:39 +00:00
jkoshy
4c79721dd4 Correct a sanity check. 2007-04-21 12:04:03 +00:00
ru
081fcce9b9 Markup fixes. 2006-09-29 17:57:04 +00:00
ru
822ecb389f Line up usage output. 2006-09-29 17:28:01 +00:00
jkoshy
435490fd44 When printing a map, print the number of samples recorded by each gmon.out file.
MFC after:	1 week
2006-04-05 15:12:25 +00:00
jkoshy
80251d4f05 - Teach pmcstat(8) to log over the network; the -O option now
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
2006-04-02 12:52:16 +00:00
jkoshy
48e5e4792d MFP4: Support for profiling dynamically loaded objects.
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)
2006-03-26 12:20:54 +00:00
jkoshy
30ec812b47 When generating profiles (-g) warn about shared objects that were
not found.
2005-12-25 05:11:29 +00:00
jkoshy
d308f9605c - Don't print an errno string when reporting dropped samples.
- Prevent an unsuccessful exec() of a target program from triggering
  a false 'dropped samples' message.
2005-12-24 17:00:33 +00:00
jkoshy
f2b9dccde5 Warn the user if the kernel driver dropped samples or ran out of event buffers
during a data collection run.
2005-10-21 18:59:59 +00:00
jkoshy
1c6388f59d Handle 32 bit executables better on AMD64 platforms. 2005-10-18 05:13:27 +00:00
jkoshy
94200415ae Document pmcstat's inability to handle 32 bit executables on the
AMD64 while I work on a fix.

Noticed by:	ps
2005-10-18 04:40:11 +00:00
jkoshy
e4de2de432 Determine where the runtime loader got mapped to when a dynamically
linked process was exec()'ed, and map samples in that address range
into the appropriate buckets in the runtime loader's profile.
Improve a few comments.

MFC after:	3 days
2005-09-14 21:15:50 +00:00
jkoshy
14b399b103 Fix a bug that caused generated gmon.out profiles to be out of
whack.  Use saturating arithmetic when incrementing a bucket.
Improve a few comments.

MFC after:	3 days
2005-09-13 02:23:25 +00:00
jkoshy
37ed081c35 Improve an error message.
MFC after:	3 days
2005-09-05 18:31:09 +00:00
jkoshy
0796704e4d Correctly print system-wide PMC counts for short-lived command lines.
Reported by:	cracauer
MFC after:	3 days
2005-08-04 03:12:55 +00:00