aboutsummaryrefslogtreecommitdiff
path: root/gprofng/common
diff options
context:
space:
mode:
Diffstat (limited to 'gprofng/common')
-rw-r--r--gprofng/common/config.h.in18
-rw-r--r--gprofng/common/core_pcbe.c4
-rw-r--r--gprofng/common/cpu_frequency.h8
-rw-r--r--gprofng/common/cpuid.c12
-rw-r--r--gprofng/common/gp-defs.h4
-rw-r--r--gprofng/common/gp-experiment.h62
-rw-r--r--gprofng/common/hwctable.c8
7 files changed, 54 insertions, 62 deletions
diff --git a/gprofng/common/config.h.in b/gprofng/common/config.h.in
index f8484f2..5f2c127 100644
--- a/gprofng/common/config.h.in
+++ b/gprofng/common/config.h.in
@@ -1,11 +1,17 @@
/* common/config.h.in. Generated from configure.ac by autoheader. */
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
/* Enable debugging output. */
#undef DEBUG
/* Enable java profiling */
#undef GPROFNG_JAVA_PROFILING
+/* Define to 1 if you have the <asm/hwprobe.h> header file. */
+#undef HAVE_ASM_HWPROBE_H
+
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
@@ -109,6 +115,18 @@
/* Version number of package */
#undef VERSION
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
/* Define to 1 if on MINIX. */
#undef _MINIX
diff --git a/gprofng/common/core_pcbe.c b/gprofng/common/core_pcbe.c
index 107a994..14080ab 100644
--- a/gprofng/common/core_pcbe.c
+++ b/gprofng/common/core_pcbe.c
@@ -2759,7 +2759,7 @@ core_pcbe_init (void)
return -1;
}
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
/* No Architectural Performance Monitoring Leaf returned by CPUID */
if (get_cpuid_info ()->cpi_maxeax < 0xa)
return (-1);
@@ -2918,7 +2918,7 @@ core_pcbe_cpuref (void)
{
#if defined(__aarch64__) || defined(__riscv)
return "";
-#elif defined(__i386__) || defined(__x86_64)
+#elif defined(__i386__) || defined(__x86_64__)
switch (cpuid_getmodel ())
{
case 60: /* Haswell */
diff --git a/gprofng/common/cpu_frequency.h b/gprofng/common/cpu_frequency.h
index 2371863..c6979c4 100644
--- a/gprofng/common/cpu_frequency.h
+++ b/gprofng/common/cpu_frequency.h
@@ -41,7 +41,7 @@ extern "C"
#define COL_CPUFREQ_SCALING 0x0001
#define COL_CPUFREQ_TURBO 0x0002
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
// XXXX This is a rough table to estimate frequency increment due to intel turbo boost.
// CPU with different stepping and different core number have different turbo increment.
// It is used internally here, and is not implemented on SPARC
@@ -129,7 +129,7 @@ extern "C"
{
char temp[1024];
int cpu = -1;
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
int model = -1;
int family = -1;
#endif
@@ -140,7 +140,7 @@ extern "C"
char *val = strchr (temp, ':');
cpu = val ? atoi (val + 1) : -1;
}
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
else if (strncmp (temp, "model", strlen ("model")) == 0
&& strstr (temp, "name") == 0)
{
@@ -241,7 +241,7 @@ extern "C"
frequency_scaling = 1;
if (tmpmhz > 1000)
{
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
if (family == 6)
{
// test turbo mode
diff --git a/gprofng/common/cpuid.c b/gprofng/common/cpuid.c
index 9e45233..f9f9046 100644
--- a/gprofng/common/cpuid.c
+++ b/gprofng/common/cpuid.c
@@ -18,7 +18,7 @@
Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
#include <cpuid.h> /* GCC-provided */
#elif defined(__aarch64__)
#if !defined(ATTRIBUTE_UNUSED)
@@ -48,8 +48,10 @@ __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
#include <sched.h>
#include <sys/syscall.h>
#include <unistd.h>
+#ifdef HAVE_ASM_HWPROBE_H
#include <asm/hwprobe.h>
#endif
+#endif
/*
* Various routines to handle identification
@@ -91,7 +93,7 @@ typedef struct
} cpuid_info_t;
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
static uint_t
cpuid_vendorstr_to_vendorcode (char *vendorstr)
{
@@ -151,7 +153,7 @@ get_cpuid_info ()
Tprintf (DBG_LT0, "cpuid.c:%d read_cpuid_id() MIDR_EL1==0x%016x cpi_vendor=%d cpi_model=%d\n",
__LINE__, (unsigned int) reg, cpi->cpi_vendor, cpi->cpi_model);
-#elif defined(__i386__) || defined(__x86_64)
+#elif defined(__i386__) || defined(__x86_64__)
cpuid_regs_t regs;
my_cpuid (0, &regs);
cpi->cpi_maxeax = regs.eax;
@@ -188,7 +190,7 @@ get_cpuid_info ()
break;
}
#elif defined(__riscv)
- #ifndef __riscv_hwprobe
+ #if !defined(__riscv_hwprobe) || !defined(HAVE_ASM_HWPROBE_H)
cpi->cpi_vendor = 0;
cpi->cpi_family = 0;
cpi->cpi_model = 0;
@@ -208,7 +210,7 @@ get_cpuid_info ()
cpi->cpi_vendor = res.value;
cpi->cpi_family = 0;
cpi->cpi_model = 0;
- #endif
+ #endif
#endif
return cpi;
}
diff --git a/gprofng/common/gp-defs.h b/gprofng/common/gp-defs.h
index d6c9445..4b5d6fa 100644
--- a/gprofng/common/gp-defs.h
+++ b/gprofng/common/gp-defs.h
@@ -42,7 +42,7 @@
#if defined(sparc) || defined(__sparcv9)
#define ARCH_SPARC 1
-#elif defined(__i386__) || defined(__x86_64)
+#elif defined(__i386__) || defined(__x86_64__)
#define ARCH_Intel 1
#elif defined(__aarch64__)
#define ARCH_Aarch64 1
@@ -52,7 +52,7 @@
#error "Undefined platform"
#endif
-#if defined(__sparcv9) || defined(__x86_64) || defined(__aarch64__) || defined(__riscv)
+#if defined(__sparcv9) || defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)
#define WSIZE_64 1
#else
#define WSIZE_32 1
diff --git a/gprofng/common/gp-experiment.h b/gprofng/common/gp-experiment.h
index fab08f1..7abccdf 100644
--- a/gprofng/common/gp-experiment.h
+++ b/gprofng/common/gp-experiment.h
@@ -39,6 +39,23 @@
#define IS_DESC_EXPT(exptname) (strstr(exptname,DESCENDANT_EXPT_KEY) != NULL)
#define IS_FNDR_EXPT(exptname) (strstr(exptname,DESCENDANT_EXPT_KEY) == NULL)
+// environment variables that must be forwarded to libcollector
+#define SP_COLLECTOR_PARAMS "SP_COLLECTOR_PARAMS"
+#define SP_COLLECTOR_EXPNAME "SP_COLLECTOR_EXPNAME"
+#define SP_COLLECTOR_FOLLOW_SPEC "SP_COLLECTOR_FOLLOW_SPEC"
+#define SP_COLLECTOR_FOUNDER "SP_COLLECTOR_FOUNDER"
+#define SP_PRELOAD_STRINGS "SP_COLLECTOR_PRELOAD"
+#define LD_PRELOAD_STRINGS "LD_PRELOAD"
+#define SP_LIBPATH_STRINGS "SP_COLLECTOR_LIBRARY_PATH"
+#define LD_LIBPATH_STRINGS "LD_LIBRARY_PATH"
+#define JAVA_TOOL_OPTIONS "JAVA_TOOL_OPTIONS"
+#define COLLECTOR_JVMTI_OPTION "-agentlib:gp-collector"
+#define LIBGP_COLLECTOR "libgp-collector.so"
+#define GPROFNG_PRELOAD_LIBDIRS "GPROFNG_PRELOAD_LIBDIRS"
+#define SP_COLLECTOR_ORIGIN_COLLECT "SP_COLLECTOR_ORIGIN_COLLECT"
+#define SP_COLLECTOR_DEBUG "SP_COLLECTOR_DEBUG"
+#define SP_COLLECTOR_TRACELEVEL "SP_COLLECTOR_TRACELEVEL"
+
/* File name definitions */
#define SP_ARCHIVES_DIR "archives"
#define SP_ARCHIVE_LOG_FILE "archive.log"
@@ -86,70 +103,31 @@
/* records for log and loadobjects files */
/* note that these are in alphabetical order */
-#define SP_JCMD_ARCH "architecture"
#define SP_JCMD_ARCHIVE "archive_run"
-#define SP_JCMD_ARGLIST "arglist"
#define SP_JCMD_BLKSZ "blksz"
#define SP_JCMD_CERROR "cerror"
-#define SP_JCMD_CLASS_LOAD "class_load"
-#define SP_JCMD_CLASS_UNLOAD "class_unload"
#define SP_JCMD_COLLENV "collenv"
#define SP_JCMD_COMMENT "comment"
-#define SP_JCMD_CPUID "cpuid"
#define SP_JCMD_CWARN "cwarn"
-#define SP_JCMD_CWD "cwd"
-#define SP_JCMD_CVERSION "cversion"
-#define SP_JCMD_DATARACE "datarace"
-#define SP_JCMD_DEADLOCK "deadlock"
#define SP_JCMD_DELAYSTART "delay_start"
#define SP_JCMD_DESC_START "desc_start"
#define SP_JCMD_DESC_STARTED "desc_started"
-#define SP_JCMD_DVERSION "dversion"
#define SP_JCMD_EXEC_START "exec_start"
#define SP_JCMD_EXEC_ERROR "exec_error"
#define SP_JCMD_EXIT "exit"
-#define SP_JCMD_EXPT_DURATION "exp_duration"
#define SP_JCMD_FAKETIME "faketime"
-#define SP_JCMD_FN_LOAD "fn_load"
-#define SP_JCMD_FN_UNLOAD "fn_unload"
-#define SP_JCMD_FUN_MAP "fun_map"
-#define SP_JCMD_FUN_UNMAP "fun_unmap"
#define SP_JCMD_HEAPTRACE "heaptrace"
-#define SP_JCMD_HOSTNAME "hostname"
#define SP_JCMD_HWC_DEFAULT "hwc_default"
#define SP_JCMD_HW_COUNTER "hwcounter"
-#define SP_JCMD_HW_SIM_CTR "hwsimctr"
#define SP_JCMD_IOTRACE "iotrace"
-#define SP_JCMD_JCM_LOAD "jcm_load"
-#define SP_JCMD_JCM_UNLOAD "jcm_unload"
-#define SP_JCMD_JCM_MAP "jcm_map"
-#define SP_JCMD_JCM_UNMAP "jcm_unmap"
#define SP_JCMD_JTHREND "jthread_end"
#define SP_JCMD_JTHRSTART "jthread_start"
#define SP_JCMD_GCEND "gc_end"
#define SP_JCMD_GCSTART "gc_start"
#define SP_JCMD_JVERSION "jversion"
-//#define SP_JCMD_KPROFILE "kprofile" /* TBR */
#define SP_JCMD_LIMIT "limit"
#define SP_JCMD_LINETRACE "linetrace"
-#define SP_JCMD_LO_OPEN "lo_open"
-#define SP_JCMD_LO_CLOSE "lo_close"
-#define SP_JCMD_MOD_OPEN "mod_open"
-#define SP_JCMD_MPIEXP "MPIexperiment"
-#define SP_JCMD_MPI_NO_TRACE "MPI_no_trace"
-#define SP_JCMD_MPIOMPVER "mpi_openmpi_version"
-#define SP_JCMD_MPITRACEVER "mpi_trace_version"
-#define SP_JCMD_MPIPP "mpipp"
-#define SP_JCMD_MPIPPERR "mpipp_err"
-#define SP_JCMD_MPIPPWARN "mpipp_warn"
-#define SP_JCMD_MPISTATE "mpistate"
-#define SP_JCMD_MPITRACE "mpitrace" /* backwards compat only */
-#define SP_JCMD_MPVIEW "mpview"
-#define SP_JCMD_MSGTRACE "msgtrace"
#define SP_JCMD_NOIDLE "noidle"
-#define SP_JCMD_OMPTRACE "omptrace"
-#define SP_JCMD_OS "os"
-#define SP_JCMD_PAGESIZE "pagesize"
#define SP_JCMD_PAUSE "pause"
#define SP_JCMD_PAUSE_SIG "pause_signal"
#define SP_JCMD_PROFILE "profile"
@@ -158,21 +136,15 @@
#define SP_JCMD_SAMPLE "sample"
#define SP_JCMD_SAMPLE_PERIOD "sample_period"
#define SP_JCMD_SAMPLE_SIG "sample_signal"
-#define SP_JCMD_SEGMENT_MAP "seg_map"
-#define SP_JCMD_SEGMENT_UNMAP "seg_unmap"
#define SP_JCMD_SRCHPATH "search_path"
#define SP_JCMD_STACKBASE "stackbase"
-#define SP_JCMD_SUNPERF "sunperf"
#define SP_JCMD_SYNCTRACE "synctrace"
#define SP_JCMD_TERMINATE "terminate"
#define SP_JCMD_THREAD_PAUSE "thread_pause"
#define SP_JCMD_THREAD_RESUME "thread_resume"
-#define SP_JCMD_USERNAME "username"
#define SP_JCMD_VERSION "version"
-#define SP_JCMD_WSIZE "wsize"
/* strings naming memory-segments */
-#define SP_MAP_ANON "Anon"
#define SP_MAP_HEAP "Heap"
#define SP_MAP_STACK "Stack"
#define SP_MAP_SHMEM "SHMid"
diff --git a/gprofng/common/hwctable.c b/gprofng/common/hwctable.c
index 4b6f2a9..1ce365a 100644
--- a/gprofng/common/hwctable.c
+++ b/gprofng/common/hwctable.c
@@ -243,7 +243,7 @@ static Hwcentry papi_generic_list[] = {
{NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
};
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
/* Kernel profiling pseudo-chip, OBSOLETE (To support 12.3 and earlier, TBR) */
static Hwcentry kproflist[] = {
{"kcycles", "kcycles", 0, STXT ("KCPU Cycles"), PRELOADS_5, 1, ABST_NONE},
@@ -1216,7 +1216,7 @@ static Hwcentry amd_15h[] = {
{"insts1", "EX_retired_instr_w_excp_intr", 1, NULL, PRELOADS_8, 0, ABST_NONE},
{NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
};
-#endif /* __i386__ or __x86_64 */
+#endif /* __i386__ or __x86_64__ */
#define INIT_HWC(nm, mtr, cfg, ty) .name = (nm), .metric = (mtr), \
.config = (cfg), .type = ty, .use_perf_event_type = 1, \
@@ -1303,7 +1303,7 @@ static Hwcentry generic_list[] = {
{NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
};
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
#include "hwc_amd_zen3.h"
#include "hwc_amd_zen4.h"
#include "hwc_intel_icelake.h"
@@ -1332,7 +1332,7 @@ typedef struct
* If the string is not formatted that way, -h hi and -h lo will fail
*/
static cpu_list_t cputabs[] = {
-#if defined(__i386__) || defined(__x86_64)
+#if defined(__i386__) || defined(__x86_64__)
{CPC_PENTIUM_PRO_MMX, pentiumIIlist, {"insts", 0}},
{CPC_PENTIUM_PRO, pentiumIIIlist, {"insts", 0}},
{CPC_PENTIUM_4, pentium4, {"insts", 0}},