X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=rts%2FTrace.c;h=e472c5ade78f3f56f10a6118d512a83ec4f0d645;hp=fb8e9226afb4473b5dfe1d44ca10bcbe19b046ac;hb=b2524b3960999fffdb3767900f58825903f6560f;hpb=58532eb46041aec8d4cbb48b054cb5b001edb43c diff --git a/rts/Trace.c b/rts/Trace.c index fb8e922..e472c5a 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -15,6 +15,7 @@ #ifdef TRACING #include "GetTime.h" +#include "GetEnv.h" #include "Stats.h" #include "eventlog/EventLog.h" #include "Threads.h" @@ -257,8 +258,7 @@ void traceSchedEvent_ (Capability *cap, EventTypeNum tag, void traceCapsetModify_ (EventTypeNum tag, CapsetID capset, - StgWord32 other, - StgWord32 other2) + StgWord32 other) { #ifdef DEBUG if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { @@ -283,38 +283,53 @@ void traceCapsetModify_ (EventTypeNum tag, } else #endif { - if(eventlog_enabled) postCapsetModifyEvent(tag, capset, other, other2); + if (eventlog_enabled) { + postCapsetModifyEvent(tag, capset, other); + } } } -extern char **environ; - -void traceCapsetDetails_(int *argc, char **argv[]){ - if(eventlog_enabled){ +void traceOSProcessInfo_(void) { + if (eventlog_enabled) { postCapsetModifyEvent(EVENT_OSPROCESS_PID, CAPSET_OSPROCESS_DEFAULT, - getpid(), + getpid()); + +#if !defined(cygwin32_HOST_OS) && !defined (mingw32_HOST_OS) +/* Windows has no strong concept of process heirarchy, so no getppid(). + * In any case, this trace event is mainly useful for tracing programs + * that use 'forkProcess' which Windows doesn't support anyway. + */ + postCapsetModifyEvent(EVENT_OSPROCESS_PPID, + CAPSET_OSPROCESS_DEFAULT, getppid()); - - char buf[256]; - snprintf(buf, sizeof(buf), "GHC-%s %s", ProjectVersion, RtsWay); - postCapsetStrEvent(EVENT_RTS_IDENTIFIER, - CAPSET_OSPROCESS_DEFAULT, - buf); - - if(argc != NULL && argv != NULL){ - postCapsetVecEvent(EVENT_PROGRAM_ARGS, +#endif + { + char buf[256]; + snprintf(buf, sizeof(buf), "GHC-%s %s", ProjectVersion, RtsWay); + postCapsetStrEvent(EVENT_RTS_IDENTIFIER, CAPSET_OSPROCESS_DEFAULT, - *argc, - *argv); + buf); + } + { + int argc = 0; char **argv; + getFullProgArgv(&argc, &argv); + if (argc != 0) { + postCapsetVecEvent(EVENT_PROGRAM_ARGS, + CAPSET_OSPROCESS_DEFAULT, + argc, argv); + } + } + { + int envc = 0; char **envv; + getProgEnvv(&envc, &envv); + if (envc != 0) { + postCapsetVecEvent(EVENT_PROGRAM_ENV, + CAPSET_OSPROCESS_DEFAULT, + envc, envv); + } + freeProgEnvv(envc, envv); } - - int env_len; - for( env_len = 0; environ[env_len] != NULL; env_len++); - postCapsetVecEvent(EVENT_PROGRAM_ENV, - CAPSET_OSPROCESS_DEFAULT, - env_len, - environ); } } @@ -426,6 +441,12 @@ void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG) } } +void traceEventStartup_(int nocaps) +{ + if (eventlog_enabled) { + postEventStartup(nocaps); + } +} #ifdef DEBUG void traceBegin (const char *str, ...)