Home | History | Annotate | Download | only in tprof
History log of /src/usr.sbin/tprof/tprof.c
RevisionDateAuthorComments
 1.21  17-Apr-2023  msaitoh Use the default counter if -e argument is not specified.

monitor command:
The default counter is selected if -e argument is not specified.
list command:
Print the name of the default counter for monitor and top command.
 1.20  26-Dec-2022  ryo fixed parsing of event options.
if event option was specivied, it was stuck in a busy loop.
 1.19  26-Dec-2022  ryoon Reflect recent new options for top operation, add a and c
 1.18  16-Dec-2022  ryo branches: 1.18.2;
the "scale" option can be specified in the event name even in "tprof monitor"
 1.17  05-Dec-2022  ryo fix build error with llvm
 1.16  01-Dec-2022  ryo add "top" subcommand to tprof(8)
 1.15  01-Dec-2022  ryo Improve tprof(8)

- Added "tprof count" subcommand to perform counts only.
- Event options (u,k) are now optional. The default value is both userland and kernel. (:uk)
- Event counters can be displayed with SIGINFO during `tprof monitor' or `tprof count'.
 1.14  01-Dec-2022  ryo Improve tprof(4)

- Multiple events can now be handled simultaneously.
- Counters should be configured with TPROF_IOC_CONFIGURE_EVENT in advance,
instead of being configured at TPROF_IOC_START.
- The configured counters can be started and stopped repeatedly by
PROF_IOC_START/TPROF_IOC_STOP.
- The value of the performance counter can be obtained at any timing as a 64bit
value with TPROF_IOC_GETCOUNTS.
- Backend common parts are handled in tprof.c as much as possible, and functions
on the tprof_backend side have been reimplemented to be more primitive.
- The reset value of counter overflows for profiling can now be adjusted.
It is calculated by default from the CPU clock (speed of cycle counter) and
TPROF_HZ, but for some events the value may be too large to be sufficient for
profiling. The event counter can be specified as a ratio to the default or as
an absolute value when configuring the event counter.
- Due to overall changes, API and ABI have been changed. TPROF_VERSION and
TPROF_BACKEND_VERSION were updated.
 1.13  24-Jul-2018  maxv Use errx, there is no errno.
 1.12  18-Jul-2018  wiz Various improvements to man page. Sync usage.
 1.11  14-Jul-2018  jmcneill Fix a crash when running tprof with no arguments; check argc before accessing argv[0]
 1.10  13-Jul-2018  joerg Mark tprof_monitor as dead
 1.9  13-Jul-2018  maxv Ask for a file path with the "analyze" command, instead of reading stdin.
 1.8  13-Jul-2018  maxv Merge tpfmt(1) into tprof(8). We want to have access to everything with
only one tool. The code is copied mostly as-is, and the functionality is
available via the "analyze" command.

Eg:
tprof monitor -e llc-misses:k -o myfile.out sleep 20
tprof analyze < myfile.out

Will move soon, I don't like the reading via stdin.
 1.7  13-Jul-2018  maxv Change the arguments of the tprof tool, to match the behavior of pmc(1) and
cpuctl(8). They become:

tprof list
tprof monitor -e name:option [-o outfile] command
 1.6  13-Jul-2018  maxv Revamp tprof.

Rewrite the Intel backend to use the generic PMC interface, which is
available on all Intel CPUs. Synchronize the AMD backend with the new
interface.

The kernel identifies the PMC interface, and gives its id to userland.
Userland then queries the events itself (via cpuid etc). These events
depend on the PMC interface.

The tprof utility is rewritten to allow the user to choose which event
to count (which was not possible until now, the event was hardcoded in
the backend). The command line format is based on usr.bin/pmc, eg:

tprof -e llc-misses:k -o output sleep 20

The man page is updated too, but the arguments will likely change soon
anyway so it doesn't matter a lot.

The tprof utility has three tables:

Intel Architectural Version 1
Intel Skylake/Kabylake
AMD Family 10h

A CPU can support a combination of tables. For example Kabylake has
Intel-Architectural-Version-1 and its own Intel-Kabylake table.

For now the Intel Skylake/Kabylake table contains only one event, just
to demonstrate that the combination of tables works. Tested on an
Intel Core i5 Kabylake.

The code for AMD Family 10h is taken from the code I had written for
usr.bin/pmc. I haven't tested it yet, but it's the same as pmc(1), so
I guess it works as-is.

The whole thing is written in such a way that (I think) it is not
complicated to add more CPU models, and more architectures (other than
x86).
 1.5  10-Jan-2012  joerg branches: 1.5.38; 1.5.40;
Use __dead
 1.4  26-Jan-2009  yamt branches: 1.4.8;
fix an error message.
 1.3  03-Jan-2009  yamt fix exit status values.
 1.2  03-Jan-2008  yamt branches: 1.2.2;
usage: be a little more understandable.
 1.1  01-Jan-2008  yamt a dumb program to talk with the tprof driver.
 1.2.2.2  09-Jan-2008  matt sync with HEAD
 1.2.2.1  03-Jan-2008  matt file tprof.c was added on branch matt-armv6 on 2008-01-09 02:02:35 +0000
 1.4.8.1  17-Apr-2012  yamt sync with head
 1.5.40.1  10-Jun-2019  christos Sync with HEAD
 1.5.38.1  28-Jul-2018  pgoyette Sync with HEAD
 1.18.2.2  21-Jun-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #210):

usr.sbin/tprof/tprof.8: revision 1.30
sys/dev/tprof/tprof_x86_amd.c: revision 1.8
sys/dev/tprof/tprof_armv8.c: revision 1.20
sys/dev/tprof/tprof_types.h: revision 1.7
sys/dev/tprof/tprof_x86_intel.c: revision 1.6
sys/dev/tprof/tprof_x86_intel.c: revision 1.7
sys/dev/tprof/tprof_x86_intel.c: revision 1.8
sys/dev/tprof/tprof.c: revision 1.23
usr.sbin/tprof/tprof.8: revision 1.25
usr.sbin/tprof/tprof.8: revision 1.26
usr.sbin/tprof/arch/tprof_x86.c: revision 1.16
usr.sbin/tprof/tprof.8: revision 1.27
usr.sbin/tprof/arch/tprof_x86.c: revision 1.17
usr.sbin/tprof/tprof.8: revision 1.28
usr.sbin/tprof/tprof.h: revision 1.5
usr.sbin/tprof/tprof.8: revision 1.29
sys/dev/tprof/tprof_armv7.c: revision 1.13
usr.sbin/tprof/tprof_top.c: revision 1.9
usr.sbin/tprof/tprof.c: revision 1.21

Add Cometlake support.

Obtain the number of general counters from CPUID 0xa.

Test cpuid_level in tprof_intel_ncounters().
This function is called before tprof_intel_ident().

KNF. No functional change.

Add two note to the tprof(8)'s manual page.
- "list" command prints the maximum number of counters that can be used
simultaneously.
- multiple -e arguments can be specified.

Use the default counter if -e argument is not specified.
monitor command:
The default counter is selected if -e argument is not specified.
list command:
Print the name of the default counter for monitor and top command.

tprof.8: new sentence, new line

tprof(8): fix markup nits

tprof.8: fix typo, s/speficied/specified/
 1.18.2.1  26-Dec-2022  martin Pull up following revision(s) (requested by ryo in ticket #24):

usr.sbin/tprof/tprof.c: revision 1.19
usr.sbin/tprof/tprof.c: revision 1.20

Reflect recent new options for top operation, add a and c

fixed parsing of event options.
if event option was specivied, it was stuck in a busy loop.

RSS XML Feed