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,248
Issues
4,248
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
395
Merge Requests
395
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
34d7d258
Commit
34d7d258
authored
Jul 21, 2014
by
Austin Seipp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rts: delint/detab/dewhitespace EventLog.c
Signed-off-by:
Austin Seipp
<
austin@well-typed.com
>
parent
a62c3454
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
33 deletions
+36
-33
rts/eventlog/EventLog.c
rts/eventlog/EventLog.c
+36
-33
No files found.
rts/eventlog/EventLog.c
View file @
34d7d258
...
...
@@ -109,7 +109,7 @@ char *EventDesc[] = {
[
EVENT_HACK_BUG_T9003
]
=
"Empty event for bug #9003"
,
};
// Event type.
// Event type.
typedef
struct
_EventType
{
EventTypeNum
etNum
;
// Event Type number.
...
...
@@ -135,7 +135,7 @@ static StgBool hasRoomForVariableEvent(EventsBuf *eb, nat payload_bytes);
static
inline
void
postWord8
(
EventsBuf
*
eb
,
StgWord8
i
)
{
*
(
eb
->
pos
++
)
=
i
;
*
(
eb
->
pos
++
)
=
i
;
}
static
inline
void
postWord16
(
EventsBuf
*
eb
,
StgWord16
i
)
...
...
@@ -248,24 +248,25 @@ initEventLogging(void)
// We don't have a FMT* symbol for pid_t, so we go via Word64
// to be sure of not losing range. It would be nicer to have a
// FMT* symbol or similar, though.
sprintf
(
event_log_filename
,
"%s.%"
FMT_Word64
".eventlog"
,
prog
,
(
StgWord64
)
event_log_pid
);
sprintf
(
event_log_filename
,
"%s.%"
FMT_Word64
".eventlog"
,
prog
,
(
StgWord64
)
event_log_pid
);
}
stgFree
(
prog
);
/* Open event log file for writing. */
if
((
event_log_file
=
fopen
(
event_log_filename
,
"wb"
))
==
NULL
)
{
sysErrorBelch
(
"initEventLogging: can't open %s"
,
event_log_filename
);
stg_exit
(
EXIT_FAILURE
);
stg_exit
(
EXIT_FAILURE
);
}
/*
/*
* Allocate buffer(s) to store events.
* Create buffer large enough for the header begin marker, all event
* types, and header end marker to prevent checking if buffer has room
* for each of these steps, and remove the need to flush the buffer to
* disk during initialization.
*
* Use a single buffer to store the header with event types, then flush
* Use a single buffer to store the header with event types, then flush
* the buffer so all buffers are empty for writing events.
*/
#ifdef THREADED_RTS
...
...
@@ -303,8 +304,9 @@ initEventLogging(void)
break
;
case
EVENT_STOP_THREAD
:
// (cap, thread, status)
eventTypes
[
t
].
size
=
sizeof
(
EventThreadID
)
+
sizeof
(
StgWord16
)
+
sizeof
(
EventThreadID
);
eventTypes
[
t
].
size
=
sizeof
(
EventThreadID
)
+
sizeof
(
StgWord16
)
+
sizeof
(
EventThreadID
);
break
;
case
EVENT_STARTUP
:
// (cap_count)
...
...
@@ -403,8 +405,9 @@ initEventLogging(void)
break
;
case
EVENT_TASK_CREATE
:
// (taskId, cap, tid)
eventTypes
[
t
].
size
=
sizeof
(
EventTaskId
)
+
sizeof
(
EventCapNo
)
+
sizeof
(
EventKernelThreadId
);
eventTypes
[
t
].
size
=
sizeof
(
EventTaskId
)
+
sizeof
(
EventCapNo
)
+
sizeof
(
EventKernelThreadId
);
break
;
case
EVENT_TASK_MIGRATE
:
// (taskId, cap, new_cap)
...
...
@@ -417,7 +420,7 @@ initEventLogging(void)
break
;
case
EVENT_BLOCK_MARKER
:
eventTypes
[
t
].
size
=
sizeof
(
StgWord32
)
+
sizeof
(
EventTimestamp
)
+
eventTypes
[
t
].
size
=
sizeof
(
StgWord32
)
+
sizeof
(
EventTimestamp
)
+
sizeof
(
EventCapNo
);
break
;
...
...
@@ -435,10 +438,10 @@ initEventLogging(void)
// Mark end of event types in the header.
postInt32
(
&
eventBuf
,
EVENT_HET_END
);
// Write in buffer: the header end marker.
postInt32
(
&
eventBuf
,
EVENT_HEADER_END
);
// Prepare event buffer for events (data).
postInt32
(
&
eventBuf
,
EVENT_DATA_BEGIN
);
...
...
@@ -504,10 +507,10 @@ void
freeEventLogging
(
void
)
{
StgWord8
c
;
// Free events buffer.
for
(
c
=
0
;
c
<
n_capabilities
;
++
c
)
{
if
(
capEventBuf
[
c
].
begin
!=
NULL
)
if
(
capEventBuf
[
c
].
begin
!=
NULL
)
stgFree
(
capEventBuf
[
c
].
begin
);
}
if
(
capEventBuf
!=
NULL
)
{
...
...
@@ -518,7 +521,7 @@ freeEventLogging(void)
}
}
void
void
flushEventLog
(
void
)
{
if
(
event_log_file
!=
NULL
)
{
...
...
@@ -526,7 +529,7 @@ flushEventLog(void)
}
}
void
void
abortEventLogging
(
void
)
{
freeEventLogging
();
...
...
@@ -539,9 +542,9 @@ abortEventLogging(void)
* If the buffer is full, prints out the buffer and clears it.
*/
void
postSchedEvent
(
Capability
*
cap
,
EventTypeNum
tag
,
StgThreadID
thread
,
postSchedEvent
(
Capability
*
cap
,
EventTypeNum
tag
,
StgThreadID
thread
,
StgWord
info1
,
StgWord
info2
)
{
...
...
@@ -553,7 +556,7 @@ postSchedEvent (Capability *cap,
// Flush event buffer to make room for new event.
printAndClearEventBuf
(
eb
);
}
postEventHeader
(
eb
,
tag
);
switch
(
tag
)
{
...
...
@@ -637,7 +640,7 @@ postSparkEvent (Capability *cap,
}
void
postSparkCountersEvent
(
Capability
*
cap
,
postSparkCountersEvent
(
Capability
*
cap
,
SparkCounters
counters
,
StgWord
remaining
)
{
...
...
@@ -649,7 +652,7 @@ postSparkCountersEvent (Capability *cap,
// Flush event buffer to make room for new event.
printAndClearEventBuf
(
eb
);
}
postEventHeader
(
eb
,
EVENT_SPARK_COUNTERS
);
/* EVENT_SPARK_COUNTERS (crt,dud,ovf,cnv,gcd,fiz,rem) */
postWord64
(
eb
,
counters
.
created
);
...
...
@@ -671,7 +674,7 @@ postCapEvent (EventTypeNum tag,
// Flush event buffer to make room for new event.
printAndClearEventBuf
(
&
eventBuf
);
}
postEventHeader
(
&
eventBuf
,
tag
);
switch
(
tag
)
{
...
...
@@ -807,7 +810,7 @@ void postWallClockTime (EventCapsetID capset)
StgWord32
nsec
;
ACQUIRE_LOCK
(
&
eventBufMutex
);
/* The EVENT_WALL_CLOCK_TIME event is intended to allow programs
reading the eventlog to match up the event timestamps with wall
clock time. The normal event timestamps measure time since the
...
...
@@ -823,7 +826,7 @@ void postWallClockTime (EventCapsetID capset)
the elapsed time vs the wall clock time. So to minimise the
difference we just call them very close together.
*/
getUnixEpochTime
(
&
sec
,
&
nsec
);
/* Get the wall clock time */
ts
=
time_ns
();
/* Get the eventlog timestamp */
...
...
@@ -837,7 +840,7 @@ void postWallClockTime (EventCapsetID capset)
timestamp we already generated above. */
postEventTypeNum
(
&
eventBuf
,
EVENT_WALL_CLOCK_TIME
);
postWord64
(
&
eventBuf
,
ts
);
/* EVENT_WALL_CLOCK_TIME (capset, unix_epoch_seconds, nanoseconds) */
postCapsetID
(
&
eventBuf
,
capset
);
postWord64
(
&
eventBuf
,
sec
);
...
...
@@ -862,7 +865,7 @@ void postHeapEvent (Capability *cap,
// Flush event buffer to make room for new event.
printAndClearEventBuf
(
eb
);
}
postEventHeader
(
eb
,
tag
);
switch
(
tag
)
{
...
...
@@ -926,7 +929,7 @@ void postEventGcStats (Capability *cap,
// Flush event buffer to make room for new event.
printAndClearEventBuf
(
eb
);
}
postEventHeader
(
eb
,
EVENT_GC_STATS_GHC
);
/* EVENT_GC_STATS_GHC (heap_capset, generation,
copied_bytes, slop_bytes, frag_bytes,
...
...
@@ -1069,7 +1072,7 @@ void postCapMsg(Capability *cap, char *msg, va_list ap)
void
postUserMsg
(
Capability
*
cap
,
char
*
msg
,
va_list
ap
)
{
postLogMsg
(
&
capEventBuf
[
cap
->
no
],
EVENT_USER_MSG
,
msg
,
ap
);
}
}
void
postEventStartup
(
EventCapNo
n_caps
)
{
...
...
@@ -1176,7 +1179,7 @@ void printAndClearEventBuf (EventsBuf *ebuf)
if
(
ebuf
->
begin
!=
NULL
&&
ebuf
->
pos
!=
ebuf
->
begin
)
{
numBytes
=
ebuf
->
pos
-
ebuf
->
begin
;
written
=
fwrite
(
ebuf
->
begin
,
1
,
numBytes
,
event_log_file
);
if
(
written
!=
numBytes
)
{
debugBelch
(
...
...
@@ -1184,7 +1187,7 @@ void printAndClearEventBuf (EventsBuf *ebuf)
" doesn't match numBytes=%"
FMT_Word64
,
written
,
numBytes
);
return
;
}
resetEventsBuf
(
ebuf
);
flushCount
++
;
...
...
@@ -1231,7 +1234,7 @@ StgBool hasRoomForVariableEvent(EventsBuf *eb, nat payload_bytes)
}
else
{
return
1
;
// Buf has enough space for the event.
}
}
}
void
postEventType
(
EventsBuf
*
eb
,
EventType
*
et
)
{
...
...
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