Commit Graph

86 Commits

Author SHA1 Message Date
riastradh ad49149131 elftoolchain: Be consistent about which ELF header files we use.
1. For tools that use elftoolchain: always use elftoolchain's
   elfdefinitions.h.  Don't even think about looking at the host's
   sys/exec_elf.h, which makes no sense and should never happen.

   (ELF tools that don't use elftoolchain, like m68k-elf2coff,
   continue to use nbincludes/sys/exec_elf.h.  But no more nbincludes
   hacks in elftoolchain.)

2. For kernel components (solaris, zfs, dtrace): always use
   sys/exec_elf.h, even in Solaris components via sys/elf.h.
   elfdefinitions.h is not wired up in the kernel build at all.

3. For most userland components that involve libelf: use
   elfdefinitions.h via libelf header files (libelf.h, gelf.h).

   libdtrace in particular requires _all_ R_* reloc type definitions,
   but sys/exec_elf.h brings in only the _current machine's_ R_*
   reloc type definitions.  (While here: Use uintptr_t instead of
   Elf_Addr for pointer-to-integer cast, since Elf_Addr is MD and
   provided only by sys/exec_elf.h, not by elfdefinitions.h.)

   And most userland components using libelf don't rely on any
   properties of the current machine from sys/exec_elf.h, so they can
   use libelf's elfdefinition.h.

   Exceptions:

   - dtrace drti.c relies on link.h -> link_elf.h -> sys/exec_elf.h,
     but it also relies on sys/dtrace.h -> sys/elf.h ->
     elfdefinitions.h like other userland components using sys/elf.h.

   - kdump-ioctl.c uses sys/exec_elf.h directly and sys/dtrace.h ->
     sys/elf.h -> elfdefinitions like other userland components using
     sys/elf.h.

   - t_ptrace_wait.c (via t_ptrace_core_wait.h) uses libelf to parse
     core files, but relies on sys/exec_elf.h for struct
     netbsd_elfcore_procinfo.

   None of these exceptions needs all R_* reloc type definitions, so
   as a workaround, we can just suppress libelf's elfdefinitions.h by
   defining _SYS_ELFDEFINITIONS_H_ and use sys/exec_elf.h in these
   exceptions.

And undo the whole BUILTIN_ELF_HEADERS mistake.  This was:

- half bogus workarounds for missing build_install dependencies in
  tools/Makefile, which are no longer missing now, and
- half futile attempt to use src/sys/sys/exec_elf.h via nbincludes in
  tools involving libelf instead of libelf's elfdefinitions.h, which
  collides.

Longer-term, we may wish to unify sys/exec_elf.h and libelf's
elfdefinitions.h, so we don't have to play these games.

