Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove public provider from rundown session #91383

Merged
merged 10 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-types-aot.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#define EP_ASSERT(expr)
#endif

#define EP_FAILFAST(msg)
davmason marked this conversation as resolved.
Show resolved Hide resolved

#undef EP_UNREACHABLE
#define EP_UNREACHABLE(msg) do { UNREACHABLE_MSG(msg); } while (0)

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/eventing/eventpipe/ep-rt-types-coreclr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define EP_ASSERT(expr)
#endif

#define EP_FAILFAST(msg) EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_FAILFAST, msg)

#undef EP_UNREACHABLE
#define EP_UNREACHABLE(msg) do { UNREACHABLE_MSG(msg); } while (0)

Expand Down
2 changes: 2 additions & 0 deletions src/mono/mono/eventpipe/ep-rt-types-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#undef EP_UNLIKELY
#define EP_UNLIKELY(expr) G_UNLIKELY(expr)

#define EP_FAILFAST(msg)
davmason marked this conversation as resolved.
Show resolved Hide resolved

struct _rt_mono_event_internal_t {
gpointer event;
};
Expand Down
15 changes: 15 additions & 0 deletions src/native/eventpipe/ep-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ ep_session_alloc (
instance->session_type = session_type;
instance->format = format;
instance->rundown_requested = rundown_requested;
instance->rundown_thread_id = 0;
instance->synchronous_callback = sync_callback;
instance->callback_additional_data = callback_additional_data;

Expand Down Expand Up @@ -348,6 +349,7 @@ ep_session_enable_rundown (EventPipeSession *session)
ep_raise_error_if_nok (ep_session_add_session_provider (session, session_provider));
}

ep_session_set_rundown_thread_id (session, ep_thread_get_os_thread_id (ep_thread_get ()));
ep_session_set_rundown_enabled (session, true);
result = true;

Expand Down Expand Up @@ -521,6 +523,19 @@ ep_session_write_event (

// Filter events specific to "this" session based on precomputed flag on provider/events.
if (ep_event_is_enabled_by_mask (ep_event, ep_session_get_mask (session))) {
if (ep_session_get_rundown_enabled (session) && (ep_session_get_rundown_thread_id (session) != ep_thread_get_os_thread_id (ep_thread_get ()))) {
EP_ASSERT (ep_session_get_rundown_thread_id (session) != 0);
return false;
}

if (ep_session_get_rundown_enabled (session) && (ep_session_get_rundown_thread_id (session) == ep_thread_get_os_thread_id (ep_thread_get ()))) {
davmason marked this conversation as resolved.
Show resolved Hide resolved
EventPipeProvider *provider = ep_event_get_provider (ep_event);
const ep_char8_t *provider_name = ep_provider_get_provider_name(provider);
if (ep_rt_utf8_string_compare_ignore_case (provider_name, "Microsoft-Windows-DotNETRuntimeRundown") != 0) {
EP_FAILFAST(L"Saw non rundown provider");
}
}

if (session->synchronous_callback) {
session->synchronous_callback (
ep_event_get_provider (ep_event),
Expand Down
4 changes: 4 additions & 0 deletions src/native/eventpipe/ep-session.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct _EventPipeSession_Internal {
uint32_t index;
// True if rundown is enabled.
volatile uint32_t rundown_enabled;
// ID of the thread performing rundown. Used to filter non rundown events
uint64_t rundown_thread_id;
// Data members used when an streaming thread is used.
volatile uint32_t streaming_enabled;
// The type of the session.
Expand Down Expand Up @@ -75,6 +77,8 @@ EP_DEFINE_GETTER(EventPipeSession *, session, uint32_t, index)
EP_DEFINE_GETTER(EventPipeSession *, session, EventPipeSessionProviderList *, providers)
EP_DEFINE_GETTER(EventPipeSession *, session, EventPipeBufferManager *, buffer_manager)
EP_DEFINE_GETTER_REF(EventPipeSession *, session, volatile uint32_t *, rundown_enabled)
EP_DEFINE_GETTER(EventPipeSession *, session, uint64_t, rundown_thread_id)
EP_DEFINE_SETTER(EventPipeSession *, session, uint64_t, rundown_thread_id)
EP_DEFINE_GETTER(EventPipeSession *, session, bool, rundown_requested)
EP_DEFINE_GETTER(EventPipeSession *, session, ep_timestamp_t, session_start_time)
EP_DEFINE_GETTER(EventPipeSession *, session, ep_timestamp_t, session_start_timestamp)
Expand Down
Loading