summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2018-08-01 11:38:39 -0700
committerGitHub <noreply@github.com>2018-08-01 11:38:39 -0700
commitc4c16723a83c995838508ed7bca7fb99687f6d40 (patch)
tree353e30ee3936156ca831264a2292a248af06d825 /src/pal
parent2293351dc5eeb00681c38b3c1e5975b4d1ce3609 (diff)
downloadcoreclr-c4c16723a83c995838508ed7bca7fb99687f6d40.tar.gz
coreclr-c4c16723a83c995838508ed7bca7fb99687f6d40.tar.bz2
coreclr-c4c16723a83c995838508ed7bca7fb99687f6d40.zip
Expose OSThreadId and TimeStamp on EventWrittenEventArgs (#19002)
* Add EventWrittenEventArgs public properties OSThreadId and TimeStamp and plumb through OSThreadId. * Plumb ActivityId and RelatedActivityId to EventListener.
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/inc/pal.h6
-rw-r--r--src/pal/src/thread/thread.cpp25
2 files changed, 31 insertions, 0 deletions
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 98d0ae2f11..993d76ed9e 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -1267,6 +1267,12 @@ PALAPI
GetCurrentThreadId(
VOID);
+PALIMPORT
+size_t
+PALAPI
+PAL_GetCurrentOSThreadId(
+ VOID);
+
// To work around multiply-defined symbols in the Carbon framework.
#define GetCurrentThread PAL_GetCurrentThread
PALIMPORT
diff --git a/src/pal/src/thread/thread.cpp b/src/pal/src/thread/thread.cpp
index bc06d2f7d4..66311edb03 100644
--- a/src/pal/src/thread/thread.cpp
+++ b/src/pal/src/thread/thread.cpp
@@ -399,6 +399,31 @@ GetCurrentThreadId(
return dwThreadId;
}
+/*++
+Function:
+ PAL_GetCurrentOSThreadId
+
+Returns the current thread's OS thread ID.
+This API is functionally equivalent to GetCurrentThreadId, but does not truncate the return value to 32-bits.
+This is needed to ensure that we can provide the correct OS thread ID on platforms such as OSX that have a 64-bit thread ID.
+--*/
+size_t
+PALAPI
+PAL_GetCurrentOSThreadId(
+ VOID)
+{
+ size_t threadId;
+
+ PERF_ENTRY(PAL_GetCurrentOSThreadId);
+ ENTRY("PAL_GetCurrentOSThreadId()\n");
+
+ threadId = THREADSilentGetCurrentThreadId();
+
+ LOGEXIT("PAL_GetCurrentOSThreadId returns %p\n", threadId);
+ PERF_EXIT(GetCurrentThreadId);
+
+ return threadId;
+}
/*++