diff options
-rw-r--r-- | rts/Hpc.c | 9 | ||||
-rw-r--r-- | rts/Trace.c | 9 | ||||
-rw-r--r-- | rts/eventlog/EventLogWriter.c | 4 |
3 files changed, 20 insertions, 2 deletions
@@ -203,7 +203,9 @@ startupHpc(void) return; } hpc_inited = 1; +#if defined(HAVE_GETPID) hpc_pid = getpid(); +#endif hpc_tixdir = getenv("HPCTIXDIR"); hpc_tixfile = getenv("HPCTIXFILE"); @@ -387,7 +389,12 @@ exitHpc(void) { // Any sub-process from use of fork from inside Haskell will // not clobber the .tix file. - if (hpc_pid == getpid()) { +#if defined(HAVE_GETPID) + bool is_subprocess = hpc_pid != getpid(); +#else + bool is_subprocess = false; +#endif + if (!is_subprocess) { FILE *f = __rts_fopen(tixFilename,"w+"); writeTix(f); } diff --git a/rts/Trace.c b/rts/Trace.c index 30db2a704c..18bb827cc4 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -485,11 +485,14 @@ void traceWallClockTime_(void) { void traceOSProcessInfo_(void) { if (eventlog_enabled) { + +#if defined(HAVE_GETPID) postCapsetEvent(EVENT_OSPROCESS_PID, CAPSET_OSPROCESS_DEFAULT, getpid()); +#endif -#if !defined(mingw32_HOST_OS) +#if !defined(mingw32_HOST_OS) && defined(HAVE_GETPID) /* Windows has no strong concept of process hierarchy, so no getppid(). * In any case, this trace event is mainly useful for tracing programs * that use 'forkProcess' which Windows doesn't support anyway. @@ -605,7 +608,11 @@ void traceTaskCreate_ (Task *task, #endif { EventTaskId taskid = serialisableTaskId(task); +#if !defined(HAVE_GETPID) + EventKernelThreadId tid = 0; +#else EventKernelThreadId tid = kernelThreadId(); +#endif postTaskCreateEvent(taskid, cap->no, tid); } } diff --git a/rts/eventlog/EventLogWriter.c b/rts/eventlog/EventLogWriter.c index daa6dc3c9d..984b2afb5d 100644 --- a/rts/eventlog/EventLogWriter.c +++ b/rts/eventlog/EventLogWriter.c @@ -68,6 +68,9 @@ static char *outputFileName(void) + 10 /* .eventlog */, "initEventLogFileWriter"); +#if !defined(HAVE_GETPID) + sprintf(filename, "%s.eventlog", prog); +#else if (event_log_pid == -1) { // #4512 // Single process sprintf(filename, "%s.eventlog", prog); @@ -82,6 +85,7 @@ static char *outputFileName(void) sprintf(filename, "%s.%" FMT_Word64 ".eventlog", prog, (StgWord64)event_log_pid); } +#endif stgFree(prog); return filename; } |