...
 
Commits (5)
......@@ -57,8 +57,10 @@ extern "C" {
// library.
#if defined(HAS_VISIBILITY_HIDDEN)
#define RTS_PRIVATE GNUC3_ATTRIBUTE(visibility("hidden"))
#define RTS_DEFAULT GNUC3_ATTRIBUTE(visibility("default"))
#else
#define RTS_PRIVATE /* disabled: RTS_PRIVATE */
#define RTS_DEFAULT
#endif
#if __GNUC__ >= 4
......
......@@ -53,6 +53,7 @@ import GHC.Base
import qualified GHC.Foreign
import GHC.IO.Encoding
import GHC.Ptr
import GHC.Real
import GHC.Show
import GHC.Stack
import Data.List (null, partition)
......@@ -75,7 +76,7 @@ import Data.List (null, partition)
-- Some implementations of these functions may decorate the string that\'s
-- output to indicate that you\'re tracing.
foreign import ccall "&eventlog_enabled" eventlog_enabled :: Ptr CBool
foreign import ccall "&TRACE_user" traceUser :: Ptr CInt
-- | The 'whenEventlog' function evals argument action
-- if RTS eventlog (+RTS -l) is enabled.
......@@ -84,8 +85,8 @@ foreign import ccall "&eventlog_enabled" eventlog_enabled :: Ptr CBool
{-# INLINE whenEventlog #-}
whenEventlog :: IO () -> IO ()
whenEventlog logAction = do
ee <- peek eventlog_enabled
if toBool ee
ee <- peek traceUser
if 0 < (fromIntegral ee :: Int)
then logAction
else return ()
......@@ -94,7 +95,7 @@ whenEventlog logAction = do
--
-- @since 4.5.0.0
traceIO :: String -> IO ()
traceIO msg =
traceIO msg = do
withCString "%s\n" $ \cfmt -> do
-- NB: debugBelch can't deal with null bytes, so filter them
-- out so we don't accidentally truncate the message. See #9395
......
......@@ -33,7 +33,9 @@ int TRACE_gc;
int TRACE_nonmoving_gc;
int TRACE_spark_sampled;
int TRACE_spark_full;
int TRACE_user;
#endif /* TRACING */
RTS_DEFAULT int TRACE_user; // used in Debug.Trace
#if defined(TRACING)
int TRACE_cap;
#if defined(THREADED_RTS)
......
......@@ -71,7 +71,7 @@ extern int TRACE_sched;
extern int TRACE_gc;
extern int TRACE_spark_sampled;
extern int TRACE_spark_full;
/* extern int TRACE_user; */ // only used in Trace.c
extern int TRACE_cap;
extern int TRACE_nonmoving_gc;
......
......@@ -26,13 +26,8 @@
#include <unistd.h>
#endif
#endif /* TRACING */
// for ghc-pkg is build without TRACING
bool eventlog_enabled;
#if defined(TRACING)
static const EventLogWriter *event_log_writer = NULL;
#define EVENT_LOG_SIZE 2 * (1024 * 1024) // 2MB
......
......@@ -15,8 +15,6 @@
#include "BeginPrivate.h"
extern bool eventlog_enabled;
#if defined(TRACING)
/*
......@@ -24,6 +22,7 @@ extern bool eventlog_enabled;
*/
extern char *EventTagDesc[];
extern bool eventlog_enabled;
void initEventLogging(void);
void restartEventLogging(void);
......