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
4,268
Issues
4,268
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
407
Merge Requests
407
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
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
Glasgow Haskell Compiler
GHC
Commits
aaaaf67b
Commit
aaaaf67b
authored
Oct 27, 2011
by
Duncan Coutts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an RTS eventlog tracing class for user messages
Enables people to turn them on/off. Defaults to on.
parent
6f5b798b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
+23
-5
includes/rts/Flags.h
includes/rts/Flags.h
+1
-0
rts/RtsFlags.c
rts/RtsFlags.c
+10
-2
rts/Trace.c
rts/Trace.c
+11
-3
rts/Trace.h
rts/Trace.h
+1
-0
No files found.
includes/rts/Flags.h
View file @
aaaaf67b
...
...
@@ -131,6 +131,7 @@ struct TRACE_FLAGS {
rtsBool
gc
;
/* trace GC events */
rtsBool
sparks_sampled
;
/* trace spark events by a sampled method */
rtsBool
sparks_full
;
/* trace spark events 100% accurately */
rtsBool
user
;
/* trace user events (emitted from Haskell code) */
};
struct
CONCURRENT_FLAGS
{
...
...
rts/RtsFlags.c
View file @
aaaaf67b
...
...
@@ -166,6 +166,7 @@ void initRtsFlagsDefaults(void)
RtsFlags
.
TraceFlags
.
gc
=
rtsFalse
;
RtsFlags
.
TraceFlags
.
sparks_sampled
=
rtsFalse
;
RtsFlags
.
TraceFlags
.
sparks_full
=
rtsFalse
;
RtsFlags
.
TraceFlags
.
user
=
rtsFalse
;
#endif
RtsFlags
.
MiscFlags
.
tickInterval
=
20
;
/* In milliseconds */
...
...
@@ -295,12 +296,13 @@ usage_text[] = {
" g GC events"
,
" p par spark events (sampled)"
,
" f par spark events (full detail)"
,
" u user events (emitted from Haskell code)"
,
" a all event classes above"
,
# ifdef DEBUG
" t add time stamps (only useful with -v)"
,
# endif
" a all event classes above"
,
" -x disable an event class, for any flag above"
,
" the initial enabled event classes are 'sgp'"
,
" the initial enabled event classes are 'sgp
u
'"
,
#endif
#if !defined(PROFILING)
...
...
@@ -1466,6 +1468,7 @@ static void read_trace_flags(char *arg)
RtsFlags
.
TraceFlags
.
scheduler
=
rtsTrue
;
RtsFlags
.
TraceFlags
.
gc
=
rtsTrue
;
RtsFlags
.
TraceFlags
.
sparks_sampled
=
rtsTrue
;
RtsFlags
.
TraceFlags
.
user
=
rtsTrue
;
for
(
c
=
arg
;
*
c
!=
'\0'
;
c
++
)
{
switch
(
*
c
)
{
...
...
@@ -1479,6 +1482,7 @@ static void read_trace_flags(char *arg)
RtsFlags
.
TraceFlags
.
gc
=
enabled
;
RtsFlags
.
TraceFlags
.
sparks_sampled
=
enabled
;
RtsFlags
.
TraceFlags
.
sparks_full
=
enabled
;
RtsFlags
.
TraceFlags
.
user
=
enabled
;
enabled
=
rtsTrue
;
break
;
...
...
@@ -1502,6 +1506,10 @@ static void read_trace_flags(char *arg)
RtsFlags
.
TraceFlags
.
gc
=
enabled
;
enabled
=
rtsTrue
;
break
;
case
'u'
:
RtsFlags
.
TraceFlags
.
user
=
enabled
;
enabled
=
rtsTrue
;
break
;
default:
errorBelch
(
"unknown trace option: %c"
,
*
c
);
break
;
...
...
rts/Trace.c
View file @
aaaaf67b
...
...
@@ -50,6 +50,7 @@ int TRACE_sched;
int
TRACE_gc
;
int
TRACE_spark_sampled
;
int
TRACE_spark_full
;
int
TRACE_user
;
#ifdef THREADED_RTS
static
Mutex
trace_utx
;
...
...
@@ -106,9 +107,12 @@ void initTracing (void)
RtsFlags
.
TraceFlags
.
sparks_full
||
RtsFlags
.
DebugFlags
.
sparks
;
TRACE_user
=
RtsFlags
.
TraceFlags
.
user
;
eventlog_enabled
=
RtsFlags
.
TraceFlags
.
tracing
==
TRACE_EVENTLOG
;
/* Note: we can have
TRACE_sched or TRACE_spark
turned on even when
/* Note: we can have
any of the TRACE_* flags
turned on even when
eventlog_enabled is off. In the DEBUG way we may be tracing to stderr.
*/
...
...
@@ -521,13 +525,17 @@ static void traceFormatUserMsg(Capability *cap, char *msg, ...)
va_list
ap
;
va_start
(
ap
,
msg
);
/* Note: normally we don't check the TRACE_* flags here as they're checked
by the wrappers in Trace.h. But traceUserMsg is special since it has no
wrapper (it's called from cmm code), so we check TRACE_user here
*/
#ifdef DEBUG
if
(
RtsFlags
.
TraceFlags
.
tracing
==
TRACE_STDERR
)
{
if
(
RtsFlags
.
TraceFlags
.
tracing
==
TRACE_STDERR
&&
TRACE_user
)
{
traceCap_stderr
(
cap
,
msg
,
ap
);
}
else
#endif
{
if
(
eventlog_enabled
)
{
if
(
eventlog_enabled
&&
TRACE_user
)
{
postUserMsg
(
cap
,
msg
,
ap
);
}
}
...
...
rts/Trace.h
View file @
aaaaf67b
...
...
@@ -66,6 +66,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
// -----------------------------------------------------------------------------
// Posting events
...
...
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