diff --git a/src/mono/mono/eventpipe/ds-ipc-posix.c b/src/mono/mono/eventpipe/ds-ipc-posix.c index 966c5294dfe69..979c7915c83b9 100644 --- a/src/mono/mono/eventpipe/ds-ipc-posix.c +++ b/src/mono/mono/eventpipe/ds-ipc-posix.c @@ -556,7 +556,7 @@ ds_ipc_close ( if (!is_shutdown) { int close_result; DS_ENTER_BLOCKING_PAL_SECTION; - close_result = close(ipc->server_socket); + close_result = close (ipc->server_socket); DS_EXIT_BLOCKING_PAL_SECTION; if (close_result == -1) { diff --git a/src/mono/mono/eventpipe/ds-rt-mono.c b/src/mono/mono/eventpipe/ds-rt-mono.c index e5fb6772957bb..0e1813dd8e75b 100644 --- a/src/mono/mono/eventpipe/ds-rt-mono.c +++ b/src/mono/mono/eventpipe/ds-rt-mono.c @@ -275,5 +275,4 @@ ipc_transport_get_default_name ( #endif /* !HOST_WIN32 */ #endif /* ENABLE_PERFTRACING */ -extern const char quiet_linker_empty_file_warning_diagnostics_rt_mono; -const char quiet_linker_empty_file_warning_diagnostics_rt_mono = 0; +MONO_EMPTY_SOURCE_FILE(diagnostics_rt_mono); diff --git a/src/mono/mono/eventpipe/ep-event-source.c b/src/mono/mono/eventpipe/ep-event-source.c index ff17400d52105..3d8a2c7abbcc2 100644 --- a/src/mono/mono/eventpipe/ep-event-source.c +++ b/src/mono/mono/eventpipe/ep-event-source.c @@ -15,14 +15,14 @@ #if defined(HOST_WINDOWS) || defined(HOST_WIN32) const ep_char8_t* _ep_os_info = "Windows"; -#elif defined(HOST_DARWIN) -const ep_char8_t* _ep_os_info = "macOS"; #elif defined(HOST_IOS) const ep_char8_t* _ep_os_info = "iOS"; #elif defined(HOST_WATCHOS) const ep_char8_t* _ep_os_info = "WatchOS"; #elif defined(HOST_TVOS) const ep_char8_t* _ep_os_info = "tvOS"; +#elif defined(__APPLE__) +const ep_char8_t* _ep_os_info = "macOS"; #elif defined(HOST_ANDROID) const ep_char8_t* _ep_os_info = "Android"; #elif defined(__linux__) diff --git a/src/mono/mono/eventpipe/ep-rt-mono.c b/src/mono/mono/eventpipe/ep-rt-mono.c index 7829e3030ba9b..c9e7bf5a5066e 100644 --- a/src/mono/mono/eventpipe/ep-rt-mono.c +++ b/src/mono/mono/eventpipe/ep-rt-mono.c @@ -56,7 +56,7 @@ ep_rt_mono_system_time_get (EventPipeSystemTime *system_time) } int64_t -ep_rt_mono_system_file_time_get (void) +ep_rt_mono_system_timestamp_get (void) { FILETIME value; GetSystemTimeAsFileTime (&value); @@ -216,7 +216,7 @@ system_time_to_int64 ( } int64_t -ep_rt_mono_system_file_time_get (void) +ep_rt_mono_system_timestamp_get (void) { #if HAVE_CLOCK_MONOTONIC struct timespec time; @@ -234,5 +234,4 @@ ep_rt_mono_system_file_time_get (void) #endif /* ENABLE_PERFTRACING */ -extern const char quiet_linker_empty_file_warning_eventpipe_rt_mono; -const char quiet_linker_empty_file_warning_eventpipe_rt_mono = 0; +MONO_EMPTY_SOURCE_FILE(eventpipe_rt_mono); diff --git a/src/mono/mono/eventpipe/ep-rt-mono.h b/src/mono/mono/eventpipe/ep-rt-mono.h index a9d3f21dd0fa9..d2d18fdebe30b 100644 --- a/src/mono/mono/eventpipe/ep-rt-mono.h +++ b/src/mono/mono/eventpipe/ep-rt-mono.h @@ -251,7 +251,7 @@ void ep_rt_mono_system_time_get (EventPipeSystemTime *system_time); int64_t -ep_rt_mono_system_file_time_get (void); +ep_rt_mono_system_timestamp_get (void); #ifndef EP_RT_MONO_USE_STATIC_RUNTIME static @@ -1150,9 +1150,9 @@ ep_rt_system_time_get (EventPipeSystemTime *system_time) static inline int64_t -ep_rt_system_file_time_get (void) +ep_rt_system_timestamp_get (void) { - return ep_rt_mono_system_file_time_get (); + return ep_rt_mono_system_timestamp_get (); } static @@ -1529,8 +1529,10 @@ ep_rt_thread_setup (bool background_thread) // NOTE, under netcore, only root domain exists. if (!mono_thread_current ()) { MonoThread *thread = mono_thread_attach (mono_get_root_domain ()); - if (background_thread && thread) + if (background_thread && thread) { mono_thread_set_state (thread, ThreadState_Background); + mono_thread_info_set_flags (MONO_THREAD_INFO_FLAGS_NO_SAMPLE); + } } #else ep_rt_mono_func_table_get ()->ep_rt_mono_thread_attach (background_thread); diff --git a/src/mono/mono/eventpipe/ep-rt.h b/src/mono/mono/eventpipe/ep-rt.h index 4db6d22d067d4..1d3d980bba0cd 100644 --- a/src/mono/mono/eventpipe/ep-rt.h +++ b/src/mono/mono/eventpipe/ep-rt.h @@ -436,7 +436,7 @@ ep_rt_system_time_get (EventPipeSystemTime *system_time); static int64_t -ep_rt_system_file_time_get (void); +ep_rt_system_timestamp_get (void); static int32_t diff --git a/src/mono/mono/eventpipe/ep-session.c b/src/mono/mono/eventpipe/ep-session.c index 99ba1233a6c1b..074fe6917f215 100644 --- a/src/mono/mono/eventpipe/ep-session.c +++ b/src/mono/mono/eventpipe/ep-session.c @@ -190,7 +190,7 @@ ep_session_alloc ( break; } - instance->session_start_time = ep_system_file_time_get (); + instance->session_start_time = ep_system_timestamp_get (); instance->session_start_timestamp = ep_perf_timestamp_get (); ep_on_exit: diff --git a/src/mono/mono/eventpipe/ep-session.h b/src/mono/mono/eventpipe/ep-session.h index fa74ea695bdcb..d26ca4dd75e30 100644 --- a/src/mono/mono/eventpipe/ep-session.h +++ b/src/mono/mono/eventpipe/ep-session.h @@ -37,7 +37,7 @@ struct _EventPipeSession_Internal { // For synchoronous sessions. EventPipeSessionSynchronousCallback synchronous_callback; // Start date and time in UTC. - ep_filetime_t session_start_time; + ep_system_timestamp_t session_start_time; // Start timestamp. ep_timestamp_t session_start_timestamp; uint32_t index; diff --git a/src/mono/mono/eventpipe/ep-types.h b/src/mono/mono/eventpipe/ep-types.h index 6bcf9ff7c8b2a..2d2b3044e964d 100644 --- a/src/mono/mono/eventpipe/ep-types.h +++ b/src/mono/mono/eventpipe/ep-types.h @@ -166,7 +166,7 @@ typedef uint64_t EventPipeSessionID; typedef char ep_char8_t; typedef unsigned short ep_char16_t; typedef int64_t ep_timestamp_t; -typedef int64_t ep_filetime_t; +typedef int64_t ep_system_timestamp_t; /* * EventPipe Callbacks. diff --git a/src/mono/mono/eventpipe/ep.h b/src/mono/mono/eventpipe/ep.h index 0f77b6eead49f..4d9693521f981 100644 --- a/src/mono/mono/eventpipe/ep.h +++ b/src/mono/mono/eventpipe/ep.h @@ -292,10 +292,10 @@ ep_perf_frequency_query (void) static inline -ep_filetime_t -ep_system_file_time_get (void) +ep_system_timestamp_t +ep_system_timestamp_get (void) { - return (ep_filetime_t)ep_rt_system_file_time_get (); + return (ep_system_timestamp_t)ep_rt_system_timestamp_get (); } static diff --git a/src/mono/mono/eventpipe/test/ep-rt-tests.c b/src/mono/mono/eventpipe/test/ep-rt-tests.c index aadd565c71044..5956237982c5e 100644 --- a/src/mono/mono/eventpipe/test/ep-rt-tests.c +++ b/src/mono/mono/eventpipe/test/ep-rt-tests.c @@ -122,14 +122,14 @@ test_rt_system_time (void) } static RESULT -test_rt_system_file_time (void) +test_rt_system_timestamp (void) { RESULT result = NULL; uint32_t test_location = 0; - ep_filetime_t start = ep_system_file_time_get (); + ep_system_timestamp_t start = ep_system_timestamp_get (); g_usleep (10 * 1000); - ep_filetime_t stop = ep_system_file_time_get (); + ep_system_timestamp_t stop = ep_system_timestamp_get (); test_location = 1; @@ -162,7 +162,7 @@ static Test ep_rt_tests [] = { {"test_rt_perf_frequency", test_rt_perf_frequency}, {"test_rt_perf_timestamp", test_rt_perf_timestamp}, {"test_rt_system_time", test_rt_system_time}, - {"test_rt_system_file_time", test_rt_system_file_time}, + {"test_rt_system_timestamp", test_rt_system_timestamp}, {"test_rt_teardown", test_rt_teardown}, {NULL, NULL} }; diff --git a/src/mono/mono/metadata/icall-eventpipe.c b/src/mono/mono/metadata/icall-eventpipe.c index 3dbfd8197cbed..15882204fde4a 100644 --- a/src/mono/mono/metadata/icall-eventpipe.c +++ b/src/mono/mono/metadata/icall-eventpipe.c @@ -114,8 +114,10 @@ eventpipe_thread_attach (gboolean background_thread) // NOTE, under netcore, only root domain exists. if (!mono_thread_current ()) { thread = mono_thread_attach (mono_get_root_domain ()); - if (background_thread) + if (background_thread) { mono_thread_set_state (thread, ThreadState_Background); + mono_thread_info_set_flags (MONO_THREAD_INFO_FLAGS_NO_SAMPLE); + } } return thread; @@ -601,4 +603,4 @@ ves_icall_System_Diagnostics_Tracing_EventPipeInternal_WriteEventData ( #endif /* ENABLE_PERFTRACING */ #endif /* ENABLE_NETCORE */ -MONO_EMPTY_SOURCE_FILE (eventpipe_rt_mono); +MONO_EMPTY_SOURCE_FILE (icall_eventpipe);