Commit Graph

26 Commits

Author SHA1 Message Date
Vladimir Mezentsev
004d348063 gprofng: add hardware counters for Neoverse-N1 and Ampere-1 processors
gprofng/ChangeLog
2024-10-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* common/hwc_cpus.h: New constant for Neoverse-N1 and Ampere-1.
	* common/hwctable.c: Add the hwc table for Neoverse-N1 and Ampere-1.
	* src/hwc_arm_ampere_1.h: New file with hwc table for Ampere-1.
	* src/hwc_arm_neoverse_n1.h: New file with hwc table for Neoverse-N1.
2024-10-07 18:41:36 -07:00
Vladimir Mezentsev
b79c457ca0 Fix 32097 Warnings when building gprofng with Clang
gprofng/ChangeLog
2024-09-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	PR gprofng/32097
	* common/hwcdrv.c: Fix -Wempty-body warnings.
	* common/hwcentry.h: Fix -Wdeprecated-non-prototype warnings.
	* common/hwctable.c: Fix -Wdeprecated-non-prototype warnings.
	* libcollector/collector.c: Likewise.
	* libcollector/collector.h: Likewise.
	* libcollector/collectorAPI.c: Likewise.
	* libcollector/dispatcher.c: Likewise.
	* libcollector/iotrace.c: Likewise.
	* libcollector/libcol_util.c: Fix -Wunused-but-set-variable warnings.
	* libcollector/libcol_util.h: Remove unused declarations.
	* libcollector/linetrace.c: Fix -Wdeprecated-non-prototype warnings.
	* src/BaseMetricTreeNode.h: Fix -Wunused-private-field warnings.
	* src/Dbe.cc: Fix -Wself-assign warnings.
	* src/DbeSession.cc: Fix -Wunused-but-set-variable warnings.
	* src/Disasm.cc: Fix -Wunused-const-variable warnings.
	* src/Experiment.cc: Fix -Wunused-private-field warnings.
	* src/HashMap.h: Fix -Wself-assign warnings.
	* src/IOActivity.h: Fix -Wunused-private-field warnings.
	* src/collctrl.cc: Fix -Wself-assign, -Wparentheses-equality warnings.
	* src/collctrl.h: Fix -Wunused-private-field warnings.
	* src/collector_module.h: Fix -Wdeprecated-non-prototype warnings.
	* src/gp-display-src.cc: Fix -Wunused-private-field warnings.
	* src/gp-print.h: Fix -Wheader-guard warnings.
	* src/hwc_intel_icelake.h: Fix -Winitializer-overrides warnings.
	* src/util.cc: Fix -Wunused-but-set-variable warnings.
2024-09-04 13:49:21 -07:00
Vladimir Mezentsev
4456cb827f gprofng: add hardware counters for Appliedmicro processor
gprofng/ChangeLog
2024-08-15  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* common/hwc_cpus.h: New constant for Appliedmicro processor.
	* common/hwctable.c: Add the hwc table for Appliedmicro processor.
	* src/hhwc_arm64_amcc.h: New file.
	* src/collctrl.cc (read_int): Use strtol instead of atoi.
2024-08-19 17:26:20 -07:00
Yixuan Chen
762c38d552 RISC-V:[gprofng] Minimal support gprofng for riscv.
ChangeLog: Add target riscv to --enable-gprofng.

2024-07-04  Yixuan Chen  <chenyixuan@iscas.ac.cn>

        * configure: Add riscv.
        * configure.ac: Add riscv.

gprofng/ChangeLog: Minimal support gprofng for riscv.

