[profiler] Remove the type field from TYPE_SAMPLE_HIT.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 8 Jul 2017 03:53:16 +0000 (05:53 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Sun, 9 Jul 2017 01:16:03 +0000 (03:16 +0200)
It's unlikely that we'll add support for other kinds of sampling in the future
as we've dropped support for perf on Linux.

mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEnums.cs
mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEvents.cs
mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogProcessor.cs
mono/profiler/log.c
mono/profiler/log.h
mono/profiler/mprof-report.c

index f9a125b5d16a8d011774c600d22bab15ed8ae0fb..f34cafe07e0965869ac7281573b6059d65f37f14 100644 (file)
@@ -138,16 +138,6 @@ namespace Mono.Profiler.Log {
                ExceptionHandling = 10,
        }
 
-       // mono/profiler/log.h : SAMPLE_*
-       public enum LogSampleHitType {
-               Cycles = 1,
-               Instructions = 2,
-               CacheMisses = 3,
-               CacheHits = 4,
-               Branches = 5,
-               BranchMisses = 6,
-       }
-
        // mono/metadata/profiler.h : MonoProfilerGCRootType
        [Flags]
        public enum LogHeapRootAttributes {
index 248863e60669758cb5d36ddb708d43279b80df0f..8bdd5d7ab59b9adfd721ec97bb574b9c3ec42379 100644 (file)
@@ -443,8 +443,6 @@ namespace Mono.Profiler.Log {
 
        public sealed class SampleHitEvent : LogEvent {
 
-               public LogSampleHitType Type { get; internal set; }
-
                public long ThreadId { get; internal set; }
 
                public IReadOnlyList<long> UnmanagedBacktrace { get; internal set; }
index f57d4ef651d750244af8ce418588cccbd87fa8ed..09e5dca088f15ab973b868a24e8ff1e795f7dccb 100644 (file)
@@ -380,7 +380,6 @@ namespace Mono.Profiler.Log {
                                switch (extType) {
                                case LogEventType.SampleHit:
                                        return new SampleHitEvent {
-                                               Type = (LogSampleHitType) Reader.ReadByte (),
                                                ThreadId = ReadPointer (),
                                                UnmanagedBacktrace = ReadBacktrace (true, false),
                                                ManagedBacktrace = ReadBacktrace (true),
index 66271de51436b28e64fb26af81afa98f8bd2fc70..9793f8392d851cfa69a0e0048ae5f0605919855a 100644 (file)
@@ -4384,7 +4384,6 @@ handle_dumper_queue_entry (MonoProfiler *prof)
                );
 
                emit_event_time (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT, sample->time);
-               emit_byte (logbuffer, SAMPLE_CYCLES);
                emit_ptr (logbuffer, (void *) sample->tid);
                emit_value (logbuffer, 1);
 
index e285f18e618a5a2e4fded37ae2564b03d89a7fdc..ecbe3ab219795d6d9844b219633dc30b9d93335c 100644 (file)
@@ -67,6 +67,7 @@
                added an image pointer field to assembly load events
                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
  */
 
 enum {
@@ -161,19 +162,6 @@ enum {
        MONO_PROFILER_GC_HANDLE_DESTROYED,
 };
 
-// Sampling sources
-// Unless you have compiled with --enable-perf-events, only SAMPLE_CYCLES is available
-enum {
-       SAMPLE_CYCLES = 1,
-       SAMPLE_INSTRUCTIONS,
-       SAMPLE_CACHE_MISSES,
-       SAMPLE_CACHE_REFS,
-       SAMPLE_BRANCHES,
-       SAMPLE_BRANCH_MISSES,
-       SAMPLE_LAST
-};
-
-
 // If you alter MAX_FRAMES, you may need to alter SAMPLE_BLOCK_SIZE too.
 #define MAX_FRAMES 32
 
index 5d93db9746644b73109dca08b0f5b9c8da49cc54..1c63e9abde7fda14b8887b2e29a2ba9ba8c1a037 100644 (file)
@@ -896,6 +896,16 @@ lookup_unmanaged_binary (uintptr_t addr)
        return NULL;
 }
 
+// For backwards compatibility.
+enum {
+       SAMPLE_CYCLES = 1,
+       SAMPLE_INSTRUCTIONS,
+       SAMPLE_CACHE_MISSES,
+       SAMPLE_CACHE_REFS,
+       SAMPLE_BRANCHES,
+       SAMPLE_BRANCH_MISSES,
+};
+
 static const char*
 sample_type_name (int type)
 {
@@ -2895,7 +2905,10 @@ decode_buffer (ProfContext *ctx)
                                        uint64_t tdiff = decode_uleb128 (p + 1, &p);
                                        LOG_TIME (time_base, tdiff);
                                        time_base += tdiff;
-                                       sample_type = *p++;
+                                       if (ctx->data_version < 14)
+                                               sample_type = *p++;
+                                       else
+                                               sample_type = SAMPLE_CYCLES;
                                        tstamp = time_base;
                                } else {
                                        sample_type = decode_uleb128 (p + 1, &p);