Skip to content

How to create a custom column which is a function of other results? #2443

Discussion options

You must be logged in to vote

In the GetValue implementation of your column, you can get to the the parameter's value and benchmark's statistics like so:

public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style) {
  int n = (int)benchmarkCase.Parameters["N"];
  Statistics statistics = summary[benchmarkCase]!.ResultStatistics!;
  double mean = TimeInterval.FromNanoseconds(statistics.Mean).ToSeconds();
  double result = mean / n;
  return string.Create(style.CultureInfo, $"{result:F3} s");
}

In another column, you can calculate the error, assuming the error of N is zero:

double result = ...; double mean = ...; as above
double meanStdDev = TimeInterval.FromNanoseconds(statistics.StandardDe…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@quixoticaxis
Comment options

Answer selected by quixoticaxis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants