summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac6
-rw-r--r--docs/users_guide/7.12.1-notes.rst2
-rw-r--r--includes/rts/Flags.h26
-rw-r--r--mk/config.mk.in6
-rw-r--r--rts/Papi.c396
-rw-r--r--rts/Papi.h36
-rw-r--r--rts/RtsFlags.c71
-rw-r--r--rts/RtsStartup.c13
-rw-r--r--rts/Stats.c48
-rw-r--r--rts/Stats.h8
-rw-r--r--rts/ghc.mk27
-rw-r--r--rts/package.conf.in9
-rw-r--r--rts/posix/GetTime.c29
-rw-r--r--rts/sm/GC.c18
-rw-r--r--rts/sm/GCThread.h12
15 files changed, 16 insertions, 691 deletions
diff --git a/configure.ac b/configure.ac
index 84f381ec17..1e43896727 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1006,12 +1006,6 @@ AC_COMPILE_IFELSE(
])
-dnl ** checking for PAPI
-AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
-AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
-AC_SUBST(HavePapiLib)
-AC_SUBST(HavePapiHeader)
-
AC_CHECK_FUNCS(__mingw_vfprintf)
if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
diff --git a/docs/users_guide/7.12.1-notes.rst b/docs/users_guide/7.12.1-notes.rst
index bd4f78bcaa..10ed77eaf3 100644
--- a/docs/users_guide/7.12.1-notes.rst
+++ b/docs/users_guide/7.12.1-notes.rst
@@ -175,7 +175,7 @@ Template Haskell
Runtime system
~~~~~~~~~~~~~~
-- TODO FIXME.
+- Support for performance monitoring with PAPI has been dropped.
Build system
~~~~~~~~~~~~
diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h
index 1440b14a37..878e0f111a 100644
--- a/includes/rts/Flags.h
+++ b/includes/rts/Flags.h
@@ -213,29 +213,6 @@ typedef struct _TICKY_FLAGS {
FILE *tickyFile;
} TICKY_FLAGS;
-#ifdef USE_PAPI
-#define MAX_PAPI_USER_EVENTS 8
-
-/* See Note [Synchronization of flags and base APIs] */
-typedef struct _PAPI_FLAGS {
- nat eventType; /* The type of events to count */
- nat numUserEvents;
- char * userEvents[MAX_PAPI_USER_EVENTS];
- /* Allow user to enter either PAPI preset or native events */
- nat userEventsKind[MAX_PAPI_USER_EVENTS];
-} PAPI_FLAGS;
-
-#define PAPI_FLAG_CACHE_L1 1
-#define PAPI_FLAG_CACHE_L2 2
-#define PAPI_FLAG_BRANCH 3
-#define PAPI_FLAG_STALLS 4
-#define PAPI_FLAG_CB_EVENTS 5
-#define PAPI_USER_EVENTS 6
-#define PAPI_PRESET_EVENT_KIND 0
-#define PAPI_NATIVE_EVENT_KIND 1
-
-#endif
-
/* Put them together: */
/* See Note [Synchronization of flags and base APIs] */
@@ -253,9 +230,6 @@ typedef struct _RTS_FLAGS {
#if defined(THREADED_RTS)
PAR_FLAGS ParFlags;
#endif
-#ifdef USE_PAPI
- PAPI_FLAGS PapiFlags;
-#endif
} RTS_FLAGS;
#ifdef COMPILING_RTS_MAIN
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 035443a5fd..f9394429bf 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -339,12 +339,6 @@ LAX_DEPENDENCIES = NO
GhcRtsHcOpts=-O2
GhcRtsCcOpts=-O2 -fomit-frame-pointer -g
-# Include support for CPU performance counters via the PAPI library in the RTS?
-# (PAPI: http://icl.cs.utk.edu/papi/)
-GhcRtsWithPapi = NO
-PapiLibDir=
-PapiIncludeDir=
-
# Configuration for libffi
UseSystemLibFFI=@UseSystemLibFFI@
# Flags to go into package.conf for rts
diff --git a/rts/Papi.c b/rts/Papi.c
deleted file mode 100644
index a36157f4c1..0000000000
--- a/rts/Papi.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/* -----------------------------------------------------------------------------
- * (c) The GHC Team 2006
- *
- * Initialization and use of the PAPI performance monitoring library
- *
- *
- * For adding events or add your processor counters modify
- *
- * init_countable_events
- * papi_report
- *
- * ---------------------------------------------------------------------------*/
-
-
-#ifdef USE_PAPI /* ugly */
-
-#include <papi.h>
-/* The posix symbols get defined in a header included from papi.h.
- * undefind them here to allow redefinition in PosixSource.h */
-#undef _POSIX_SOURCE
-#undef _POSIX_C_SOURCE
-#undef _XOPEN_SOURCE
-
-#include "PosixSource.h"
-#include "Rts.h"
-
-#include "RtsUtils.h"
-#include "Stats.h"
-#include "Papi.h"
-
-// used to protect the aggregated counters
-#ifdef THREADED_RTS
-static Mutex papi_counter_mutex;
-#endif
-
-struct _papi_events {
- int event_code;
- const char * event_name;
-};
-
-/* Beware, these counters are Opteron specific
- * I obtained the numbers using the papi_avail
- * and papi_native_avail utilities.
- * This is certainly not the official PAPI way
- * of doing things.
- */
-#define FR_BR 0x40000040
-#define FR_BR_MIS 0x40000041
-#define FR_BR_MISCOMPARE 0x40000048
-#define DC_ACCESS 0x40000019
-#define DC_MISS 0x4000001a
-#define FR_DISPATCH_STALLS 0x40000054
-#define FR_DISPATCH_STALLS_BR 0x40000055
-#define FR_DISPATCH_STALLS_FULL_REORDER 0x40000058
-#define FR_DISPATCH_STALLS_FULL_RESERVATION 0x40000059
-#define FR_DISPATCH_STALLS_FULL_LS 0x4000005b
-#define DC_L2_REFILL_MOES 0x40001e1b
-#define DC_SYS_REFILL_MOES 0x40001e1c
-
-/* This is bad, it should be in a header */
-#define BIG_STRING_LEN 512
-
-
-#define PAPI_CHECK(CALL) \
- if((papi_error=(CALL)) != PAPI_OK) { \
- debugBelch("PAPI function failed in module %s at line %d " \
- "with error code %d\n", \
- __FILE__,__LINE__,papi_error); \
- }
-
-/* While PAPI reporting is going on this flag is on */
-int papi_is_reporting;
-
-/* Event sets and counter arrays for GC and mutator */
-
-int MutatorEvents = PAPI_NULL;
-int GCEvents = PAPI_NULL;
-
-int papi_error;
-
-/* Arbitrary, to avoid using malloc */
-#define MAX_PAPI_EVENTS 10
-static char papiNativeEventNames[MAX_PAPI_EVENTS][PAPI_MAX_STR_LEN];
-
-static nat n_papi_events = 0;
-
-
-/* Events counted during GC and Mutator execution */
-/* There's a trailing comma, do all C compilers accept that? */
-static struct _papi_events papi_events[MAX_PAPI_EVENTS];
-long_long MutatorCounters[MAX_PAPI_EVENTS];
-long_long GC0Counters[MAX_PAPI_EVENTS];
-long_long GC1Counters[MAX_PAPI_EVENTS];
-
-long_long start_mutator_cycles;
-long_long mutator_cycles = 0;
-long_long start_gc_cycles;
-long_long gc0_cycles = 0;
-long_long gc1_cycles = 0;
-
-
-
-static long_long papi_counter(long_long values[],int event);
-static void papi_add_events(int EventSet);
-
-static nat max_hardware_counters = 2;
-
-/* If you want to add events to count, extend the
- * init_countable_events and the papi_report function.
- * Be aware that your processor can count a limited number
- * of events simultaneously, you can turn on multiplexing
- * to increase that number, though.
- */
-static void papi_add_event(const char *name, int code)
-{
- if (n_papi_events >= max_hardware_counters) {
- errorBelch("too many PAPI events for this CPU (max: %d)",
- max_hardware_counters);
- stg_exit(EXIT_FAILURE);
- }
- papi_events[n_papi_events].event_code = code;
- papi_events[n_papi_events].event_name = name;
- n_papi_events++;
-}
-
-static void
-init_countable_events(void)
-{
- max_hardware_counters = PAPI_num_counters();
-
-#define PAPI_ADD_EVENT(EVENT) papi_add_event(#EVENT,EVENT)
-
- if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_BRANCH) {
- PAPI_ADD_EVENT(FR_BR);
- PAPI_ADD_EVENT(FR_BR_MIS);
- // Docs are wrong? Opteron does not count indirect branch
- // misses exclusively
- PAPI_ADD_EVENT(FR_BR_MISCOMPARE);
- } else if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_STALLS) {
- PAPI_ADD_EVENT(FR_DISPATCH_STALLS);
- PAPI_ADD_EVENT(FR_DISPATCH_STALLS_BR);
- PAPI_ADD_EVENT(FR_DISPATCH_STALLS_FULL_LS);
- } else if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_CACHE_L1) {
- PAPI_ADD_EVENT(PAPI_L1_DCA);
- PAPI_ADD_EVENT(PAPI_L1_DCM);
- } else if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_CACHE_L2) {
- PAPI_ADD_EVENT(PAPI_L2_DCA);
- PAPI_ADD_EVENT(PAPI_L2_DCM);
- } else if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_CB_EVENTS) {
- PAPI_ADD_EVENT(DC_L2_REFILL_MOES);
- PAPI_ADD_EVENT(DC_SYS_REFILL_MOES);
- PAPI_ADD_EVENT(FR_BR_MIS);
- } else if (RtsFlags.PapiFlags.eventType==PAPI_USER_EVENTS) {
- nat i;
- char *name;
- char *asciiEventCode;
- int code;
- for (i = 0; i < RtsFlags.PapiFlags.numUserEvents; i++) {
- if(RtsFlags.PapiFlags.userEventsKind[i] == PAPI_PRESET_EVENT_KIND) {
- name = RtsFlags.PapiFlags.userEvents[i];
- PAPI_CHECK(PAPI_event_name_to_code(name, &code))
- }
- else { // PAPI_NATIVE_EVENT_KIND
- asciiEventCode = RtsFlags.PapiFlags.userEvents[i];
- name = papiNativeEventNames[i];
- code = strtol(asciiEventCode, NULL, 16 /* hex number expected */);
- PAPI_CHECK(PAPI_event_code_to_name(code, name))
- }
- papi_add_event(name, code);
- }
- } else {
- // PAPI_ADD_EVENT(PAPI_L1_DCA); // L1 data cache accesses
- // PAPI_ADD_EVENT(PAPI_L1_ICR); // L1 instruction cache reads
- // PAPI_ADD_EVENT(PAPI_L1_ICM); // L1 instruction cache misses
- // PAPI_ADD_EVENT(PAPI_L1_STM); // L1 store misses
- // PAPI_ADD_EVENT(PAPI_L1_DCM); // L1 data cache misses
- // PAPI_ADD_EVENT(PAPI_L1_LDM); // L1 load misses
- // PAPI_ADD_EVENT(PAPI_L2_TCM); // L2 cache misses
- // PAPI_ADD_EVENT(PAPI_L2_STM); // L2 store misses
- // PAPI_ADD_EVENT(PAPI_L2_DCW); // L2 data cache writes
- // PAPI_ADD_EVENT(PAPI_L2_DCR); // L2 data cache reads
- // PAPI_ADD_EVENT(PAPI_L2_TCW); // L2 cache writes
- // PAPI_ADD_EVENT(PAPI_L2_TCR); // L2 cache reads
- // PAPI_ADD_EVENT(PAPI_CA_CLN); // exclusive access to clean cache line
- // PAPI_ADD_EVENT(PAPI_TLB_DM); // TLB misses
- PAPI_ADD_EVENT(PAPI_TOT_INS); // Total instructions
- PAPI_ADD_EVENT(PAPI_TOT_CYC); // Total instructions
- // PAPI_ADD_EVENT(PAPI_CA_SHR); // exclusive access to shared cache line
- // PAPI_ADD_EVENT(PAPI_RES_STL); // Cycles stalled on any resource
-
- }
-
- // We might also consider:
- // PAPI_BR_MSP Conditional branch instructions mispredicted
- // PAPI_RES_STL Cycles stalled on any resource
-};
-
-
-static void
-papi_report_event(const char *name, StgWord64 value)
-{
- static char temp[BIG_STRING_LEN];
- showStgWord64(value,temp,rtsTrue/*commas*/);
- statsPrintf(" %15s %15s\n", name, temp);
-}
-
-/* This function reports counters for GC and mutator */
-static void
-papi_report(long_long counters[])
-{
- nat i;
-
-/* Report the value of a counter as a percentage of another counter */
-#define PAPI_REPORT_PCT(EVENTSET,EVENT,EVENTTOT) \
- statsPrintf(" " #EVENT " %% of " #EVENTTOT " : %.1f%%\n", \
- papi_counter(EVENTSET,EVENT)*100.0/papi_counter(EVENTSET,EVENTTOT))
-
- for (i = 0; i < n_papi_events; i++)
- {
- papi_report_event(papi_events[i].event_name, counters[i]);
- }
-
- if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_BRANCH) {
- PAPI_REPORT_PCT(counters,FR_BR_MIS,FR_BR);
- PAPI_REPORT_PCT(counters,FR_BR_MISCOMPARE,FR_BR);
- }
-
- else if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_CACHE_L1) {
- PAPI_REPORT_PCT(counters,PAPI_L1_DCM,PAPI_L1_DCA);
- }
-
- else if (RtsFlags.PapiFlags.eventType==PAPI_FLAG_CACHE_L2) {
- PAPI_REPORT_PCT(counters,PAPI_L2_DCM,PAPI_L2_DCA);
- }
-}
-
-void
-papi_stats_report (void)
-{
- statsPrintf(" Mutator CPU counters\n");
- papi_report_event("CYCLES", mutator_cycles);
- papi_report(MutatorCounters);
-
- statsPrintf("\n GC(0) CPU counters\n");
- papi_report_event("CYCLES", gc0_cycles);
- papi_report(GC0Counters);
-
- statsPrintf("\n GC(1) CPU counters\n");
- papi_report_event("CYCLES", gc1_cycles);
- papi_report(GC1Counters);
-}
-
-void
-papi_init_eventset (int *event_set)
-{
- PAPI_register_thread();
- PAPI_CHECK( PAPI_create_eventset(event_set));
- papi_add_events(*event_set);
-}
-
-void
-papi_init (void)
-{
- /* Initialise the performance tracking library */
- int ver;
- if ((ver = PAPI_library_init(PAPI_VER_CURRENT)) != PAPI_VER_CURRENT) {
- if (ver > 0) {
- errorBelch("PAPI_library_init: wrong version: %x", ver);
- stg_exit(EXIT_FAILURE);
- } else {
- sysErrorBelch("PAPI_library_init");
- stg_exit(EXIT_FAILURE);
- }
- }
-
-#ifdef THREADED_RTS
- {
- int err;
- if ((err = PAPI_thread_init(osThreadId)) < 0) {
- barf("PAPI_thread_init: %d",err);
- }
-
- initMutex(&papi_counter_mutex);
- }
-#endif
-
- init_countable_events();
-
- papi_init_eventset(&MutatorEvents);
- papi_init_eventset(&GCEvents);
-}
-
-/* Extract the value corresponding to an event */
-static long_long
-papi_counter(long_long values[],int event)
-{
- nat i;
- for(i=0;i<n_papi_events;i++) {
- if(papi_events[i].event_code==event) {
- return values[i];
- }
- }
- /* Passed a wrong event? */
- debugBelch("Event %d is not part of event set\n",event);
- return 0;
-}
-
-/* Add the events of papi_events into an event set */
-static void
-papi_add_events(int EventSet)
-{
- nat i;
- for(i=0;i<n_papi_events;i++) {
- if((papi_error=PAPI_add_event(EventSet,
- papi_events[i].event_code))
- != PAPI_OK)
- debugBelch("Failed adding %s to event set with error code %d\n",
- papi_events[i].event_name,papi_error);
- }
-}
-
-/* We should be using elapsed cycles
- * to be consistent with time metric chosen in Stats.c (Elapsed time).
- * This is an approximation to the cycles that the program spends.
- * Note that the counters, in contrast, are virtual and user space.
- */
-#define PAPI_cycles PAPI_get_virt_cyc
-
-void
-papi_start_mutator_count(void)
-{
- ACQUIRE_LOCK(&papi_counter_mutex);
- PAPI_CHECK( PAPI_start(MutatorEvents));
- start_mutator_cycles = PAPI_cycles();
- RELEASE_LOCK(&papi_counter_mutex);
-}
-
-void
-papi_stop_mutator_count(void)
-{
- ACQUIRE_LOCK(&papi_counter_mutex);
- mutator_cycles += PAPI_cycles() - start_mutator_cycles;
- PAPI_CHECK( PAPI_accum(MutatorEvents,MutatorCounters));
- PAPI_CHECK( PAPI_stop(MutatorEvents,NULL));
- RELEASE_LOCK(&papi_counter_mutex);
-}
-
-void
-papi_start_gc_count(void)
-{
- ACQUIRE_LOCK(&papi_counter_mutex);
- PAPI_CHECK( PAPI_start(GCEvents));
- start_gc_cycles = PAPI_cycles();
- RELEASE_LOCK(&papi_counter_mutex);
-}
-
-void
-papi_stop_gc0_count(void)
-{
- ACQUIRE_LOCK(&papi_counter_mutex);
- PAPI_CHECK( PAPI_accum(GCEvents,GC0Counters));
- PAPI_CHECK( PAPI_stop(GCEvents,NULL));
- gc0_cycles += PAPI_cycles() - start_gc_cycles;
- RELEASE_LOCK(&papi_counter_mutex);
-}
-
-
-void
-papi_stop_gc1_count(void)
-{
- ACQUIRE_LOCK(&papi_counter_mutex);
- PAPI_CHECK( PAPI_accum(GCEvents,GC1Counters));
- PAPI_CHECK( PAPI_stop(GCEvents,NULL));
- gc1_cycles += PAPI_cycles() - start_gc_cycles;
- RELEASE_LOCK(&papi_counter_mutex);
-}
-
-
-void
-papi_thread_start_gc1_count(int event_set)
-{
- ACQUIRE_LOCK(&papi_counter_mutex);
- PAPI_CHECK( PAPI_start(event_set));
- RELEASE_LOCK(&papi_counter_mutex);
-}
-
-void
-papi_thread_stop_gc1_count(int event_set)
-{
- ACQUIRE_LOCK(&papi_counter_mutex);
- PAPI_CHECK( PAPI_accum(event_set,GC1Counters));
- PAPI_CHECK( PAPI_stop(event_set,NULL));
- RELEASE_LOCK(&papi_counter_mutex);
-}
-
-#endif /* USE_PAPI */
diff --git a/rts/Papi.h b/rts/Papi.h
deleted file mode 100644
index 97a9649f2d..0000000000
--- a/rts/Papi.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -----------------------------------------------------------------------------
- * (c) The GHC Team 2006
- *
- * Initialization and use of the PAPI performance monitoring library
- *
- * ---------------------------------------------------------------------------*/
-
-#ifndef PAPI_H
-#define PAPI_H
-
-#include "BeginPrivate.h"
-
-/* Check the error value of a PAPI call, reporting an error, if needed */
-extern int papi_error;
-
-/* While PAPI reporting is going on this flag is on */
-extern int papi_is_reporting;
-
-void papi_stats_report(void);
-void papi_init_eventset(int * event_set);
-void papi_init(void);
-void papi_start_mutator_count(void);
-void papi_stop_mutator_count(void);
-
-void papi_start_gc_count(void);
-void papi_stop_gc0_count(void);
-void papi_stop_gc1_count(void);
-
-// for multithreaded GC, each sub-thread uses these functions to count
-// events and aggregate them into the main GC counters.
-void papi_thread_start_gc1_count(int event_set);
-void papi_thread_stop_gc1_count(int event_set);
-
-#include "EndPrivate.h"
-
-#endif /* PAPI_H */
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index b9979bcf43..e3051287e6 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -103,10 +103,6 @@ static void read_debug_flags(const char *arg);
static rtsBool read_heap_profiling_flag(const char *arg);
#endif
-#ifdef USE_PAPI
-static void read_papi_flag(const char *arg);
-#endif
-
#ifdef TRACING
static void read_trace_flags(const char *arg);
#endif
@@ -251,12 +247,6 @@ void initRtsFlagsDefaults(void)
RtsFlags.TickyFlags.showTickyStats = rtsFalse;
RtsFlags.TickyFlags.tickyFile = NULL;
#endif
-
-#ifdef USE_PAPI
- /* By default no special measurements taken */
- RtsFlags.PapiFlags.eventType = 0;
- RtsFlags.PapiFlags.numUserEvents = 0;
-#endif
}
static const char *
@@ -422,19 +412,6 @@ usage_text[] = {
" -xm Base address to mmap memory in the GHCi linker",
" (hex; must be <80000000)",
#endif
-#if defined(USE_PAPI)
-" -aX CPU performance counter measurements using PAPI",
-" (use with the -s<file> option). X is one of:",
-"",
-/* " y - cycles", */
-" 1 - level 1 cache misses",
-" 2 - level 2 cache misses",
-" b - branch mispredictions",
-" s - stalled cycles",
-" e - cache miss and branch misprediction events",
-" +PAPI_EVENT - collect papi preset event PAPI_EVENT",
-" #NATIVE_EVENT - collect native event NATIVE_EVENT (in hex)",
-#endif
" -xq The allocation limit given to a thread after it receives",
" an AllocationLimitExceeded exception. (default: 100k)",
"",
@@ -790,13 +767,6 @@ error = rtsTrue;
/ BLOCK_SIZE;
break;
-#ifdef USE_PAPI
- case 'a':
- OPTION_UNSAFE;
- read_papi_flag(&rts_argv[arg])
- break;
-#endif
-
case 'B':
OPTION_UNSAFE;
RtsFlags.GcFlags.ringBell = rtsTrue;
@@ -1559,47 +1529,6 @@ static void read_debug_flags(const char* arg)
}
#endif
-#ifdef USE_PAPI
-static void read_papi_flags(const char *arg)
-{
- // Already parsed "-a"
- switch(arg[2]) {
- case '1':
- RtsFlags.PapiFlags.eventType = PAPI_FLAG_CACHE_L1;
- break;
- case '2':
- RtsFlags.PapiFlags.eventType = PAPI_FLAG_CACHE_L2;
- break;
- case 'b':
- RtsFlags.PapiFlags.eventType = PAPI_FLAG_BRANCH;
- break;
- case 's':
- RtsFlags.PapiFlags.eventType = PAPI_FLAG_STALLS;
- break;
- case 'e':
- RtsFlags.PapiFlags.eventType = PAPI_FLAG_CB_EVENTS;
- break;
- case '+':
- case '#':
- if (RtsFlags.PapiFlags.numUserEvents >= MAX_PAPI_USER_EVENTS) {
- errorBelch("maximum number of PAPI events reached");
- stg_exit(EXIT_FAILURE);
- }
- nat eventNum = RtsFlags.PapiFlags.numUserEvents++;
- char kind = arg[2];
- nat eventKind =
- kind == '+' ? PAPI_PRESET_EVENT_KIND : PAPI_NATIVE_EVENT_KIND;
-
- RtsFlags.PapiFlags.userEvents[eventNum] = arg + 3;
- RtsFlags.PapiFlags.eventType = PAPI_USER_EVENTS;
- RtsFlags.PapiFlags.userEventsKind[eventNum] = eventKind;
- break;
- default:
- bad_option( arg );
- }
-}
-#endif
-
#ifdef PROFILING
// Parse a "-h" flag, returning whether the parse resulted in an error.
static rtsBool read_heap_profiling_flag(const char *arg)
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 35e52aa36e..ac4460e329 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -6,11 +6,6 @@
*
* ---------------------------------------------------------------------------*/
-// PAPI uses caddr_t, which is not POSIX
-#ifndef USE_PAPI
-#include "PosixSource.h"
-#endif
-
#include "Rts.h"
#include "RtsAPI.h"
#include "HsFFI.h"
@@ -60,10 +55,6 @@
#include <locale.h>
#endif
-#if USE_PAPI
-#include "Papi.h"
-#endif
-
// Count of how many outstanding hs_init()s there have been.
static int hs_init_count = 0;
@@ -168,10 +159,6 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
/* Initialise the stats department, phase 1 */
initStats1();
-#ifdef USE_PAPI
- papi_init();
-#endif
-
/* initTracing must be after setupRtsFlags() */
#ifdef TRACING
initTracing();
diff --git a/rts/Stats.c b/rts/Stats.c
index 71cb29c3f7..4c06b18491 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -20,10 +20,6 @@
#include "sm/GCThread.h"
#include "sm/BlockAlloc.h"
-#if USE_PAPI
-#include "Papi.h"
-#endif
-
/* huh? */
#define BIG_STRING_LEN 512
@@ -71,6 +67,7 @@ static Time *GC_coll_cpu = NULL;
static Time *GC_coll_elapsed = NULL;
static Time *GC_coll_max_pause = NULL;
+static void statsPrintf( char *s, ... ) GNUC3_ATTRIBUTE(format (PRINTF, 1, 2));
static void statsFlush( void );
static void statsClose( void );
@@ -210,17 +207,6 @@ void
stat_endInit(void)
{
getProcessTimes(&end_init_cpu, &end_init_elapsed);
-
-#if USE_PAPI
- /* We start counting events for the mutator
- * when garbage collection starts
- * we switch to the GC event set. */
- papi_start_mutator_count();
-
- /* This flag is needed to avoid counting the last GC */
- papi_is_reporting = 1;
-
-#endif
}
/* -----------------------------------------------------------------------------
@@ -233,15 +219,6 @@ void
stat_startExit(void)
{
getProcessTimes(&start_exit_cpu, &start_exit_elapsed);
-
-#if USE_PAPI
- /* We stop counting mutator events
- * GC events are not being counted at this point */
- papi_stop_mutator_count();
-
- /* This flag is needed, because GC is run once more after this function */
- papi_is_reporting = 0;
-#endif
}
void
@@ -276,14 +253,6 @@ stat_startGC (Capability *cap, gc_thread *gct)
}
}
-#if USE_PAPI
- if(papi_is_reporting) {
- /* Switch to counting GC events */
- papi_stop_mutator_count();
- papi_start_gc_count();
- }
-#endif
-
getProcessTimes(&gct->gc_start_cpu, &gct->gc_start_elapsed);
// Post EVENT_GC_START with the same timestamp as used for stats
@@ -432,18 +401,6 @@ stat_endGC (Capability *cap, gc_thread *gct,
debugBelch("\b\b\b \b\b\b");
rub_bell = 0;
}
-
-#if USE_PAPI
- if(papi_is_reporting) {
- /* Switch to counting mutator events */
- if (gen == 0) {
- papi_stop_gc0_count();
- } else {
- papi_stop_gc1_count();
- }
- papi_start_mutator_count();
- }
-#endif
}
/* -----------------------------------------------------------------------------
@@ -759,9 +716,6 @@ stat_exit (void)
TICK_PRINT_TOT(2);
*/
-#if USE_PAPI
- papi_stats_report();
-#endif
#if defined(THREADED_RTS) && defined(PROF_SPIN)
{
nat g;
diff --git a/rts/Stats.h b/rts/Stats.h
index 76b522287e..b7ced97a45 100644
--- a/rts/Stats.h
+++ b/rts/Stats.h
@@ -66,12 +66,8 @@ double mut_user_time_during_heap_census(void);
void statDescribeGens( void );
-Time stat_getElapsedGCTime(void);
-Time stat_getElapsedTime(void);
-
-/* Only exported for Papi.c */
-void statsPrintf( char *s, ... )
- GNUC3_ATTRIBUTE(format (PRINTF, 1, 2));
+Time stat_getElapsedGCTime(void);
+Time stat_getElapsedTime(void);
#include "EndPrivate.h"
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 1f5f996906..84b59d3c2a 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -463,33 +463,6 @@ rts/dist/build/sm/Evac_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
rts/dist/build/sm/Scav_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
#-----------------------------------------------------------------------------
-# Add PAPI library if needed
-
-ifeq "$(GhcRtsWithPapi)" "YES"
-
-rts_CC_OPTS += -DUSE_PAPI
-
-rts_PACKAGE_CPP_OPTS += -DUSE_PAPI
-rts_PACKAGE_CPP_OPTS += -DPAPI_INCLUDE_DIR=$(PapiIncludeDir)
-rts_PACKAGE_CPP_OPTS += -DPAPI_LIB_DIR=$(PapiLibDir)
-
-ifneq "$(PapiIncludeDir)" ""
-rts_HC_OPTS += -I$(PapiIncludeDir)
-rts_CC_OPTS += -I$(PapiIncludeDir)
-rts_HSC2HS_OPTS += -I$(PapiIncludeDir)
-endif
-ifneq "$(PapiLibDirs)" ""
-rts_LD_OPTS += -L$(PapiLibDirs)
-endif
-
-else # GhcRtsWithPapi==YES
-
-rts_PACKAGE_CPP_OPTS += -DPAPI_INCLUDE_DIR=""
-rts_PACKAGE_CPP_OPTS += -DPAPI_LIB_DIR=""
-
-endif
-
-#-----------------------------------------------------------------------------
# Use system provided libffi
ifeq "$(UseSystemLibFFI)" "YES"
diff --git a/rts/package.conf.in b/rts/package.conf.in
index fff645d2a3..5c6d240fc2 100644
--- a/rts/package.conf.in
+++ b/rts/package.conf.in
@@ -17,9 +17,9 @@ hidden-modules:
import-dirs:
#ifdef INSTALLING
-library-dirs: LIB_DIR"/rts" PAPI_LIB_DIR FFI_LIB_DIR
+library-dirs: LIB_DIR"/rts" FFI_LIB_DIR
#else /* !INSTALLING */
-library-dirs: TOP"/rts/dist/build" PAPI_LIB_DIR FFI_LIB_DIR
+library-dirs: TOP"/rts/dist/build" FFI_LIB_DIR
#endif
hs-libraries: "HSrts" FFI_LIB
@@ -61,16 +61,13 @@ unresolved symbols. */
,"mingwex"
# endif
#endif
-#if USE_PAPI
- , "papi"
-#endif
#ifdef USE_LIBDW
, "elf"
, "dw" /* for backtraces */
#endif
#ifdef INSTALLING
-include-dirs: INCLUDE_DIR PAPI_INCLUDE_DIR FFI_INCLUDE_DIR
+include-dirs: INCLUDE_DIR FFI_INCLUDE_DIR
#else /* !INSTALLING */
include-dirs: TOP"/rts/dist/build" TOP"/includes" TOP"/includes/dist-derivedconstants/header" FFI_INCLUDE_DIR
#endif
diff --git a/rts/posix/GetTime.c b/rts/posix/GetTime.c
index 3e0e1cabfc..def78a4ac0 100644
--- a/rts/posix/GetTime.c
+++ b/rts/posix/GetTime.c
@@ -21,10 +21,6 @@
# include <sys/times.h>
#endif
-#ifdef USE_PAPI
-# include <papi.h>
-#endif
-
#if ! ((defined(HAVE_GETRUSAGE) && !irix_HOST_OS) || defined(HAVE_TIMES))
#error No implementation for getProcessCPUTime() available.
#endif
@@ -130,17 +126,9 @@ void getProcessTimes(Time *user, Time *elapsed)
Time getProcessCPUTime(void)
{
-#if !defined(THREADED_RTS) && USE_PAPI
- long long usec;
- if ((usec = PAPI_get_virt_usec()) < 0) {
- barf("PAPI_get_virt_usec: %lld", usec);
- }
- return USToTime(usec);
-#else
Time user, elapsed;
getProcessTimes(&user,&elapsed);
return user;
-#endif
}
Time getProcessElapsedTime(void)
@@ -185,18 +173,11 @@ void getProcessTimes(Time *user, Time *elapsed)
Time getThreadCPUTime(void)
{
-#if USE_PAPI
- long long usec;
- if ((usec = PAPI_get_virt_usec()) < 0) {
- barf("PAPI_get_virt_usec: %lld", usec);
- }
- return USToTime(usec);
-
-#elif !defined(BE_CONSERVATIVE) && \
- defined(HAVE_CLOCK_GETTIME) && \
- defined(_SC_CPUTIME) && \
- defined(CLOCK_PROCESS_CPUTIME_ID) && \
- defined(HAVE_SYSCONF)
+#if !defined(BE_CONSERVATIVE) && \
+ defined(HAVE_CLOCK_GETTIME) && \
+ defined(_SC_CPUTIME) && \
+ defined(CLOCK_PROCESS_CPUTIME_ID) && \
+ defined(HAVE_SYSCONF)
{
static int checked_sysconf = 0;
static int sysconf_result = 0;
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index e6a23395eb..95d995144c 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -45,7 +45,6 @@
#include "RetainerProfile.h"
#include "LdvProfile.h"
#include "RaiseAsync.h"
-#include "Papi.h"
#include "Stable.h"
#include "CheckUnload.h"
@@ -792,10 +791,6 @@ new_gc_thread (nat n, gc_thread *t)
init_gc_thread(t);
-#ifdef USE_PAPI
- t->papi_events = -1;
-#endif
-
for (g = 0; g < RtsFlags.GcFlags.generations; g++)
{
ws = &t->gens[g];
@@ -1028,14 +1023,6 @@ gcWorkerThread (Capability *cap)
debugTrace(DEBUG_gc, "GC thread %d standing by...", gct->thread_index);
ACQUIRE_SPIN_LOCK(&gct->gc_spin);
-#ifdef USE_PAPI
- // start performance counters in this thread...
- if (gct->papi_events == -1) {
- papi_init_eventset(&gct->papi_events);
- }
- papi_thread_start_gc1_count(gct->papi_events);
-#endif
-
init_gc_thread(gct);
traceEventGcWork(gct->cap);
@@ -1057,11 +1044,6 @@ gcWorkerThread (Capability *cap)
pruneSparkQueue(cap);
#endif
-#ifdef USE_PAPI
- // count events in this thread towards the GC totals
- papi_thread_stop_gc1_count(gct->papi_events);
-#endif
-
// Wait until we're told to continue
RELEASE_SPIN_LOCK(&gct->gc_spin);
gct->wakeup = GC_THREAD_WAITING_TO_CONTINUE;
diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h
index d42b89f973..ca90717b81 100644
--- a/rts/sm/GCThread.h
+++ b/rts/sm/GCThread.h
@@ -129,7 +129,7 @@ typedef struct gc_thread_ {
bdescr * free_blocks; // a buffer of free blocks for this thread
// during GC without accessing the block
- // allocators spin lock.
+ // allocators spin lock.
// These two lists are chained through the STATIC_LINK() fields of static
// objects. Pointers are tagged with the current static_flag, so before
@@ -161,21 +161,17 @@ typedef struct gc_thread_ {
// optimise it into a per-thread
// variable).
- rtsBool failed_to_evac; // failure to evacuate an object typically
- // Causes it to be recorded in the mutable
+ rtsBool failed_to_evac; // failure to evacuate an object typically
+ // Causes it to be recorded in the mutable
// object list
rtsBool eager_promotion; // forces promotion to the evac gen
// instead of the to-space
// corresponding to the object
- W_ thunk_selector_depth; // used to avoid unbounded recursion in
+ W_ thunk_selector_depth; // used to avoid unbounded recursion in
// evacuate() for THUNK_SELECTOR
-#ifdef USE_PAPI
- int papi_events;
-#endif
-
// -------------------
// stats