Skip to content

Q: Include hardware counters in XML output #2233

Description

@zvrba

Hi. I've lost a couple of hours now trying to coax BenchmarkDotNet to output hardware counters in a XML or JSON file. Default job configuration outputs them in the console report and CSV file, but not matter what I do (even following CSV export example), I run into the following troubles:

  • The HW counters are missing in the XML or JSON file, but present in the CSV output
  • Configuring CSV exporter to write machine-readable output (as below) does not work; i get units in values columns

HW counters DO get shown in the console summary.

Any suggestions?

Sample code:

// In main: var summaries = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(config: new CustomConfig());

internal class CustomConfig : ManualConfig
{
    public CustomConfig() {
        AddJob(Job.Default);
        AddLogger(BenchmarkDotNet.Loggers.ConsoleLogger.Default);
        AddColumn(BenchmarkDotNet.Columns.)

        AddExporter(new CsvExporter(
            CsvSeparator.CurrentCulture,
            new SummaryStyle(
                cultureInfo: System.Globalization.CultureInfo.InvariantCulture,
                printUnitsInHeader: true,
                printUnitsInContent: false,
                timeUnit: Perfolizer.Horology.TimeUnit.Millisecond,
                sizeUnit: BenchmarkDotNet.Columns.SizeUnit.KB)));
        AddHardwareCounters(HardwareCounter.TotalIssues, HardwareCounter.CacheMisses, HardwareCounter.BranchInstructions, HardwareCounter.BranchMispredictions);
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions