Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Decking
GHC
Commits
6b5fd7b0
Commit
6b5fd7b0
authored
Apr 15, 2019
by
Ben Gamari
🐢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NonmovingCensus: Emit samples to eventlog
parent
02bf6a69
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
2 deletions
+69
-2
includes/rts/EventLogFormat.h
includes/rts/EventLogFormat.h
+2
-1
includes/rts/Flags.h
includes/rts/Flags.h
+1
-0
libraries/base/GHC/RTS/Flags.hsc
libraries/base/GHC/RTS/Flags.hsc
+4
-0
rts/RtsFlags.c
rts/RtsFlags.c
+5
-0
rts/Trace.c
rts/Trace.c
+10
-0
rts/Trace.h
rts/Trace.h
+5
-0
rts/eventlog/EventLog.c
rts/eventlog/EventLog.c
+18
-1
rts/eventlog/EventLog.h
rts/eventlog/EventLog.h
+3
-0
rts/sm/NonMovingCensus.c
rts/sm/NonMovingCensus.c
+18
-0
rts/sm/NonMovingCensus.h
rts/sm/NonMovingCensus.h
+3
-0
No files found.
includes/rts/EventLogFormat.h
View file @
6b5fd7b0
...
...
@@ -190,13 +190,14 @@
#define EVENT_CONC_SWEEP_BEGIN 204
#define EVENT_CONC_SWEEP_END 205
#define EVENT_CONC_UPD_REM_SET_FLUSH 206
#define EVENT_NONMOVING_HEAP_CENSUS 207
/*
* The highest event code +1 that ghc itself emits. Note that some event
* ranges higher than this are reserved but not currently emitted by ghc.
* This must match the size of the EventDesc[] array in EventLog.c
*/
#define NUM_GHC_EVENT_TAGS 20
7
#define NUM_GHC_EVENT_TAGS 20
8
#if 0 /* DEPRECATED EVENTS: */
/* we don't actually need to record the thread, it's implicit */
...
...
includes/rts/Flags.h
View file @
6b5fd7b0
...
...
@@ -170,6 +170,7 @@ typedef struct _TRACE_FLAGS {
bool
timestamp
;
/* show timestamp in stderr output */
bool
scheduler
;
/* trace scheduler events */
bool
gc
;
/* trace GC events */
bool
nonmoving_gc
;
/* trace nonmoving GC events */
bool
sparks_sampled
;
/* trace spark events by a sampled method */
bool
sparks_full
;
/* trace spark events 100% accurately */
bool
user
;
/* trace user events (emitted from Haskell code) */
...
...
libraries/base/GHC/RTS/Flags.hsc
View file @
6b5fd7b0
...
...
@@ -292,6 +292,8 @@ data TraceFlags = TraceFlags
, timestamp :: Bool -- ^ show timestamp in stderr output
, traceScheduler :: Bool -- ^ trace scheduler events
, traceGc :: Bool -- ^ trace GC events
, traceNonmovingGc
:: Bool -- ^ trace nonmoving GC heap census samples
, sparksSampled :: Bool -- ^ trace spark events by a sampled method
, sparksFull :: Bool -- ^ trace spark events 100% accurately
, user :: Bool -- ^ trace user events (emitted from Haskell code)
...
...
@@ -525,6 +527,8 @@ getTraceFlags = do
(#{peek TRACE_FLAGS, scheduler} ptr :: IO CBool))
<*> (toBool <$>
(#{peek TRACE_FLAGS, gc} ptr :: IO CBool))
<*> (toBool <$>
(#{peek TRACE_FLAGS, nonmoving_gc} ptr :: IO CBool))
<*> (toBool <$>
(#{peek TRACE_FLAGS, sparks_sampled} ptr :: IO CBool))
<*> (toBool <$>
...
...
rts/RtsFlags.c
View file @
6b5fd7b0
...
...
@@ -222,6 +222,7 @@ void initRtsFlagsDefaults(void)
RtsFlags
.
TraceFlags
.
timestamp
=
false
;
RtsFlags
.
TraceFlags
.
scheduler
=
false
;
RtsFlags
.
TraceFlags
.
gc
=
false
;
RtsFlags
.
TraceFlags
.
nonmoving_gc
=
false
;
RtsFlags
.
TraceFlags
.
sparks_sampled
=
false
;
RtsFlags
.
TraceFlags
.
sparks_full
=
false
;
RtsFlags
.
TraceFlags
.
user
=
false
;
...
...
@@ -2131,6 +2132,10 @@ static void read_trace_flags(const char *arg)
RtsFlags
.
TraceFlags
.
gc
=
enabled
;
enabled
=
true
;
break
;
case
'n'
:
RtsFlags
.
TraceFlags
.
nonmoving_gc
=
enabled
;
enabled
=
true
;
break
;
case
'u'
:
RtsFlags
.
TraceFlags
.
user
=
enabled
;
enabled
=
true
;
...
...
rts/Trace.c
View file @
6b5fd7b0
...
...
@@ -30,6 +30,7 @@
// events
int
TRACE_sched
;
int
TRACE_gc
;
int
TRACE_nonmoving_gc
;
int
TRACE_spark_sampled
;
int
TRACE_spark_full
;
int
TRACE_user
;
...
...
@@ -72,6 +73,9 @@ void initTracing (void)
RtsFlags
.
GcFlags
.
giveStats
=
COLLECT_GC_STATS
;
}
TRACE_nonmoving_gc
=
RtsFlags
.
TraceFlags
.
nonmoving_gc
;
TRACE_spark_sampled
=
RtsFlags
.
TraceFlags
.
sparks_sampled
;
...
...
@@ -844,6 +848,12 @@ void traceConcUpdRemSetFlush(Capability *cap)
postConcUpdRemSetFlush
(
cap
);
}
void
traceNonmovingHeapCensus
(
uint32_t
log_blk_size
,
const
struct
NonmovingAllocCensus
*
census
)
{
if
(
eventlog_enabled
&&
TRACE_nonmoving_gc
)
postNonmovingHeapCensus
(
log_blk_size
,
census
);
}
void
traceThreadStatus_
(
StgTSO
*
tso
USED_IF_DEBUG
)
{
...
...
rts/Trace.h
View file @
6b5fd7b0
...
...
@@ -9,6 +9,7 @@
#pragma once
#include "rts/EventLogFormat.h"
#include "sm/NonMovingCensus.h"
#include "Capability.h"
#if defined(DTRACE)
...
...
@@ -72,6 +73,7 @@ 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
;
// -----------------------------------------------------------------------------
// Posting events
...
...
@@ -311,6 +313,8 @@ void traceConcSyncEnd(void);
void
traceConcSweepBegin
(
void
);
void
traceConcSweepEnd
(
void
);
void
traceConcUpdRemSetFlush
(
Capability
*
cap
);
void
traceNonmovingHeapCensus
(
uint32_t
log_blk_size
,
const
struct
NonmovingAllocCensus
*
census
);
void
flushTrace
(
void
);
...
...
@@ -359,6 +363,7 @@ void flushTrace(void);
#define traceConcSweepBegin()
/* nothing */
#define traceConcSweepEnd()
/* nothing */
#define traceConcUpdRemSetFlush(cap)
/* nothing */
#define traceNonmovingHeapCensus(blk_size, census)
/* nothing */
#define flushTrace()
/* nothing */
...
...
rts/eventlog/EventLog.c
View file @
6b5fd7b0
...
...
@@ -114,7 +114,8 @@ char *EventDesc[] = {
[
EVENT_CONC_SYNC_END
]
=
"End concurrent GC synchronisation"
,
[
EVENT_CONC_SWEEP_BEGIN
]
=
"Begin concurrent sweep"
,
[
EVENT_CONC_SWEEP_END
]
=
"End concurrent sweep"
,
[
EVENT_CONC_UPD_REM_SET_FLUSH
]
=
"Update remembered set flushed"
[
EVENT_CONC_UPD_REM_SET_FLUSH
]
=
"Update remembered set flushed"
,
[
EVENT_NONMOVING_HEAP_CENSUS
]
=
"Nonmoving heap census"
};
// Event type.
...
...
@@ -470,6 +471,10 @@ init_event_types(void)
sizeof
(
EventCapNo
);
break
;
case
EVENT_NONMOVING_HEAP_CENSUS
:
// (cap, blk_size, active_segs, filled_segs, live_blks)
eventTypes
[
t
].
size
=
13
;
break
;
default:
continue
;
/* ignore deprecated events */
}
...
...
@@ -1182,6 +1187,18 @@ void postConcMarkEnd(StgWord32 marked_obj_count)
RELEASE_LOCK
(
&
eventBufMutex
);
}
void
postNonmovingHeapCensus
(
int
log_blk_size
,
const
struct
NonmovingAllocCensus
*
census
)
{
ACQUIRE_LOCK
(
&
eventBufMutex
);
postEventHeader
(
&
eventBuf
,
EVENT_NONMOVING_HEAP_CENSUS
);
postWord8
(
&
eventBuf
,
log_blk_size
);
postWord32
(
&
eventBuf
,
census
->
n_active_segs
);
postWord32
(
&
eventBuf
,
census
->
n_filled_segs
);
postWord32
(
&
eventBuf
,
census
->
n_live_blocks
);
RELEASE_LOCK
(
&
eventBufMutex
);
}
void
closeBlockMarker
(
EventsBuf
*
ebuf
)
{
if
(
ebuf
->
marker
)
...
...
rts/eventlog/EventLog.h
View file @
6b5fd7b0
...
...
@@ -11,6 +11,7 @@
#include "rts/EventLogFormat.h"
#include "rts/EventLogWriter.h"
#include "Capability.h"
#include "sm/NonMovingCensus.h"
#include "BeginPrivate.h"
...
...
@@ -162,6 +163,8 @@ void postHeapProfSampleCostCentre(StgWord8 profile_id,
void
postConcUpdRemSetFlush
(
Capability
*
cap
);
void
postConcMarkEnd
(
StgWord32
marked_obj_count
);
void
postNonmovingHeapCensus
(
int
log_blk_size
,
const
struct
NonmovingAllocCensus
*
census
);
#else
/* !TRACING */
...
...
rts/sm/NonMovingCensus.c
View file @
6b5fd7b0
...
...
@@ -90,6 +90,9 @@ nonmovingAllocatorCensus(struct NonmovingAllocator *alloc)
void
nonmovingPrintAllocatorCensus
()
{
if
(
!
RtsFlags
.
GcFlags
.
useNonmoving
)
return
;
for
(
int
i
=
0
;
i
<
NONMOVING_ALLOCA_CNT
;
i
++
)
{
struct
NonmovingAllocCensus
census
=
nonmovingAllocatorCensus
(
nonmovingHeap
.
allocators
[
i
]);
...
...
@@ -109,3 +112,18 @@ void nonmovingPrintAllocatorCensus()
occupancy
);
}
}
void
nonmovingTraceAllocatorCensus
()
{
#if defined(TRACING)
if
(
!
RtsFlags
.
GcFlags
.
useNonmoving
&&
!
TRACE_nonmoving_gc
)
return
;
for
(
int
i
=
0
;
i
<
NONMOVING_ALLOCA_CNT
;
i
++
)
{
const
struct
NonmovingAllocCensus
census
=
nonmovingAllocatorCensus
(
nonmovingHeap
.
allocators
[
i
]);
const
uint32_t
log_blk_size
=
i
+
NONMOVING_ALLOCA0
;
traceNonmovingHeapCensus
(
log_blk_size
,
&
census
);
}
#endif
}
rts/sm/NonMovingCensus.h
View file @
6b5fd7b0
...
...
@@ -8,6 +8,8 @@
#pragma once
#include "NonMoving.h"
struct
NonmovingAllocCensus
{
uint32_t
n_active_segs
;
uint32_t
n_filled_segs
;
...
...
@@ -23,3 +25,4 @@ struct NonmovingAllocCensus
nonmovingAllocatorCensus
(
struct
NonmovingAllocator
*
alloc
);
void
nonmovingPrintAllocatorCensus
(
void
);
void
nonmovingTraceAllocatorCensus
(
void
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment