未验证 提交 cc14d20c 编写于 作者: L Lakshan Fernando 提交者: GitHub

Tag events with thread specific information (#89516)

* Tagging events with thread specific information

* FB

* Update src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.cpp
Co-authored-by: NElinor Fung <elfung@microsoft.com>

* Remove stale comments

---------
Co-authored-by: NElinor Fung <elfung@microsoft.com>
上级 43e47b8e
......@@ -20,6 +20,9 @@
#include <minipal/random.h>
#include "gcenv.h"
#include "thread.h"
#include "threadstore.h"
#include "threadstore.inl"
#ifndef DIRECTORY_SEPARATOR_CHAR
#ifdef TARGET_UNIX
......@@ -56,7 +59,7 @@ ep_rt_aot_walk_managed_stack_for_thread (
ep_rt_thread_handle_t thread,
EventPipeStackContents *stack_contents)
{
PalDebugBreak();
// NativeAOT does not support getting the call stack
return false;
}
......@@ -826,6 +829,15 @@ void ep_rt_aot_create_activity_id (uint8_t *activity_id, uint32_t activity_id_le
#endif
}
ep_rt_thread_handle_t ep_rt_aot_thread_get_handle (void)
{
return ThreadStore::GetCurrentThreadIfAvailable();
}
ep_rt_thread_id_t ep_rt_aot_thread_get_id (ep_rt_thread_handle_t thread_handle)
{
return thread_handle->GetPalThreadIdForLogging();
}
#ifdef EP_CHECKED_BUILD
......
......@@ -491,7 +491,7 @@ ep_rt_config_value_get_enable_stackwalk (void)
if (RhConfig::Environment::TryGetBooleanValue("EventPipeEnableStackwalk", &value))
return value;
return true;
return false;
}
/*
......@@ -1550,10 +1550,9 @@ ep_rt_thread_handle_t
ep_rt_thread_get_handle (void)
{
STATIC_CONTRACT_NOTHROW;
// shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
// TODO: Implement thread creation/management if needed
// return GetThreadNULLOk ();
return NULL;
extern ep_rt_thread_handle_t ep_rt_aot_thread_get_handle (void);
return ep_rt_aot_thread_get_handle();
}
static
......@@ -1562,13 +1561,9 @@ ep_rt_thread_id_t
ep_rt_thread_get_id (ep_rt_thread_handle_t thread_handle)
{
STATIC_CONTRACT_NOTHROW;
EP_ASSERT (thread_handle != NULL);
// shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
// TODO: Implement thread creation/management if needed
// return ep_rt_uint64_t_to_thread_id_t (thread_handle->GetOSThreadId64 ());
// PalDebugBreak();
return 0;
extern ep_rt_thread_id_t ep_rt_aot_thread_get_id (ep_rt_thread_handle_t thread_handle);
return ep_rt_aot_thread_get_id(thread_handle);
}
static
......@@ -1605,11 +1600,7 @@ ep_rt_thread_activity_id_handle_t
ep_rt_thread_get_activity_id_handle (void)
{
STATIC_CONTRACT_NOTHROW;
// shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
// TODO: Implement thread creation/management if needed
// return GetThread ();
// PalDebugBreak();
return NULL;
return ep_rt_thread_get_or_create();
}
static
......@@ -1617,13 +1608,7 @@ inline
const uint8_t *
ep_rt_thread_get_activity_id_cref (ep_rt_thread_activity_id_handle_t activity_id_handle)
{
STATIC_CONTRACT_NOTHROW;
EP_ASSERT (activity_id_handle != NULL);
// shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
// TODO: Implement thread creation/management if needed
// return reinterpret_cast<const uint8_t *>(activity_id_handle->GetActivityId ());
// PalDebugBreak();
EP_UNREACHABLE ("EP_THREAD_INCLUDE_ACTIVITY_ID should have been defined on NativeAOT");
return NULL;
}
......@@ -1640,7 +1625,7 @@ ep_rt_thread_get_activity_id (
EP_ASSERT (activity_id != NULL);
EP_ASSERT (activity_id_len == EP_ACTIVITY_ID_SIZE);
memcpy (activity_id, ep_rt_thread_get_activity_id_cref (activity_id_handle), EP_ACTIVITY_ID_SIZE);
memcpy (activity_id, ep_thread_get_activity_id_cref (activity_id_handle), EP_ACTIVITY_ID_SIZE);
}
static
......@@ -1656,10 +1641,7 @@ ep_rt_thread_set_activity_id (
EP_ASSERT (activity_id != NULL);
EP_ASSERT (activity_id_len == EP_ACTIVITY_ID_SIZE);
// shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
// TODO: Implement thread creation/management if needed
// activity_id_handle->SetActivityId (reinterpret_cast<LPCGUID>(activity_id));
// PalDebugBreak();
memcpy (ep_thread_get_activity_id_ref (activity_id_handle), activity_id, EP_ACTIVITY_ID_SIZE);
}
#undef EP_YIELD_WHILE
......
......@@ -4,4 +4,6 @@
#ifndef EVENTPIPE_RT_CONFIG_AOT_H
#define EVENTPIPE_RT_CONFIG_AOT_H
#define EP_THREAD_INCLUDE_ACTIVITY_ID
#endif /* EVENTPIPE_RT_CONFIG_AOT_H */
......@@ -78,14 +78,10 @@ typedef struct _rt_aot_lock_internal_t ep_rt_spin_lock_handle_t;
typedef class Thread * ep_rt_thread_handle_t;
#undef ep_rt_thread_activity_id_handle_t
typedef class Thread * ep_rt_thread_activity_id_handle_t;
typedef EventPipeThread * ep_rt_thread_activity_id_handle_t;
#undef ep_rt_thread_id_t
// #ifndef TARGET_UNIX
// typedef DWORD ep_rt_thread_id_t;
// #else
typedef size_t ep_rt_thread_id_t;
//#endif
#undef ep_rt_thread_start_func
typedef size_t (__stdcall *ep_rt_thread_start_func)(void *lpThreadParameter);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册