2024-07-04  Yixuan Chen  <chenyixuan@iscas.ac.cn>

        * gprofng/common/core_pcbe.c (core_pcbe_init): Add RISC-V vendor conditon.
        (defined): Add riscv.
        * gprofng/common/cpuid.c (defined): Add risc-v hwprobe.
        * gprofng/common/gp-defs.h (TOK_A_RISCV): Add riscv.
        (defined): Add riscv.
        (ARCH_RISCV): Add riscv.
        * gprofng/common/hwc_cpus.h: Add RISC-V vendor.
        * gprofng/common/hwcfuncs.h (HW_INTERVAL_TYPE): Remove useless defination.
        * gprofng/configure: Add riscv.
        * gprofng/configure.ac: Add riscv.
        * gprofng/libcollector/hwprofile.h (ARCH): Add RISC-V register.
        (CONTEXT_PC): Add RISC-V register.
        (CONTEXT_FP): Add RISC-V register.
        (CONTEXT_SP): Add RISC-V register.
        (SETFUNCTIONCONTEXT):
        * gprofng/libcollector/libcol_util.c (__collector_util_init): Fix libc open condition.
        * gprofng/libcollector/libcol_util.h (ARCH): Add RISC-V.
        * gprofng/libcollector/unwind.c (ARCH): Add RISC-V register.
        (GET_PC): Add RISC-V register.
        (GET_SP): Add RISC-V register.
        (GET_FP): Add RISC-V register.
        (FILL_CONTEXT):
        * gprofng/src/DbeSession.cc (ARCH): Add RISC-V.
        * gprofng/src/Disasm.cc (Disasm::disasm_open): Add RISC-V.
        * gprofng/src/Experiment.cc (Experiment::ExperimentHandler::startElement): Add RISC-V.
        * gprofng/src/checks.cc (ARCH): Add RISC-V.
        * gprofng/src/collctrl.cc (defined): Set risc-v cpu frequency to 1000MHz as default for now, will fix when I find a better method to get cpu frequency.
        (read_cpuinfo): Add "mvendorid" condition according to risc-v /proc/cpuinfo file content.
        * gprofng/src/dbe_types.h (enum Platform_t): Add RISC-V.
2024-07-10 15:16:03 -07:00
Vladimir Mezentsev
971ae1844e gprofng: add hardware counters for Intel Ice Lake processor
gprofng/ChangeLog
2024-07-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* common/hwc_cpus.h: New constant for Intel Ice Lake processor.
	* common/hwcdrv.c: Add a new argument to hwcfuncs_get_x86_eventsel.
	Set config1 in perf_event_attr. Remove the use of memset.
	* common/core_pcbe.c (core_pcbe_get_eventnum): Return 0.
	* common/hwcentry.h: Add config1.
	* src/collctrl.cc (Coll_Ctrl::build_data_desc):Set config1.
	* common/hwcfuncs.c (process_data_descriptor): Set config1.
	* common/hwctable.c: Add the hwc table for Intel Ice Lake processor.
	* src/hwc_intel_icelake.h: New file.
2024-07-09 10:50:05 -07:00
Vladimir Mezentsev
9af067bfcd gprofng: add hardware counters for AMD Zen4
ChangeLog
2024-06-01  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* common/hwctable.c: Add the hwc table for AMD Zen4.
	* src/hwc_amd_zen4.h: New file.
	* src/hwc_amd_zen3.h: Define _HWC_AMD_ZEN3_H.
2024-06-03 11:38:58 -07:00
Vladimir Mezentsev
aea1188a25 gprofng: Remove hardware counter tables for unsupported hardware (Sparc)
ChangeLog
2024-05-20  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/31123
	* common/hwctable.c: Remove hardware counter tables for Sparc machines.
2024-05-21 19:54:58 -07:00
Vladimir Mezentsev
ee7af0e710 gprofng: add hardware counters for AMD Zen3
Historically, we have used several APIs (perfctr, libcpc, perf_event_open) for profiling.
For each hardware we have several tables of hardware counters.
Some information is duplicated in these tables.
Some of the information is no longer used.
I did not touch the existing hwc tables.
I added a new hwc table for an AMD Zen3 machine.

