Ticket #5115: 0001-Add-capability-sets-to-the-event-system.-Contains-co.patch

File 0001-Add-capability-sets-to-the-event-system.-Contains-co.patch, 21.5 KB (added by sjanssen, 2 years ago)

git patch

  • includes/rts/EventLogFormat.h

    From 2a09038455076d4935909fb1d14bf0ad4aec9061 Mon Sep 17 00:00:00 2001
    From: Spencer Janssen <spencer@well-typed.com>
    Date: Thu, 14 Apr 2011 01:11:05 -0500
    Subject: [PATCH] Add capability sets to the event system.  Contains code from Duncan Coutts.
    
    ---
     includes/rts/EventLogFormat.h |   39 +++++++++++-
     rts/Capability.c              |    4 +
     rts/RtsProbes.d               |    6 ++
     rts/RtsStartup.c              |    4 +
     rts/Schedule.c                |   16 ++--
     rts/Trace.c                   |   67 ++++++++++++++++++
     rts/Trace.h                   |   69 +++++++++++++++++++
     rts/eventlog/EventLog.c       |  149 ++++++++++++++++++++++++++++++++++++++++-
     rts/eventlog/EventLog.h       |   29 ++++++++
     rts/ghc.mk                    |    1 +
     10 files changed, 374 insertions(+), 10 deletions(-)
    
    diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
    index f3f56c9..16f1c8b 100644
    a b  
    112112#define EVENT_GC_END              10 /* ()                     */ 
    113113#define EVENT_REQUEST_SEQ_GC      11 /* ()                     */ 
    114114#define EVENT_REQUEST_PAR_GC      12 /* ()                     */ 
     115/* 13, 14 deprecated */ 
    115116#define EVENT_CREATE_SPARK_THREAD 15 /* (spark_thread)         */ 
    116117#define EVENT_LOG_MSG             16 /* (message ...)          */ 
    117118#define EVENT_STARTUP             17 /* (num_capabilities)     */ 
     
    120121#define EVENT_GC_IDLE             20 /* () */ 
    121122#define EVENT_GC_WORK             21 /* () */ 
    122123#define EVENT_GC_DONE             22 /* () */ 
     124/* 23, 24 used by eden */ 
     125#define EVENT_CAPSET_CREATE       25 /* (capset, capset_type)  */ 
     126#define EVENT_CAPSET_DELETE       26 /* (capset)               */ 
     127#define EVENT_CAPSET_ASSIGN_CAP   27 /* (capset, cap)          */ 
     128#define EVENT_CAPSET_REMOVE_CAP   28 /* (capset, cap)          */ 
     129/* the RTS identifier is in the form of "GHC-version rts_way"  */ 
     130#define EVENT_RTS_IDENTIFIER      29 /* (capset, name_version_string) */ 
     131/* the vectors in these events are null separated strings             */ 
     132#define EVENT_PROGRAM_ARGS        30 /* (capset, commandline_vector)  */ 
     133#define EVENT_PROGRAM_ENV         31 /* (capset, environment_vector)  */ 
     134#define EVENT_OSPROCESS_PID       32 /* (capset, pid, parent_pid)     */ 
    123135 
    124 #define NUM_EVENT_TAGS            23 
     136 
     137/* Range 33 - 59 is available for new events */ 
     138 
     139/* Range 60 - 80 is used by eden for parallel tracing 
     140 * see http://www.mathematik.uni-marburg.de/~eden/ 
     141 */ 
     142 
     143/* 
     144 * The highest event code +1 that ghc itself emits. Note that some event 
     145 * ranges higher than this are reserved but not currently emitted by ghc. 
     146 * This must match the size of the EventDesc[] array in EventLog.c 
     147 */ 
     148#define NUM_EVENT_TAGS            33 
    125149 
    126150#if 0  /* DEPRECATED EVENTS: */ 
     151/* ghc changed how it handles sparks so these are no longer applicable */ 
    127152#define EVENT_CREATE_SPARK        13 /* (cap, thread) */ 
    128153#define EVENT_SPARK_TO_THREAD     14 /* (cap, thread, spark_thread) */ 
     154/* these are used by eden but are replaced by new alternatives for ghc */ 
     155#define EVENT_VERSION             23 /* (version_string) */ 
     156#define EVENT_PROGRAM_INVOCATION  24 /* (commandline_string) */ 
    129157#endif 
    130158 
    131159/* 
     
    152180 */ 
    153181#define THREAD_SUSPENDED_FOREIGN_CALL 6 
    154182 
     183/* 
     184 * Capset type values for EVENT_CAPSET_CREATE 
     185 */ 
     186#define CAPSET_TYPE_CUSTOM      1  /* reserved for end-user applications */ 
     187#define CAPSET_TYPE_OSPROCESS   2  /* caps belong to the same OS process */ 
     188#define CAPSET_TYPE_CLOCKDOMAIN 3  /* caps share a local clock/time      */ 
     189 
    155190#ifndef EVENTLOG_CONSTANTS_ONLY 
    156191 
    157192typedef StgWord16 EventTypeNum; 
     
    160195typedef StgWord16 EventCapNo; 
    161196typedef StgWord16 EventPayloadSize; /* variable-size events */ 
    162197typedef StgWord16 EventThreadStatus; /* status for EVENT_STOP_THREAD */ 
     198typedef StgWord32 EventCapsetID; 
     199typedef StgWord16 EventCapsetType;   /* types for EVENT_CAPSET_CREATE */ 
    163200 
    164201#endif 
    165202 
  • rts/Capability.c

    diff --git a/rts/Capability.c b/rts/Capability.c
    index 9091fdd..9557fcc 100644
    a b  
    253253    cap->transaction_tokens = 0; 
    254254    cap->context_switch = 0; 
    255255    cap->pinned_object_block = NULL; 
     256 
     257    traceCapsetAssignCap(CAPSET_OSPROCESS_DEFAULT, i); 
    256258} 
    257259 
    258260/* --------------------------------------------------------------------------- 
     
    266268void 
    267269initCapabilities( void ) 
    268270{ 
     271 
    269272#if defined(THREADED_RTS) 
    270273    nat i; 
    271274 
     
    833836#else 
    834837    freeCapability(&MainCapability); 
    835838#endif 
     839    traceCapsetDelete(CAPSET_OSPROCESS_DEFAULT); 
    836840} 
    837841 
    838842/* --------------------------------------------------------------------------- 
  • rts/RtsProbes.d

    diff --git a/rts/RtsProbes.d b/rts/RtsProbes.d
    index dbc5111..bd32fca 100644
    a b  
    2323 * typedef uint16_t EventCapNo; 
    2424 * typedef uint16_t EventPayloadSize; // variable-size events 
    2525 * typedef uint16_t EventThreadStatus; 
     26 * typedef uint32_t EventCapsetID; 
     27 * typedef uint16_t EventCapsetType;  // types for EVENT_CAPSET_CREATE 
    2628 */ 
    2729 
    2830/* ----------------------------------------------------------------------------- 
     
    6062  probe gc__idle (EventCapNo); 
    6163  probe gc__work (EventCapNo); 
    6264  probe gc__done (EventCapNo); 
     65  probe capset__create(EventCapsetID, EventCapsetType); 
     66  probe capset__delete(EventCapsetID); 
     67  probe capset__assign__cap(EventCapsetID, EventCapNo); 
     68  probe capset__remove__cap(EventCapsetID, EventCapNo); 
    6369 
    6470}; 
  • rts/RtsStartup.c

    diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
    index 236d07a..502906e 100644
    a b  
    148148     */ 
    149149    dtraceEventStartup(); 
    150150 
     151    /* Trace some basic information about the process 
     152     */ 
     153    traceCapsetDetails(argc, argv); 
     154 
    151155    /* initialise scheduler data structures (needs to be done before 
    152156     * initStorage()). 
    153157     */ 
  • rts/Schedule.c

    diff --git a/rts/Schedule.c b/rts/Schedule.c
    index f5cb568..cda6d08 100644
    a b  
    20302030    } 
    20312031    sched_state = SCHED_SHUTTING_DOWN; 
    20322032 
     2033    nat i; 
     2034 
     2035    for (i = 0; i < n_capabilities; i++) { 
    20332036#if defined(THREADED_RTS) 
    2034     {  
    2035         nat i; 
    2036          
    2037         for (i = 0; i < n_capabilities; i++) { 
    2038             ASSERT(task->incall->tso == NULL); 
    2039             shutdownCapability(&capabilities[i], task, wait_foreign); 
    2040         } 
    2041     } 
     2037        ASSERT(task->incall->tso == NULL); 
     2038        shutdownCapability(&capabilities[i], task, wait_foreign); 
    20422039#endif 
     2040        traceCapsetRemoveCap(CAPSET_OSPROCESS_DEFAULT, i); 
     2041    } 
     2042    traceCapsetDelete(CAPSET_OSPROCESS_DEFAULT); 
    20432043 
    20442044    boundTaskExiting(task); 
    20452045} 
  • rts/Trace.c

    diff --git a/rts/Trace.c b/rts/Trace.c
    index f2f9e81..fb8e922 100644
    a b  
    2020#include "Threads.h" 
    2121#include "Printer.h" 
    2222 
     23#ifdef HAVE_UNISTD_H 
     24#include <unistd.h> 
     25#endif 
     26 
    2327#ifdef DEBUG 
    2428// debugging flags, set with +RTS -D<something> 
    2529int DEBUG_sched; 
     
    251255    } 
    252256} 
    253257 
     258void traceCapsetModify_ (EventTypeNum tag, 
     259                         CapsetID capset, 
     260                         StgWord32 other, 
     261                         StgWord32 other2) 
     262{ 
     263#ifdef DEBUG 
     264    if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { 
     265        ACQUIRE_LOCK(&trace_utx); 
     266 
     267        tracePreface(); 
     268        switch (tag) { 
     269        case EVENT_CAPSET_CREATE:   // (capset, capset_type) 
     270            debugBelch("created capset %d of type %d\n", capset, other); 
     271            break; 
     272        case EVENT_CAPSET_DELETE:   // (capset) 
     273            debugBelch("deleted capset %d\n", capset); 
     274            break; 
     275        case EVENT_CAPSET_ASSIGN_CAP:  // (capset, capno) 
     276            debugBelch("assigned cap %d to capset %d\n", other, capset); 
     277            break; 
     278        case EVENT_CAPSET_REMOVE_CAP:  // (capset, capno) 
     279            debugBelch("removed cap %d from capset %d\n", other, capset); 
     280            break; 
     281        } 
     282        RELEASE_LOCK(&trace_utx); 
     283    } else 
     284#endif 
     285    { 
     286        if(eventlog_enabled) postCapsetModifyEvent(tag, capset, other, other2); 
     287    } 
     288} 
     289 
     290extern char **environ; 
     291 
     292void traceCapsetDetails_(int *argc, char **argv[]){ 
     293    if(eventlog_enabled){ 
     294        postCapsetModifyEvent(EVENT_OSPROCESS_PID, 
     295                              CAPSET_OSPROCESS_DEFAULT, 
     296                              getpid(), 
     297                              getppid()); 
     298 
     299        char buf[256]; 
     300        snprintf(buf, sizeof(buf), "GHC-%s %s", ProjectVersion, RtsWay); 
     301        postCapsetStrEvent(EVENT_RTS_IDENTIFIER, 
     302                           CAPSET_OSPROCESS_DEFAULT, 
     303                           buf); 
     304 
     305        if(argc != NULL && argv != NULL){ 
     306            postCapsetVecEvent(EVENT_PROGRAM_ARGS, 
     307                               CAPSET_OSPROCESS_DEFAULT, 
     308                               *argc, 
     309                               *argv); 
     310        } 
     311 
     312        int env_len; 
     313        for( env_len = 0; environ[env_len] != NULL; env_len++); 
     314        postCapsetVecEvent(EVENT_PROGRAM_ENV, 
     315                           CAPSET_OSPROCESS_DEFAULT, 
     316                           env_len, 
     317                           environ); 
     318    } 
     319} 
     320 
    254321void traceEvent_ (Capability *cap, EventTypeNum tag) 
    255322{ 
    256323#ifdef DEBUG 
  • rts/Trace.h

    diff --git a/rts/Trace.h b/rts/Trace.h
    index 6209156..04075ad 100644
    a b  
    3131 
    3232#endif /* TRACING */ 
    3333 
     34typedef StgWord32 CapsetID; 
     35typedef StgWord16 CapsetType; 
     36enum CapsetType { CapsetTypeCustom = CAPSET_TYPE_CUSTOM, 
     37                  CapsetTypeOsProcess = CAPSET_TYPE_OSPROCESS, 
     38                  CapsetTypeClockdomain = CAPSET_TYPE_CLOCKDOMAIN }; 
     39#define CAPSET_OSPROCESS_DEFAULT 0 
     40 
    3441// ----------------------------------------------------------------------------- 
    3542// Message classes 
    3643// ----------------------------------------------------------------------------- 
     
    160167 
    161168void traceThreadStatus_ (StgTSO *tso); 
    162169 
     170/* 
     171 * Events for describing capability sets in the eventlog 
     172 * 
     173 * Note: unlike other events, these are not conditional on TRACE_sched or 
     174 * similar because they are not "real" events themselves but provide 
     175 * information and context for other "real" events. Other events depend on 
     176 * the capset info events so for simplicity, rather than working out if 
     177 * they're necessary we always emit them. They should be very low volume. 
     178 */ 
     179void traceCapsetModify_ (EventTypeNum tag, 
     180                         CapsetID capset, 
     181                         StgWord32 other, 
     182                         StgWord32 other2); 
     183 
     184void traceCapsetDetails_ (int *argc, char **argv[]); 
    163185#else /* !TRACING */ 
    164186 
    165187#define traceSchedEvent(cap, tag, tso, other) /* nothing */ 
     
    170192#define debugTrace(class, str, ...) /* nothing */ 
    171193#define debugTraceCap(class, cap, str, ...) /* nothing */ 
    172194#define traceThreadStatus(class, tso) /* nothing */ 
     195#define traceCapsetModify_(tag, capset, other, other2) /* nothing */ 
     196#define traceCapsetDetails_(argc, argv) /* nothing */ 
    173197 
    174198#endif /* TRACING */ 
    175199 
     
    226250    HASKELLEVENT_GC_WORK(cap) 
    227251#define dtraceGcDone(cap)                               \ 
    228252    HASKELLEVENT_GC_DONE(cap) 
     253#define dtraceCapsetCreate(capset, capset_type)         \ 
     254    HASKELLEVENT_CAPSET_CREATE(capset, capset_type) 
     255#define dtraceCapsetDelete(capset)                      \ 
     256    HASKELLEVENT_CAPSET_DELETE(capset) 
     257#define dtraceCapsetAssignCap(capset, capno)            \ 
     258    HASKELLEVENT_CAPSET_ASSIGN_CAP(capset, capno) 
     259#define dtraceCapsetRemoveCap(capset, capno)            \ 
     260    HASKELLEVENT_CAPSET_REMOVE_CAP(capset, capno) 
    229261 
    230262#else /* !defined(DTRACE) */ 
    231263 
     
    248280#define dtraceGcIdle(cap)                               /* nothing */ 
    249281#define dtraceGcWork(cap)                               /* nothing */ 
    250282#define dtraceGcDone(cap)                               /* nothing */ 
     283#define dtraceCapsetCreate(capset, capset_type)         /* nothing */ 
     284#define dtraceCapsetDelete(capset)                      /* nothing */ 
     285#define dtraceCapsetAssignCap(capset, capno)            /* nothing */ 
     286#define dtraceCapsetRemoveCap(capset, capno)            /* nothing */ 
    251287 
    252288#endif 
    253289 
     
    405441    dtraceGcDone((EventCapNo)cap->no); 
    406442} 
    407443 
     444INLINE_HEADER void traceCapsetCreate(CapsetID   capset      STG_UNUSED, 
     445                                     CapsetType capset_type STG_UNUSED) 
     446{ 
     447    traceCapsetModify_(EVENT_CAPSET_CREATE, capset, capset_type, 0); 
     448    dtraceCapsetCreate(capset, capset_type); 
     449} 
     450 
     451INLINE_HEADER void traceCapsetDelete(CapsetID capset STG_UNUSED) 
     452{ 
     453    traceCapsetModify_(EVENT_CAPSET_DELETE, capset, 0, 0); 
     454    dtraceCapsetDelete(capset); 
     455} 
     456 
     457INLINE_HEADER void traceCapsetAssignCap(CapsetID capset STG_UNUSED, 
     458                                        nat      capno  STG_UNUSED) 
     459{ 
     460    traceCapsetModify_(EVENT_CAPSET_ASSIGN_CAP, capset, capno, 0); 
     461    dtraceCapsetAssignCap(capset, capno); 
     462} 
     463 
     464INLINE_HEADER void traceCapsetRemoveCap(CapsetID capset STG_UNUSED, 
     465                                        nat      capno  STG_UNUSED) 
     466{ 
     467    traceCapsetModify_(EVENT_CAPSET_REMOVE_CAP, capset, capno, 0); 
     468    dtraceCapsetRemoveCap(capset, capno); 
     469} 
     470 
     471INLINE_HEADER void traceCapsetDetails(int *argc STG_UNUSED, char **argv[] STG_UNUSED) 
     472{ 
     473    traceCapsetCreate(CAPSET_OSPROCESS_DEFAULT, CapsetTypeOsProcess); 
     474    traceCapsetDetails_(argc, argv); 
     475} 
     476 
    408477#include "EndPrivate.h" 
    409478 
    410479#endif /* TRACE_H */ 
  • rts/eventlog/EventLog.c

    diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
    index a77c257..d2e3de3 100644
    a b  
    7575  [EVENT_GC_IDLE]             = "GC idle", 
    7676  [EVENT_GC_WORK]             = "GC working", 
    7777  [EVENT_GC_DONE]             = "GC done", 
    78   [EVENT_BLOCK_MARKER]        = "Block marker" 
     78  [EVENT_BLOCK_MARKER]        = "Block marker", 
     79  [EVENT_CAPSET_CREATE]       = "Create capability set", 
     80  [EVENT_CAPSET_DELETE]       = "Delete capability set", 
     81  [EVENT_CAPSET_ASSIGN_CAP]   = "Add capability to capability set", 
     82  [EVENT_CAPSET_REMOVE_CAP]   = "Remove capability from capability set", 
     83  [EVENT_RTS_IDENTIFIER]      = "Identify the RTS version", 
     84  [EVENT_PROGRAM_ARGS]        = "Identify the program arguments", 
     85  [EVENT_PROGRAM_ENV]         = "Identify the environment variables", 
     86  [EVENT_OSPROCESS_PID]       = "Identify the process ID of a capability set" 
    7987}; 
    8088 
    8189// Event type.  
     
    146154static inline void postCapNo(EventsBuf *eb, EventCapNo no) 
    147155{ postWord16(eb,no); } 
    148156 
     157static inline void postCapsetID(EventsBuf *eb, EventCapsetID id) 
     158{ postWord32(eb,id); } 
     159 
     160static inline void postCapsetType(EventsBuf *eb, EventCapsetType type) 
     161{ postWord16(eb,type); } 
     162 
    149163static inline void postPayloadSize(EventsBuf *eb, EventPayloadSize size) 
    150164{ postWord16(eb,size); } 
    151165 
     
    259273            eventTypes[t].size = sizeof(EventCapNo); 
    260274            break; 
    261275 
     276        case EVENT_CAPSET_CREATE:   // (capset, capset_type) 
     277            eventTypes[t].size = 
     278                sizeof(EventCapsetID) + sizeof(EventCapsetType); 
     279            break; 
     280 
     281        case EVENT_CAPSET_DELETE:   // (capset) 
     282            eventTypes[t].size = sizeof(EventCapsetID); 
     283            break; 
     284 
     285        case EVENT_CAPSET_ASSIGN_CAP:  // (capset, cap) 
     286        case EVENT_CAPSET_REMOVE_CAP: 
     287            eventTypes[t].size = 
     288                sizeof(EventCapsetID) + sizeof(EventCapNo); 
     289            break; 
     290 
     291        case EVENT_OSPROCESS_PID: // (cap, pid, parent pid) 
     292            eventTypes[t].size = 
     293                sizeof(EventCapsetID) + 2*sizeof(StgWord32); 
     294            break; 
     295 
    262296        case EVENT_SHUTDOWN:        // (cap) 
    263297        case EVENT_REQUEST_SEQ_GC:  // (cap) 
    264298        case EVENT_REQUEST_PAR_GC:  // (cap) 
     
    272306 
    273307        case EVENT_LOG_MSG:          // (msg) 
    274308        case EVENT_USER_MSG:         // (msg) 
     309        case EVENT_RTS_IDENTIFIER:   // (capset, str) 
     310        case EVENT_PROGRAM_ARGS:     // (capset, strvec) 
     311        case EVENT_PROGRAM_ENV:      // (capset, strvec) 
    275312            eventTypes[t].size = 0xffff; 
    276313            break; 
    277314 
     
    443480    } 
    444481} 
    445482 
     483void postCapsetModifyEvent (EventTypeNum tag, 
     484                            EventCapsetID capset, 
     485                            StgWord32 other, 
     486                            StgWord32 other2) 
     487{ 
     488    ACQUIRE_LOCK(&eventBufMutex); 
     489 
     490    if (!hasRoomForEvent(&eventBuf, tag)) { 
     491        // Flush event buffer to make room for new event. 
     492        printAndClearEventBuf(&eventBuf); 
     493    } 
     494 
     495    postEventHeader(&eventBuf, tag); 
     496    postCapsetID(&eventBuf, capset); 
     497 
     498    switch (tag) { 
     499    case EVENT_CAPSET_CREATE:   // (capset, capset_type) 
     500    { 
     501        postCapsetType(&eventBuf, other /* capset_type */); 
     502        break; 
     503    } 
     504 
     505    case EVENT_CAPSET_DELETE:   // (capset) 
     506    { 
     507        break; 
     508    } 
     509 
     510    case EVENT_CAPSET_ASSIGN_CAP:  // (capset, capno) 
     511    case EVENT_CAPSET_REMOVE_CAP:  // (capset, capno) 
     512    { 
     513        postCapNo(&eventBuf, other /* capno */); 
     514        break; 
     515    } 
     516    case EVENT_OSPROCESS_PID: 
     517    { 
     518        postWord32(&eventBuf, other); 
     519        postWord32(&eventBuf, other2); 
     520        break; 
     521    } 
     522    default: 
     523        barf("postCapsetModifyEvent: unknown event tag %d", tag); 
     524    } 
     525 
     526    RELEASE_LOCK(&eventBufMutex); 
     527} 
     528 
     529void postCapsetStrEvent (EventTypeNum tag, 
     530                         EventCapsetID capset, 
     531                         char *msg) 
     532{ 
     533    int strsize = strlen(msg); 
     534    int size = strsize + sizeof(EventCapsetID) 
     535 
     536    ACQUIRE_LOCK(&eventBufMutex); 
     537 
     538    if (!hasRoomForVariableEvent(&eventBuf, size)){ 
     539        printAndClearEventBuf(&eventBuf); 
     540 
     541        if (!hasRoomForVariableEvent(&eventBuf, size)){ 
     542            // Event size exceeds buffer size, bail out: 
     543            RELEASE_LOCK(&eventBufMutex); 
     544            return; 
     545        } 
     546    } 
     547 
     548    postEventHeader(&eventBuf, tag); 
     549    postPayloadSize(&eventBuf, size); 
     550    postCapsetID(&eventBuf, capset); 
     551 
     552    postBuf(&eventBuf, (StgWord8*) msg, strsize); 
     553 
     554    RELEASE_LOCK(&eventBufMutex); 
     555} 
     556 
     557void postCapsetVecEvent (EventTypeNum tag, 
     558                         EventCapsetID capset, 
     559                         int argc, 
     560                         char *argv[]) 
     561{ 
     562    int i, size = sizeof(EventCapsetID); 
     563 
     564    for (i = 0; i < argc; i++) { 
     565        // 1 + strlen to account for the trailing \0, used as separator 
     566        size += 1 + strlen(argv[i]); 
     567    } 
     568 
     569    ACQUIRE_LOCK(&eventBufMutex); 
     570 
     571    if (!hasRoomForVariableEvent(&eventBuf, size)){ 
     572        printAndClearEventBuf(&eventBuf); 
     573 
     574        if(!hasRoomForVariableEvent(&eventBuf, size)){ 
     575            // Event size exceeds buffer size, bail out: 
     576            RELEASE_LOCK(&eventBufMutex); 
     577            return; 
     578        } 
     579    } 
     580 
     581    postEventHeader(&eventBuf, tag); 
     582    postPayloadSize(&eventBuf, size); 
     583    postCapsetID(&eventBuf, capset); 
     584 
     585    for( i = 0; i < argc; i++ ) { 
     586        // again, 1 + to account for \0 
     587        postBuf(&eventBuf, (StgWord8*) argv[i], 1 + strlen(argv[i])); 
     588    } 
     589 
     590    RELEASE_LOCK(&eventBufMutex); 
     591} 
     592 
    446593void 
    447594postEvent (Capability *cap, EventTypeNum tag) 
    448595{ 
  • rts/eventlog/EventLog.h

    diff --git a/rts/eventlog/EventLog.h b/rts/eventlog/EventLog.h
    index 0cfab5c..26a2e94 100644
    a b  
    3535                    StgThreadID id, StgWord info1, StgWord info2); 
    3636 
    3737/* 
     38 * Post a capability set modification event 
     39 */ 
     40void postCapsetModifyEvent (EventTypeNum tag, 
     41                            EventCapsetID capset, 
     42                            StgWord32 other, 
     43                            StgWord32 other2); 
     44 
     45/* 
     46 * Post a capability set event with a string payload 
     47 */ 
     48void postCapsetStrEvent (EventTypeNum tag, 
     49                         EventCapsetID capset, 
     50                         char *msg); 
     51 
     52/* 
     53 * Post a capability set event with several strings payload 
     54 */ 
     55void postCapsetVecEvent (EventTypeNum tag, 
     56                         EventCapsetID capset, 
     57                         int argc, 
     58                         char *msg[]); 
     59 
     60/* 
    3861 * Post a nullary event. 
    3962 */ 
    4063void postEvent(Capability *cap, EventTypeNum tag); 
     
    5477                                   StgWord info2    STG_UNUSED) 
    5578{ /* nothing */ } 
    5679 
     80INLINE_HEADER void postCapsetModifyEvent (EventTypeNum tag     STG_UNUSED, 
     81                                          EventCapsetID capset STG_UNUSED, 
     82                                          StgWord32 other      STG_UNUSED, 
     83                                          StgWord32 other2     STG_UNUSED) 
     84{ /* nothing */ } 
     85 
    5786INLINE_HEADER void postEvent (Capability *cap  STG_UNUSED, 
    5887                              EventTypeNum tag STG_UNUSED) 
    5988{ /* nothing */ } 
  • rts/ghc.mk

    diff --git a/rts/ghc.mk b/rts/ghc.mk
    index df68bc5..a7d28e0 100644
    a b  
    295295 
    296296rts/RtsMessages_CC_OPTS += -DProjectVersion=\"$(ProjectVersion)\" 
    297297rts/RtsUtils_CC_OPTS += -DProjectVersion=\"$(ProjectVersion)\" 
     298rts/Trace_CC_OPTS += -DProjectVersion=\"$(ProjectVersion)\" 
    298299# 
    299300rts/RtsUtils_CC_OPTS += -DHostPlatform=\"$(HOSTPLATFORM)\" 
    300301rts/RtsUtils_CC_OPTS += -DHostArch=\"$(HostArch_CPP)\"