Example #1
0
        private static PreciseMachineCounter FromCounter(HardwareCounter counter)
        {
            var profileSource = TraceEventProfileSources.GetInfo()[EtwTranslations[counter]]; // it can't fail, diagnoser validates that first

            return(new PreciseMachineCounter(profileSource.ID, profileSource.Name, counter,
                                             profileSource.MinInterval)); // we want the smallest interval to have best possible precision
        }
Example #2
0
 private PreciseMachineCounter(int profileSourceId, string name, HardwareCounter counter, int interval)
 {
     ProfileSourceId = profileSourceId;
     Name            = name;
     Counter         = counter;
     Interval        = interval;
 }
Example #3
0
 internal PreciseMachineCounter(int profileSourceId, string name, HardwareCounter counter, int interval)
 {
     ProfileSourceId       = profileSourceId;
     Name                  = name;
     Counter               = counter;
     Interval              = interval;
     PerInstructionPointer = new Dictionary <ulong, ulong>(capacity: 10000);
 }
Example #4
0
        public static string ToShortName(this HardwareCounter hardwareCounter)
        {
            switch (hardwareCounter)
            {
            case HardwareCounter.Timer:
                return("timer");

            case HardwareCounter.TotalIssues:
                return("issues");

            case HardwareCounter.BranchInstructions:
                return("branch");

            case HardwareCounter.CacheMisses:
                return("miss");

            case HardwareCounter.BranchMispredictions:
                return("mispred");

            case HardwareCounter.TotalCycles:
                return("cycles");

            case HardwareCounter.UnhaltedCoreCycles:
                return("unCoreCycles");

            case HardwareCounter.InstructionRetired:
                return("retired");

            case HardwareCounter.UnhaltedReferenceCycles:
                return("unRefCycles");

            case HardwareCounter.LlcReference:
                return("llcRef");

            case HardwareCounter.LlcMisses:
                return("llcMiss");

            case HardwareCounter.BranchInstructionRetired:
                return("branchInst");

            case HardwareCounter.BranchMispredictsRetired:
                return("branchMisp");

            default:
                throw new NotSupportedException($"{hardwareCounter} has no short name mapping");
            }
        }
Example #5
0
        public static bool TheGreaterTheBetter(this HardwareCounter hardwareCounter)
        {
            // this method could be just a return false as of today but we want to make sure that when we add new counter it's added here on purpose!
            switch (hardwareCounter)
            {
            case HardwareCounter.Timer:
            case HardwareCounter.TotalIssues:
            case HardwareCounter.BranchInstructions:
            case HardwareCounter.CacheMisses:
            case HardwareCounter.BranchMispredictions:
            case HardwareCounter.TotalCycles:
            case HardwareCounter.UnhaltedCoreCycles:
            case HardwareCounter.InstructionRetired:
            case HardwareCounter.UnhaltedReferenceCycles:
            case HardwareCounter.LlcReference:
            case HardwareCounter.LlcMisses:
            case HardwareCounter.BranchInstructionRetired:
            case HardwareCounter.BranchMispredictsRetired:
                return(false);

            default:
                throw new NotSupportedException($"{hardwareCounter} has no TheGreaterTheBetter mapping");
            }
        }
        internal static PreciseMachineCounter FromCounter(HardwareCounter counter, Func <ProfileSourceInfo, int> intervalSelector)
        {
            var profileSource = TraceEventProfileSources.GetInfo()[EtwTranslations[counter]]; // it can't fail, diagnoser validates that first

            return(new PreciseMachineCounter(profileSource.ID, profileSource.Name, counter, intervalSelector(profileSource)));
        }
Example #7
0
 public PmcColumn(Dictionary <BenchmarkCase, PmcStats> results, HardwareCounter hardwareCounter)
 {
     Results    = results;
     Counter    = hardwareCounter;
     ColumnName = $"{hardwareCounter}/Op";
 }