ChangeLog
2024-05-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/31123
	* common/core_pcbe.c (core_pcbe_get_events): Add new argument.
	* common/hwc_cpus.h: New constants for AMD hardware.
	* common/hwcdrv.c: Add new argument to hwcdrv_get_descriptions.
	Clean up the code.
	* common/hwcdrv.h: Likewise.
	* common/hwcfuncs.c (hwcdrv_get_descriptions): Add new argument.
	* common/hwctable.c: Add the hwc table for AMD Zen3.
	* src/hwc_amd_zen3.h: New file.
	* common/opteron_pcbe.c: Add new argument to opt_pcbe_get_events.
	* src/collctrl.cc: Remove unused variable.
	* src/collctrl.h: Likewise.
2024-05-17 18:28:05 -07:00
Vladimir Mezentsev
663741df74 gprofng: remove old interface with libcpc
interface with libcpc was used on Solaris.
gprofng doesn't support profiling on Solaris.
I removed this old code and other unused macros and variables.

gprofng/ChangeLog
2024-04-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/31123
	* common/hwcdrv.c: remove old interface with libcpc.
	* common/hwcdrv.h: Likewise.
	* common/hwcentry.h: Likewise.
	* common/hwcfuncs.c: Likewise.
	* common/hwcfuncs.h: Likewise.
	* common/hwctable.c: Likewise.
	* src/Dbe.cc: Likewise.
	* src/collctrl.cc: Likewise.
2024-05-17 18:28:03 -07:00
Vladimir Mezentsev
f8c018bcd4 gprofng: Add hardware counter profiling for the Ampere system
gprofng should recognize Ampere and other ARM systems.

gprofng/ChangeLog
2024-02-22  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* common/hwc_cpus.h: Declare the enum values ARM_CPU_IMP_*.
	* common/core_pcbe.c (core_pcbe_init): Accept new systems ARM_CPU_IMP_*.
2024-02-25 17:30:35 -08:00
Vladimir Mezentsev
b3c670a6ba gprofng: Remove unused macros
gprofng/ChangeLog
2024-02-01  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* common/gp-experiment.h: Remove SP_REMOTE_PROTOCOL_VERSION.
	* common/hwctable.c: Remove DBG_LT* macros.
	* libcollector/envmgmt.c: Likewise.
	* libcollector/hwprofile.c: Likewise.
	* libcollector/iolib.c: Likewise.
	* libcollector/jprofile.c: Likewise.
	* libcollector/memmgr.c: Likewise.
	* libcollector/profile.c: Likewise.
	* libcollector/tsd.c: Likewise.
	* libcollector/unwind.c: Likewise.
2024-02-01 13:22:52 -08:00
Vladimir Mezentsev
8fe04eeb2c gprofng: 31123 improvements to hardware event implementation
Our hardware counter profiling is based on perf_event_open().
Our HWC tables are absent for new machines.
I have added HWC tables for the following events: PERF_TYPE_HARDWARE,
PERF_TYPE_SOFTWARE, PERF_TYPE_HW_CACHE. Other events require additional fixes.

Did a little cleaning: marked the symbols as static, used Stringbuilder,
created a function to read /proc/cpuinfo.

gprofng/ChangeLog
2024-01-08  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/31123
	* common/core_pcbe.c: Mark the symbols as static. Add events_generic[].
	* common/hwc_cpus.h: Declare a new function read_cpuinfo.
	* common/hwcdrv.c: Add a new parameter in init_perf_event().
	* common/hwcentry.h: Add use_perf_event_type in Hwcentry.
	* common/hwcfuncs.c (process_data_descriptor): Read use_perf_event_type,
	type, config.
	* common/hwctable.c: Add a new HWC table generic_list[].
	* common/opteron_pcbe.c (opt_pcbe_init): Accept AMD machines.
	* src/collctrl.cc: Use StringBuilder in Coll_Ctrl::build_data_desc().
	Add a new function read_cpuinfo.
2024-01-10 09:31:08 -08:00
Alan Modra
fd67aa1129 Update year range in copyright notice of binutils files
Adds two new external authors to etc/update-copyright.py to cover
bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then
updates copyright messages as follows:

1) Update cgen/utils.scm emitted copyrights.
2) Run "etc/update-copyright.py --this-year" with an extra external
   author I haven't committed, 'Kalray SA.', to cover gas testsuite
   files (which should have their copyright message removed).
