Skip to content

Commit

Permalink
Log shows a wrong name for plot images dotnet#1181
Browse files Browse the repository at this point in the history
  • Loading branch information
marcnet90 authored and AndreyAkinshin committed Sep 6, 2019
1 parent ee97ca1 commit ea2e818
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/BenchmarkDotNet/Exporters/RPlotExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class RPlotExporter : IExporter, IExporterDependencies
public static readonly IExporter Default = new RPlotExporter();
public string Name => nameof(RPlotExporter);

private const string ImageExtension = ".png";
private static readonly object BuildScriptLock = new object();

public IEnumerable<IExporter> Dependencies
Expand All @@ -30,9 +31,7 @@ public IEnumerable<string> ExportToFiles(Summary summary, ILogger consoleLogger)
const string logFileName = "BuildPlots.log";
yield return scriptFileName;

string fileNamePrefix = Path.Combine(summary.ResultsDirectoryPath, summary.Title);
string csvFullPath = CsvMeasurementsExporter.Default.GetArtifactFullName(summary);

string scriptFullPath = Path.Combine(summary.ResultsDirectoryPath, scriptFileName);
string logFullPath = Path.Combine(summary.ResultsDirectoryPath, logFileName);
string script = ResourceHelper.
Expand Down Expand Up @@ -65,8 +64,7 @@ public IEnumerable<string> ExportToFiles(Summary summary, ILogger consoleLogger)
process?.WaitForExit();
}

yield return fileNamePrefix + "-boxplot.png";
yield return fileNamePrefix + "-barplot.png";
yield return $"*{ImageExtension}";
}

public void ExportToLog(Summary summary, ILogger logger)
Expand Down Expand Up @@ -125,4 +123,4 @@ private static string FindInPath(string fileName)
return null;
}
}
}
}
8 changes: 8 additions & 0 deletions src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,13 @@ internal static string HtmlEncode(this string s)
}
return sb.ToString();
}

/// <summary>
/// Returns file base name
/// </summary>
internal static string GetBaseName(this string path, string directory)
{
return path.Replace(directory, string.Empty).Trim('/', '\\');
}
}
}
4 changes: 2 additions & 2 deletions src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace BenchmarkDotNet.Running
internal static class BenchmarkRunnerClean
{
internal const string DateTimeFormat = "yyyyMMdd-HHmmss";

internal static readonly IResolver DefaultResolver = new CompositeResolver(EnvironmentResolver.Instance, InfrastructureResolver.Instance);

internal static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos)
Expand Down Expand Up @@ -196,7 +196,7 @@ private static void PrintSummary(ILogger logger, ImmutableConfig config, Summary
string currentDirectory = Directory.GetCurrentDirectory();
foreach (string file in config.GetCompositeExporter().ExportToFiles(summary, logger))
{
logger.WriteLineInfo($" {file.Replace(currentDirectory, string.Empty).Trim('/', '\\')}");
logger.WriteLineInfo($" {file.GetBaseName(currentDirectory)}");
}

logger.WriteLine();
Expand Down

0 comments on commit ea2e818

Please sign in to comment.