[profiler] Clean up MonoProfilerGCEvent enum.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 15 Jul 2017 00:08:40 +0000 (02:08 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 15 Jul 2017 00:08:40 +0000 (02:08 +0200)
* Remove the mark/reclaim events as they've been broken for a long time and
  aren't particularly useful.
* Reorder the enum member declarations to the order they actually arrive in.

libgc/include/gc.h
mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEnums.cs
mono/metadata/boehm-gc.c
mono/metadata/profiler.h
mono/metadata/sgen-client-mono.h
mono/profiler/log.h
mono/profiler/mprof-report.c

index 7b1460a888ae20f5756aa3e8ad71781094541ffd..e7929918ad0bb9df8d12b07a7803f660a8a3244f 100644 (file)
@@ -93,7 +93,6 @@ GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
                        /* pointer to a previously allocated heap       */
                        /* object.                                      */
 
-// Keep somewhat in sync with mono/metadata/profiler.h:enum MonoGCEvent
 typedef enum {
        GC_EVENT_START,
        GC_EVENT_MARK_START,
index f34cafe07e0965869ac7281573b6059d65f37f14..01ce114093b4a42a3a3f06b0e6b5060953fd7efd 100644 (file)
@@ -171,17 +171,13 @@ namespace Mono.Profiler.Log {
 
        // mono/metadata/profiler.h : MonoProfilerGCEvent
        public enum LogGCEvent {
-               Begin = 0,
-               MarkBegin = 1,
-               MarkEnd = 2,
-               ReclaimBegin = 3,
-               ReclaimEnd = 4,
-               End = 5,
                PreStopWorld = 6,
+               PreStopWorldLocked = 10,
                PostStopWorld = 7,
+               Begin = 0,
+               End = 5,
                PreStartWorld = 8,
                PostStartWorld = 9,
-               PreStopWorldLocked = 10,
                PostStartWorldUnlocked = 11,
        }
 
index 9439ebfab061919bccb7aea1c3454c4b4c39569a..bd853b21eb9b45cce831504f95aeda945a74333f 100644 (file)
@@ -428,26 +428,31 @@ static gint64 gc_start_time;
 static void
 on_gc_notification (GC_EventType event)
 {
-       MonoProfilerGCEvent e = (MonoProfilerGCEvent)event;
+       MonoProfilerGCEvent e;
 
-       switch (e) {
-       case MONO_GC_EVENT_PRE_STOP_WORLD:
+       switch (event) {
+       case GC_EVENT_PRE_STOP_WORLD:
+               e = MONO_GC_EVENT_PRE_STOP_WORLD;
                MONO_GC_WORLD_STOP_BEGIN ();
                break;
 
-       case MONO_GC_EVENT_POST_STOP_WORLD:
+       case GC_EVENT_POST_STOP_WORLD:
+               e = MONO_GC_EVENT_POST_STOP_WORLD;
                MONO_GC_WORLD_STOP_END ();
                break;
 
-       case MONO_GC_EVENT_PRE_START_WORLD:
+       case GC_EVENT_PRE_START_WORLD:
+               e = MONO_GC_EVENT_PRE_START_WORLD;
                MONO_GC_WORLD_RESTART_BEGIN (1);
                break;
 
-       case MONO_GC_EVENT_POST_START_WORLD:
+       case GC_EVENT_POST_START_WORLD:
+               e = MONO_GC_EVENT_POST_START_WORLD;
                MONO_GC_WORLD_RESTART_END (1);
                break;
 
-       case MONO_GC_EVENT_START:
+       case GC_EVENT_START:
+               e = MONO_GC_EVENT_START;
                MONO_GC_BEGIN (1);
 #ifndef DISABLE_PERFCOUNTERS
                if (mono_perfcounters)
@@ -457,7 +462,8 @@ on_gc_notification (GC_EventType event)
                gc_start_time = mono_100ns_ticks ();
                break;
 
-       case MONO_GC_EVENT_END:
+       case GC_EVENT_END:
+               e = MONO_GC_EVENT_END;
                MONO_GC_END (1);
 #if defined(ENABLE_DTRACE) && defined(__sun__)
                /* This works around a dtrace -G problem on Solaris.
@@ -483,14 +489,23 @@ on_gc_notification (GC_EventType event)
                break;
        }
 
-       MONO_PROFILER_RAISE (gc_event, (e, 0));
+       switch (event) {
+       case GC_EVENT_MARK_START:
+       case GC_EVENT_MARK_END:
+       case GC_EVENT_RECLAIM_START:
+       case GC_EVENT_RECLAIM_END:
+               break;
+       default:
+               MONO_PROFILER_RAISE (gc_event, (e, 0));
+               break;
+       }
 
-       switch (e) {
-       case MONO_GC_EVENT_PRE_STOP_WORLD:
+       switch (event) {
+       case GC_EVENT_PRE_STOP_WORLD:
                mono_thread_info_suspend_lock ();
                MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, 0));
                break;
-       case MONO_GC_EVENT_POST_START_WORLD:
+       case GC_EVENT_POST_START_WORLD:
                mono_thread_info_suspend_unlock ();
                MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, 0));
                break;
index e141dd6622da09fb44400da1c985e120c900fc36..263f6e6866cc0daa080f413cda4a4e6a4e4769f2 100644 (file)
@@ -229,18 +229,13 @@ typedef enum {
        MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING = 9,
 } MonoProfilerCodeBufferType;
 
-// Keep somewhat in sync with libgc/include/gc.h : GC_EventType.
 typedef enum {
-       MONO_GC_EVENT_START = 0,
-       MONO_GC_EVENT_MARK_START = 1,
-       MONO_GC_EVENT_MARK_END = 2,
-       MONO_GC_EVENT_RECLAIM_START = 3,
-       MONO_GC_EVENT_RECLAIM_END = 4,
-       MONO_GC_EVENT_END = 5,
        MONO_GC_EVENT_PRE_STOP_WORLD = 6,
        /* When this event arrives, the GC and suspend locks are acquired. */
        MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED = 10,
        MONO_GC_EVENT_POST_STOP_WORLD = 7,
+       MONO_GC_EVENT_START = 0,
+       MONO_GC_EVENT_END = 5,
        MONO_GC_EVENT_PRE_START_WORLD = 8,
        /* When this event arrives, the GC and suspend locks are released. */
        MONO_GC_EVENT_POST_START_WORLD_UNLOCKED = 11,
index d9a483898e7886b2739973aa57a8745b725d921b..e3cae00e7e605d20cd70630e0a534b4155ea0685 100644 (file)
@@ -383,25 +383,21 @@ sgen_client_binary_protocol_block_set_state (gpointer addr, size_t size, int old
 static void G_GNUC_UNUSED
 sgen_client_binary_protocol_mark_start (int generation)
 {
-       MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_MARK_START, generation));
 }
 
 static void G_GNUC_UNUSED
 sgen_client_binary_protocol_mark_end (int generation)
 {
-       MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_MARK_END, generation));
 }
 
 static void G_GNUC_UNUSED
 sgen_client_binary_protocol_reclaim_start (int generation)
 {
-       MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_RECLAIM_START, generation));
 }
 
 static void G_GNUC_UNUSED
 sgen_client_binary_protocol_reclaim_end (int generation)
 {
-       MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_RECLAIM_END, generation));
 }
 
 static void
index 41e294dc719673dcb03a451d7e9bbf5b753b96c9..1979e8baab6435e507b6640a5a71d8dbc8d5aeda 100644 (file)
@@ -69,6 +69,7 @@
                added an exception object field to TYPE_CLAUSE
                class unload events no longer exist (they were never emitted)
                removed type field from TYPE_SAMPLE_HIT
+               removed MONO_GC_EVENT_{MARK,RECLAIM}_{START,END}
  */
 
 /*
index 1c63e9abde7fda14b8887b2e29a2ba9ba8c1a037..4251a164ff56623acb10f147837edbf2b8b0b858 100644 (file)
@@ -906,6 +906,13 @@ enum {
        SAMPLE_BRANCH_MISSES,
 };
 
+enum {
+       MONO_GC_EVENT_MARK_START = 1,
+       MONO_GC_EVENT_MARK_END = 2,
+       MONO_GC_EVENT_RECLAIM_START = 3,
+       MONO_GC_EVENT_RECLAIM_END = 4,
+};
+
 static const char*
 sample_type_name (int type)
 {