Skip to content

Commit

Permalink
Review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
lateralusX committed Oct 1, 2020
1 parent 5e53049 commit 013915f
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/mono/mono/eventpipe/ds-ipc-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions src/mono/mono/eventpipe/ds-rt-mono.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 2 additions & 2 deletions src/mono/mono/eventpipe/ep-event-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
7 changes: 3 additions & 4 deletions src/mono/mono/eventpipe/ep-rt-mono.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
10 changes: 6 additions & 4 deletions src/mono/mono/eventpipe/ep-rt-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eventpipe/ep-rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eventpipe/ep-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eventpipe/ep-session.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eventpipe/ep-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/mono/mono/eventpipe/ep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/mono/mono/eventpipe/test/ep-rt-tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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}
};
Expand Down
6 changes: 4 additions & 2 deletions src/mono/mono/metadata/icall-eventpipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

0 comments on commit 013915f

Please sign in to comment.