3) Build with --enable-maintainer-mode --enable-cgen-maint=yes.
4) Check out */po/*.pot which we don't update frequently.
2024-01-04 22:58:12 +10:30
Vladimir Mezentsev
576d2c97d8 gprofng: fix build problems on linux-musl
ino64_t, off64_t, fpos64_t, stat64, __u64 are not defined on linux-musl.
Fixed by declaring these types for linux-musl.

2023-12-21  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/30779
	PR gprofng/29593
	* common/gp-defs.h: Define ino64_t, off64_t, fpos64_t for linux-musl.
	* libcollector/unwind.c: Define __u64 for linux-musl.
	* src/util.h: Define dbe_stat_t.
	* src/ClassFile.cc: Use dbe_stat_t instead of "struct stat64".
	* src/Dbe.cc: Likewise.
	* src/DbeFile.cc: Likewise.
	* src/DbeFile.h: Likewise.
	* src/DbeSession.cc: Likewise.
	* src/Experiment.cc: Likewise.
	* src/checks.cc: Likewise.
	* src/util.cc: Likewise.
2023-12-22 21:10:36 -08:00
Alan Modra
76bdc7266a Update year range in gprofng copyright notices
This adds 'Innovative Computing Labs' as an external author to
update-copyright.py, to cover the copyright notice in
gprofng/common/opteron_pcbe.c, and uses that plus another external
author 'Oracle and' to update gprofng copyright dates.  I'm not going
to commit 'Oracle and' as an accepted author, but that covers the
string "Copyright (c) 2006, 2012, Oracle and/or its affiliates. All
rights reserved." found in gprofng/testsuite/gprofng.display/jsynprog
files.
2023-01-01 23:26:30 +10:30
Vladimir Mezentsev
309b9a1abf gprofng: PR29646 Various warnings
gprofng/ChangeLog
2022-12-19  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/29646
	* common/core_pcbe.c: Fix missingReturn warning.
	* libcollector/iolib.c: Fix -Waddress warnings.
	* src/Settings.cc: Likewise.
	* src/checks.cc: Likewise.
	* libcollector/linetrace.c: Likewise.
	* libcollector/iotrace.c: Fix va_end_missing error.
	* libcollector/libcol_util.c: Fix uninitvar warning.
	* src/Command.cc: Fix arrayIndexOutOfBounds error.
	* src/Function.cc: Fix uninitStructMember warning.
	* src/ipc.cc: Fix -Wwrite-strings warnings.
2022-12-19 17:02:29 -08:00
Vladimir Mezentsev
0d94a87350 gprofng: fix cppcheck warnings
gprofng/ChangeLog
2022-09-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* common/hwcdrv.c: Fix cppcheck warning.
	* src/ABS.h: Likewise.
	* src/CompCom.cc: Likewise.
2022-09-29 22:00:02 -07:00
Vladimir Mezentsev
fe39ffdc20 gprofng: fix build issues on musl
gprofng/ChangeLog
2022-09-14  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/29477
	* configure.ac: Set __MUSL_LIBC.
	* configure: Rebuild.
	* common/config.h.in: Rebuild.
	* src/collector_module.h: Fix compiler errors because mmap64, open64,
	pwrite64 are macros and getcontext() is absent on musl.
	* libcollector/collector.c: Likewise.
	* libcollector/hwprofile.c: Likewise.
	* libcollector/iolib.c: Likewise.
	* libcollector/libcol_util.c: Likewise.
	* libcollector/linetrace.c: Likewise.
	* libcollector/memmgr.c: Likewise.
	* libcollector/profile.c: Likewise.
	* libcollector/unwind.c: Likewise.
	* libcollector/dispatcher.c: Likewise.
	* src/Experiment.cc: Likewise.
	* libcollector/collector.h: Use dlsym() because dlvsym() is not defined
	on musl.
	* libcollector/iotrace.c: Remove interposition of versioned functions.
	* libcollector/mmaptrace.c: Likewise.
	* libcollector/libcol_util.h: Fix -Wint-to-pointer-cast warnings.
	* libcollector/jprofile.c: Likewise.
	* libcollector/synctrace.c: Include "collector.h".
	* src/Print.cc: Use get_basename() because basename() is not defined
	on musl.
	* common/hwcdrv.c: Fix -Wformat= warnings.
2022-09-14 18:38:09 -07:00
Vladimir Mezentsev
e4d04cb306 gprofng: fix regression in build and a race condition in autoreconf
gprofng/ChangeLog
2022-07-14  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/29338
	* libcollector/configure.ac (AC_CONFIG_HEADERS): Fix a race condition.
	* libcollector/configure: Rebuild.
	* libcollector/Makefile.in: Rebuild.
	* common/config.h.in: Rebuild.
	* common/lib-config.h.in: Created by autoreconf.
2022-07-18 10:41:10 -07:00
Alan Modra
b95830931f Regenerate with automake-1.15.1
Until we update the recommended versions of autoconf/automake, files
should be regenerated with automake-1.15.1 and autoconf-2.69.  That's
not because we think those versions are golden, and newer versions are
bad.  It's simply because maintainers want to be able to update
configury files without trouble, and if someone regenerates files with
automake-1.16.5 then --enable-maintainer-mode builds will hit errors:

checking that generated files are newer than configure... configure.ac:26: error: version mismatch.  This is Automake 1.15.1,
configure.ac:26: but the definition used by this AM_INIT_AUTOMAKE
configure.ac:26: comes from Automake 1.16.5.  You should recreate
configure.ac:26: aclocal.m4 with aclocal and run automake again.
WARNING: 'automake-1.15' is probably too old.

Correcting this requires regenerating the files by hand.
2022-07-09 20:10:47 +09:30
Nick Clifton
631ec08cb1 Update version to 2.39.50 and regenerate files 2022-07-08 11:19:44 +01:00
Vladimir Mezentsev
14e283ff4e gprofng: fix build with -Werror=format-truncation
gprofng/ChangeLog
2022-06-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* configure.ac: Remove -Wno-format-truncation.
	* src/Makefile.am: Likewise.
	* configure: Rebuild.
	* src/Makefile.in: Rebuild.
	* common/hwctable.c: Fix -Werror=format-truncation errors.
	* src/ipc.cc: Likewise.
	* src/parse.cc: Likewise.
2022-06-16 20:44:24 -07:00
Vladimir Mezentsev
a675e77e55 gprofng docs: provide help for <rate> == <interval>
The help message from 'gprofng collect app -h', in
the section on <rate> == <interval>, had a dangling
reference to a non-existent manpage. Provide basic
info, including reasons for caution.
2022-06-14 14:16:24 -07:00
H.J. Lu
c5edd3b884 gprofng: Define ATTRIBUTE_FALLTHROUGH
Define ATTRIBUTE_FALLTHROUGH to __attribute__ ((fallthrough)) only for
GCC 7 or above.

	PR gprof/28969
	* common/gp-defs.h (ATTRIBUTE_FALLTHROUGH): New.
	* src/gp-collect-app.cc (collect::check_args): Replace
	/* FALLTHROUGH */ with ATTRIBUTE_FALLTHROUGH.
2022-03-16 06:42:51 -07:00
Nick Clifton
4ec39c4bca gprofng: Add a configure test for clock_gettime and a use of the test in getthrtime.c 2022-03-15 15:21:56 +00:00
Vladimir Mezentsev
bb368aad29 gprofng: a new GNU profiler
top-level
	* Makefile.def: Add gprofng module.
	* configure.ac: Add --enable-gprofng option.
	* src-release.sh: Add gprofng.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* gprofng: New directory.

binutils
	* MAINTAINERS: Add gprofng maintainer.
	* README-how-to-make-a-release: Add gprofng.

include.
	* collectorAPI.h: New file.
	* libcollector.h: New file.
	* libfcollector.h: New file.
2022-03-11 08:58:31 +00:00