Commit 6b3d5b59 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

rts: Kill PAPI support

This hasn't been used for a very long time and will soon be superceded
by perf_events support.

Test Plan: validate

Reviewers: austin, simonmar

Reviewed By: austin, simonmar

Subscribers: thomie, erikd

Differential Revision: https://phabricator.haskell.org/D1493
parent f9e17fd7
......@@ -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
......
......@@ -175,7 +175,7 @@ Template Haskell
Runtime system
~~~~~~~~~~~~~~
- TODO FIXME.
- Support for performance monitoring with PAPI has been dropped.
Build system
~~~~~~~~~~~~
......
......@@ -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
......
......@@ -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
......
This diff is collapsed.
/* -----------------------------------------------------------------------------
* (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 */
......@@ -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)
......
......@@ -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();
......
......@@ -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;
......
......@@ -69,10 +69,6 @@ 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));
#include "EndPrivate.h"
#endif /* STATS_H */
......@@ -462,33 +462,6 @@ rts/dist/build/sm/Evac_thr_HC_OPTS += -optc-funroll-loops
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
......
......@@ -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
......
......@@ -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,14 +173,7 @@ 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) && \
#if !defined(BE_CONSERVATIVE) && \
defined(HAVE_CLOCK_GETTIME) && \
defined(_SC_CPUTIME) && \
defined(CLOCK_PROCESS_CPUTIME_ID) && \
......
......@@ -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;
......
......@@ -172,10 +172,6 @@ typedef struct gc_thread_ {
W_ thunk_selector_depth; // used to avoid unbounded recursion in
// evacuate() for THUNK_SELECTOR
#ifdef USE_PAPI
int papi_events;
#endif
// -------------------
// stats
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment