[Git][ghc/ghc][wip/init-event-types] rts: Separate population of eventTypes from initial event generation

Ben Gamari gitlab at gitlab.haskell.org
Sat Jun 8 17:19:46 UTC 2019



Ben Gamari pushed to branch wip/init-event-types at Glasgow Haskell Compiler / GHC


Commits:
6a52c83f by Ben Gamari at 2019-06-08T17:19:39Z
rts: Separate population of eventTypes from initial event generation

Previously these two orthogonal concerns were both implemented in
postHeaderEvents which made it difficult to send header events after RTS
initialization.

- - - - -


1 changed file:

- rts/eventlog/EventLog.c


Changes:

=====================================
rts/eventlog/EventLog.c
=====================================
@@ -267,15 +267,9 @@ flushEventLog(void)
 }
 
 static void
-postHeaderEvents(void)
+init_event_types(void)
 {
-    // Write in buffer: the header begin marker.
-    postInt32(&eventBuf, EVENT_HEADER_BEGIN);
-
-    // Mark beginning of event types in the header.
-    postInt32(&eventBuf, EVENT_HET_BEGIN);
     for (int t = 0; t < NUM_GHC_EVENT_TAGS; ++t) {
-
         eventTypes[t].etNum = t;
         eventTypes[t].desc = EventDesc[t];
 
@@ -450,9 +444,22 @@ postHeaderEvents(void)
         default:
             continue; /* ignore deprecated events */
         }
+    }
+}
+
+static void
+postHeaderEvents(void)
+{
+    // Write in buffer: the header begin marker.
+    postInt32(&eventBuf, EVENT_HEADER_BEGIN);
 
+    // Mark beginning of event types in the header.
+    postInt32(&eventBuf, EVENT_HET_BEGIN);
+
+    for (int t = 0; t < NUM_GHC_EVENT_TAGS; ++t) {
         // Write in buffer: the start event type.
-        postEventType(&eventBuf, &eventTypes[t]);
+        if (eventTypes[t].desc)
+            postEventType(&eventBuf, &eventTypes[t]);
     }
 
     // Mark end of event types in the header.
@@ -470,6 +477,8 @@ initEventLogging(const EventLogWriter *ev_writer)
 {
     uint32_t n_caps;
 
+    init_event_types();
+
     event_log_writer = ev_writer;
     initEventLogWriter();
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/6a52c83f7be44c7ff01b3180bb2dba20fc2b987e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/6a52c83f7be44c7ff01b3180bb2dba20fc2b987e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190608/a9bf62f2/attachment-0001.html>


More information about the ghc-commits mailing list