X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fprofiler%2Fproflog.c;h=e53cef3034e6963aa0c562cead8e95a60cb916ee;hb=f8a716f1f06b60af5849d93809b6227130ab1091;hp=3f215535b80f6df7689e96ef2405f75b3eb2eb2d;hpb=e91ee2b0fd297dbb5ed9f6080552cf7183286890;p=mono.git diff --git a/mono/profiler/proflog.c b/mono/profiler/proflog.c index 3f215535b80..e53cef3034e 100644 --- a/mono/profiler/proflog.c +++ b/mono/profiler/proflog.c @@ -27,9 +27,12 @@ #include #include #include +#include #include #include #include +#include +#include #include #include #include @@ -143,8 +146,6 @@ static gint32 image_unloads; static gint32 class_loads; static gint32 class_unloads; -typedef struct _LogBuffer LogBuffer; - /* * file format: * [header] [buffer]* @@ -439,6 +440,7 @@ typedef struct _LogBuffer LogBuffer; // Pending data to be written to the log, for a single thread. // Threads periodically flush their own LogBuffers by calling safe_send +typedef struct _LogBuffer LogBuffer; struct _LogBuffer { // Next (older) LogBuffer in processing queue LogBuffer *next; @@ -475,7 +477,6 @@ ign_res (int G_GNUC_UNUSED unused, ...) #define EXIT_LOG(lb) (lb)->locked--; typedef struct _BinaryObject BinaryObject; - struct _BinaryObject { BinaryObject *next; void *addr; @@ -513,19 +514,17 @@ struct _MonoProfiler { GPtrArray *coverage_filters; }; -typedef struct _WriterQueueEntry WriterQueueEntry; -struct _WriterQueueEntry { +typedef struct { MonoLockFreeQueueNode node; GPtrArray *methods; LogBuffer *buffer; -}; +} WriterQueueEntry; -typedef struct _MethodInfo MethodInfo; -struct _MethodInfo { +typedef struct { MonoMethod *method; MonoJitInfo *ji; uint64_t time; -}; +} MethodInfo; #ifdef TLS_INIT #undef TLS_INIT @@ -2090,12 +2089,11 @@ mono_sample_hit (MonoProfiler *profiler, unsigned char *ip, void *context) sample = mono_lock_free_alloc (&profiler->sample_allocator); sample->prof = profiler; + mono_lock_free_queue_node_init (&sample->node, TRUE); InterlockedIncrement (&sample_allocations); } - mono_lock_free_queue_node_init (&sample->node, TRUE); - sample->count = 0; mono_stack_walk_async_safe (&async_walk_stack, context, sample); @@ -3233,20 +3231,18 @@ static gboolean coverage_initialized = FALSE; static GPtrArray *coverage_data = NULL; static int previous_offset = 0; -typedef struct _MethodNode MethodNode; -struct _MethodNode { +typedef struct { MonoLockFreeQueueNode node; MonoMethod *method; -}; +} MethodNode; -typedef struct _CoverageEntry CoverageEntry; -struct _CoverageEntry { +typedef struct { int offset; int counter; char *filename; int line; int column; -}; +} CoverageEntry; static void free_coverage_entry (gpointer data, gpointer userdata) @@ -4021,7 +4017,7 @@ helper_thread (void* arg) MonoThread *thread = NULL; mono_threads_attach_tools_thread (); - mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler helper"); + mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler helper"); //fprintf (stderr, "Server listening\n"); command_socket = -1; @@ -4276,7 +4272,7 @@ writer_thread (void *arg) MonoProfiler *prof = (MonoProfiler *)arg; mono_threads_attach_tools_thread (); - mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler writer"); + mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler writer"); dump_header (prof); @@ -4316,8 +4312,6 @@ handle_dumper_queue_entry (MonoProfiler *prof) SampleHit *sample; if ((sample = (SampleHit *) mono_lock_free_queue_dequeue (&prof->dumper_queue))) { - mono_lock_free_queue_node_init (&sample->node, TRUE); - for (int i = 0; i < sample->count; ++i) { MonoMethod *method = sample->frames [i].method; MonoDomain *domain = sample->frames [i].domain; @@ -4389,7 +4383,7 @@ dumper_thread (void *arg) MonoProfiler *prof = (MonoProfiler *)arg; mono_threads_attach_tools_thread (); - mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler dumper"); + mono_native_thread_set_name (mono_native_thread_id_get (), "Profiler dumper"); while (InterlockedRead (&prof->run_dumper_thread)) { mono_os_sem_wait (&prof->dumper_queue_sem, MONO_SEM_FLAGS_NONE);