Question Details

No question body available.

Tags

c# .net performance benchmarking benchmarkdotnet

Answers (2)

Accepted Answer Available
Accepted Answer
May 15, 2026 Score: 3 Rep: 152,922 Quality: Expert Completeness: 80%

There is an option for that (Config Options doc):

ConfigOptions.DontOverwriteResults - The exported result files should not be overwritten (by default they are overwritten).

So try adding:

WithOptions(ConfigOptions.DontOverwriteResults);

enter image description here

Alternatively you can use fileNameSuffix.

Some of the standard exporters already allow passing fileNameSuffix, for example - XML and Json one:

AddExporter(JsonExporter.Custom("customFileNameSuffix", indentJson: true, excludeMeasurements: true));

For others the suffix property is not exposed but you can inherit it and override the suffix:

public class MyHtmlExporter : HtmlExporter
{
    public MyHtmlExporter()
    {
        FileNameSuffix = $"gurustron{DateTime.UtcNow.Ticks}";
    }

protected override string FileNameSuffix { get; } }

AddExporter(new MyHtmlExporter());

enter image description here

The same can be done with csv:

public class MyCsvExporter : CsvExporter
{
    public MyCsvExporter() : base(CsvSeparator.CurrentCulture) // mimic the Default behavior
    {
        FileNameSuffix = $"gurustron_{DateTime.UtcNow.Ticks}";
    }

protected override string FileNameSuffix { get; } }

One thing I noticed - not all suffixes actually work, for example DateTime.UtcNow.ToLongTimeString() (instead of DateTime.UtcNow.Ticks) has not worked for me.

May 15, 2026 Score: 2 Rep: 53 Quality: Low Completeness: 30%

I just needed to add this line:

WithOptions(ConfigOptions.DontOverwriteResults);

to my config file, and it creates a new directory with a timestamp.