But at least now the games are limited to three .c files (one of
which is generated by Makefile.ioctl-c), rather than haphazardly
applied tree-wide by monstrous kludges in widely used .h files with
broken hackarounds to get the tools build lurching to completion.
2024-04-01 18:33:22 +00:00
msaitoh 90313c06e6 Remove ryo@'s mail addresses. 2024-02-07 04:20:25 +00:00
kre 48827a0943 This needs <stdbool.h> - it used to come from <sys/rbtree.h> (inappropriately)
but no longer (normally).    This should unbreak the builds.
2024-01-02 22:35:26 +00:00
msaitoh db06c1e0c0 tprof(8): Add support for Skylake-X and Cascade Lake. 2023-07-07 04:43:15 +00:00
msaitoh 068060949b Modify comment. No functional change. 2023-07-07 04:37:03 +00:00
gutteridge d9d44b7ea1 tprof.8: fix typo, s/speficied/specified/ 2023-04-18 00:21:23 +00:00
uwe f5a0cd5ede tprof(8): fix markup nits 2023-04-17 21:51:40 +00:00
gutteridge 63184ef432 tprof.8: new sentence, new line 2023-04-17 21:46:12 +00:00
msaitoh 8dc7413669 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.
2023-04-17 08:37:24 +00:00
msaitoh 0132696ccc 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.
2023-04-17 07:13:35 +00:00
msaitoh e2b25c5d26 KNF. No functional change. 2023-04-12 02:15:51 +00:00
msaitoh e1e6315383 Add Cometlake support. 2023-04-10 06:08:55 +00:00
ryo 473c5ef3b0 fixed parsing of event options.
if event option was specivied, it was stuck in a busy loop.
2022-12-26 08:00:13 +00:00
ryoon 671f47e060 Reflect recent new options for top operation, add a and c 2022-12-26 03:25:55 +00:00
christos 073c713eeb use malloc instead of alloca so that SSP works. 2022-12-23 19:37:06 +00:00
ryo 63a85c5bd2 the "scale" option can be specified in the event name even in "tprof monitor" 2022-12-16 08:02:04 +00:00
ryo 923aefa047 - added 'c' command to tprof-top to show/hide event counter.
- column widths were not calculated correctly and sometimes displayed incorrectly.
- use putp() for terminfo str.
- fix build error with llvm.
2022-12-16 08:00:47 +00:00
ryo 372d4eb272 if column width changes, the screen must be updated. 2022-12-09 02:19:07 +00:00
ryo 37e8e83852 supported AMD family added 2022-12-09 01:59:51 +00:00
ryo 2495b25d45 mainly fixes around display.
- use terminfo
- dynamically adjust column widths
- mode can be changed while running
2022-12-09 01:56:40 +00:00
ryo 38fd9876a2 add accumulative mode. "tprof top -a" 2022-12-09 01:55:46 +00:00
msaitoh db24b2c2b2 Add AMD family 19h (zen3 and zen4) support to tprof. 2022-12-08 05:29:27 +00:00
msaitoh f1f580f5a3 Use lowercase consistently for hexadecimal numbers. No functional change. 2022-12-08 02:12:18 +00:00
msaitoh f5823b203c KNF. No functional change. 2022-12-07 08:11:49 +00:00
ryo f8c9791718 fix build error with llvm 2022-12-05 05:02:45 +00:00
ryo e43c6d637e fix build error of printf format 2022-12-01 03:32:24 +00:00
ryo e93233db9a add "top" subcommand to tprof(8) 2022-12-01 00:43:27 +00:00
ryo 14ff263e51 split ksyms stuff into ksyms.[ch] 2022-12-01 00:41:10 +00:00
ryo 07a5918990 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'.
2022-12-01 00:40:05 +00:00
ryo caba1a6f47 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.
2022-12-01 00:32:52 +00:00
msaitoh 052df59bc6 Disable the unsupported events from the bit vector length in EAX. 2022-06-13 09:28:58 +00:00
msaitoh c07439c64e Add topdown-slots to Intel architectural performance monitoring version 1. 2022-06-13 07:40:58 +00:00
msaitoh 61a8c80144 Add note about tprof(4) for people like me who forget to load tprof_x86. 2022-05-25 06:17:19 +00:00
skrll 3064404475 Output alignement - give lwp 6 characters 2021-10-14 09:52:40 +00:00
jmcneill 2763548bcd Print the path that we failed to open on error 2021-01-30 11:46:25 +00:00
rin 2b36317ff7 Support aarch64eb; just works fine. 2020-11-17 10:47:17 +00:00
knakahara 0a27bcec22 Fix typo in a comment. 2020-04-17 03:15:50 +00:00
jmcneill eea38b83c1 Add AMD Family 15h to supported model list 2019-10-11 20:18:20 +00:00
jmcneill 1434425dff Add support for AMD Family 15h 2019-10-11 18:05:52 +00:00
maxv 0acc4e3e94 Add support for AMD Family 17h. 2019-05-29 17:09:17 +00:00
kre 4b0905d49c Fix merge botch. 2019-01-27 05:12:30 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
knakahara 4ed6c77e42 tprof: Add goldmont plus support. Tested by msaitoh@n.o, thanks. 2018-11-26 23:20:56 +00:00
knakahara 4fd01caa16 tprof: Add goldmont support.
I tested on Atom C3558 (Denverton).
2018-11-26 07:45:47 +00:00
maxv 71256c3b0d Note support for Intel Silvermont/Airmont. 2018-11-20 06:43:26 +00:00
knakahara a8700cbec5 tprof: Add silvermont, airmont support.
I tested on Atom C2758 (Rangeley).
2018-11-15 07:20:31 +00:00
maxv 1b2a6113eb Add a "support" section. 2018-07-24 10:05:36 +00:00
maxv 8c9dd8d036 Use errx, there is no errno. 2018-07-24 09:50:37 +00:00
wiz b15bdb80e1 Various improvements to man page. Sync usage. 2018-07-18 16:50:05 +00:00
jmcneill 091e75868b Add ARMv7 support. 2018-07-15 23:50:53 +00:00