|
| 1 | +namespace GraphBLAS.FSharp.Benchmarks.Columns |
| 2 | + |
| 3 | +open BenchmarkDotNet.Columns |
| 4 | +open BenchmarkDotNet.Reports |
| 5 | +open BenchmarkDotNet.Running |
| 6 | +open GraphBLAS.FSharp.IO |
| 7 | + |
| 8 | +type CommonColumn<'a>(benchmarkCaseConvert, columnName: string, getShape: 'a -> 'b) = |
| 9 | + interface IColumn with |
| 10 | + member this.AlwaysShow = true |
| 11 | + member this.Category = ColumnCategory.Params |
| 12 | + member this.ColumnName = columnName |
| 13 | + |
| 14 | + member this.GetValue(_: Summary, benchmarkCase: BenchmarkCase) = |
| 15 | + benchmarkCaseConvert benchmarkCase |
| 16 | + |> getShape |
| 17 | + |> sprintf "%A" |
| 18 | + |
| 19 | + member this.GetValue(summary: Summary, benchmarkCase: BenchmarkCase, _: SummaryStyle) = |
| 20 | + (this :> IColumn).GetValue(summary, benchmarkCase) |
| 21 | + |
| 22 | + member this.Id = sprintf $"%s{columnName}" |
| 23 | + |
| 24 | + member this.IsAvailable(_: Summary) = true |
| 25 | + member this.IsDefault(_: Summary, _: BenchmarkCase) = false |
| 26 | + member this.IsNumeric = true |
| 27 | + member this.Legend = sprintf $"%s{columnName}" |
| 28 | + member this.PriorityInCategory = 1 |
| 29 | + member this.UnitType = UnitType.Size |
| 30 | + |
| 31 | +type MatrixColumn(name, getShape) = |
| 32 | + inherit CommonColumn<MtxReader>( |
| 33 | + (fun benchmarkCase -> benchmarkCase.Parameters.["InputMatrixReader"] :?> MtxReader), |
| 34 | + name, |
| 35 | + getShape) |
| 36 | + |
| 37 | +type Matrix2Column(name, getShape) = |
| 38 | + inherit CommonColumn<MtxReader*MtxReader>( |
| 39 | + (fun benchmarkCase -> benchmarkCase.Parameters.["InputMatrixReader"] :?> MtxReader * MtxReader), |
| 40 | + name, |
| 41 | + getShape) |
0 commit comments