Commit 543823a1 authored by donnie@darthik.com's avatar donnie@darthik.com
Browse files

Fixed ThreadID to be defined as StgThreadID, not StgWord64. Changed...

Fixed ThreadID to be defined as StgThreadID, not StgWord64.  Changed CapabilityNum to CapNo.  Added helper functions postCapNo() and postThreadID().
ThreadID was StgWord64, but should have been StgThreadID, which is
currently StgWord32.  Changed name from CapabilityNum to CapNo to better
reflect naming in Capability struct where "no" is the capability number.
Modified EventLog.c to use the helper functions postCapNo() and
postThreadID () for CapNo and ThreadID.
parent 0292156b
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
typedef StgWord16 EventTypeNum; typedef StgWord16 EventTypeNum;
typedef StgWord64 Timestamp; // in nanoseconds typedef StgWord64 Timestamp; // in nanoseconds
typedef StgWord64 ThreadID; typedef StgThreadID ThreadID;
typedef StgWord16 CapabilityNum; typedef StgWord16 CapNo;
#endif #endif
...@@ -111,6 +111,12 @@ static inline void postEventTypeID(EventsBuf *eb, StgWord16 etID) ...@@ -111,6 +111,12 @@ static inline void postEventTypeID(EventsBuf *eb, StgWord16 etID)
static inline void postTimestamp(EventsBuf *eb, Timestamp t) static inline void postTimestamp(EventsBuf *eb, Timestamp t)
{ postWord64(eb,t); } { postWord64(eb,t); }
static inline void postThreadID(EventsBuf *eb, ThreadID id)
{ postWord32(eb,id); }
static inline void postCapNo(EventsBuf *eb, CapNo no)
{ postWord16(eb,no); }
static inline void postInt8(EventsBuf *eb, StgInt8 i) static inline void postInt8(EventsBuf *eb, StgInt8 i)
{ postWord8(eb, (StgWord8)i); } { postWord8(eb, (StgWord8)i); }
...@@ -179,20 +185,19 @@ initEventLogging(void) ...@@ -179,20 +185,19 @@ initEventLogging(void)
case EVENT_THREAD_RUNNABLE: // (cap, thread) case EVENT_THREAD_RUNNABLE: // (cap, thread)
case EVENT_CREATE_SPARK: // (cap, thread) case EVENT_CREATE_SPARK: // (cap, thread)
case EVENT_RUN_SPARK: // (cap, thread) case EVENT_RUN_SPARK: // (cap, thread)
eventTypes[t].size = sizeof(CapabilityNum) + sizeof(ThreadID); eventTypes[t].size = sizeof(CapNo) + sizeof(ThreadID);
break; break;
case EVENT_MIGRATE_THREAD: // (cap, thread, new_cap) case EVENT_MIGRATE_THREAD: // (cap, thread, new_cap)
case EVENT_STEAL_SPARK: // (cap, thread, victim_cap) case EVENT_STEAL_SPARK: // (cap, thread, victim_cap)
case EVENT_THREAD_WAKEUP: // (cap, thread, other_cap) case EVENT_THREAD_WAKEUP: // (cap, thread, other_cap)
eventTypes[t].size = eventTypes[t].size =
sizeof(CapabilityNum) + sizeof(ThreadID) + sizeof(CapNo) + sizeof(ThreadID) + sizeof(CapNo);
sizeof(CapabilityNum);
break; break;
case EVENT_STOP_THREAD: // (cap, thread, status) case EVENT_STOP_THREAD: // (cap, thread, status)
eventTypes[t].size = eventTypes[t].size =
sizeof(CapabilityNum) + sizeof(ThreadID) + sizeof(StgWord16); sizeof(CapNo) + sizeof(ThreadID) + sizeof(StgWord16);
break; break;
case EVENT_SHUTDOWN: // (cap) case EVENT_SHUTDOWN: // (cap)
...@@ -200,7 +205,7 @@ initEventLogging(void) ...@@ -200,7 +205,7 @@ initEventLogging(void)
case EVENT_REQUEST_PAR_GC: // (cap) case EVENT_REQUEST_PAR_GC: // (cap)
case EVENT_GC_START: // (cap) case EVENT_GC_START: // (cap)
case EVENT_GC_END: // (cap) case EVENT_GC_END: // (cap)
eventTypes[t].size = sizeof(CapabilityNum); eventTypes[t].size = sizeof(CapNo);
break; break;
} }
...@@ -294,7 +299,7 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap) ...@@ -294,7 +299,7 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap)
postEventTypeNum(eb, tag); postEventTypeNum(eb, tag);
postTimestamp(eb, stat_getElapsedTime() * (1000000000LL/TICKS_PER_SECOND)); postTimestamp(eb, stat_getElapsedTime() * (1000000000LL/TICKS_PER_SECOND));
postWord16(eb, cap->no); postCapNo(eb, cap->no);
switch (tag) { switch (tag) {
case EVENT_CREATE_THREAD: // (cap, thread) case EVENT_CREATE_THREAD: // (cap, thread)
...@@ -303,7 +308,7 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap) ...@@ -303,7 +308,7 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap)
case EVENT_CREATE_SPARK: // (cap, thread) case EVENT_CREATE_SPARK: // (cap, thread)
case EVENT_RUN_SPARK: // (cap, thread) case EVENT_RUN_SPARK: // (cap, thread)
{ {
postWord64(eb,thread); postThreadID(eb,thread);
break; break;
} }
...@@ -311,15 +316,15 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap) ...@@ -311,15 +316,15 @@ postEvent_(Capability *cap, EventTypeNum tag, StgThreadID thread, nat other_cap)
case EVENT_STEAL_SPARK: // (cap, thread, victim_cap) case EVENT_STEAL_SPARK: // (cap, thread, victim_cap)
case EVENT_THREAD_WAKEUP: // (cap, thread, other_cap) case EVENT_THREAD_WAKEUP: // (cap, thread, other_cap)
{ {
postWord64(eb,thread); postThreadID(eb,thread);
postWord16(eb,other_cap); postCapNo(eb,other /* new_cap | victim_cap | other_cap */);
break; break;
} }
case EVENT_STOP_THREAD: // (cap, thread, status) case EVENT_STOP_THREAD: // (cap, thread, status)
{ {
postWord64(eb,thread); postThreadID(eb,thread);
postWord16(eb,other_cap); postWord16(eb,other /* status */);
break; break;
} }
......
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