Class Structure#

Class structure is shown in the following UML diagrams.

Classes to Run Benchmarks#

@startuml classes_run_bench

title Basic Classes to Run Benchmarks

class "main function" as main
hide main circle

package stat_bench {
    package runner {
        class CommandLineParser
        main ..> CommandLineParser : use

        class Runner
        main ..> Runner : use

        class Config
        CommandLineParser ..> Config : create
        Runner ..> Config : use
    }

    package clock {
        class SystemClock
        Runner ...> SystemClock : use

        class SystemTimePoint
        SystemClock ..> SystemTimePoint : create
    }

    package bench_impl {
        class BenchmarkCaseRegistry
        Runner ...> BenchmarkCaseRegistry : use

        class BenchmarkGroup
        BenchmarkCaseRegistry "1" o-- "1.." BenchmarkGroup

        interface IBenchmarkCase
        BenchmarkGroup "1" o-- "1.." IBenchmarkCase
    }

    package measurer {
        interface IMeasurer
        Runner "1" o--- "1.." IMeasurer

        class Measurement
        IMeasurer ..> Measurement : create
    }

    package reporter {
        interface IReporter
        Runner "1" o--- "1.." IReporter
        IReporter ..> Measurement : use
        IReporter ..> SystemTimePoint : use
    }

    package param {
        class ParameterConfig
        IBenchmarkCase "1" o-- "1" ParameterConfig
        ParameterConfig ..> ParameterGenerator : create

        class ParameterGenerator
        Runner ..> ParameterGenerator : use

        class ParameterDict
        ParameterGenerator ..> ParameterDict : create
    }

    class BenchmarkCondition
    Runner ..> BenchmarkCondition : create
    IMeasurer ..> BenchmarkCondition : use
    BenchmarkCondition "1" o-- "1" ParameterDict

    class InvocationContext
    InvocationContext "1" o-- "1" BenchmarkCondition
    IMeasurer ..> InvocationContext : create
    IBenchmarkCase ..> InvocationContext : use
}

@enduml

Classes to Define Benchmarks#

@startuml classes_define_bench

title Basic Classes to Define Benchmarks

package stat_bench {
    package bench_impl {
        interface IBenchmarkCase
    }

    class FixtureBase
    IBenchmarkCase <|.. FixtureBase

    package bench_impl {
        class NullFixture
        FixtureBase <|-- NullFixture
    }

    package param {
        class ParameterConfig
        FixtureBase "1" o-- "1" ParameterConfig
    }
}

package "User's Program" {
    class "User-Defined Fixture" as UserFixture
    FixtureBase <|-- UserFixture

    class "User-Defined Benchmark Case with Fixture" as FixtureBenchmarkCase
    UserFixture <|-- FixtureBenchmarkCase

    class "User-Defined Benchmark Case without Fixture" as NoFixtureBenchmarkCase
    NullFixture <|-- NoFixtureBenchmarkCase
}

@enduml

Classes of Parameters in Benchmarks#

@startuml classes_param

title Basic Classes of Parameters in Benchmarks

package stat_bench {
    class BenchmarkCondition

    package param {
        class ParameterConfig

        class ParameterGenerator
        ParameterConfig ..> ParameterGenerator : create

        class ParameterName
        ParameterConfig "1" o-- "1.." ParameterName

        interface IParameterValueVector
        ParameterConfig "1" o-- "1.." IParameterValueVector

        class ParameterValueVector<T>
        IParameterValueVector <|.. ParameterValueVector

        class ParameterValue
        ParameterValueVector "1" o-- "1.." ParameterValue

        class ParameterDict
        ParameterGenerator ..> ParameterDict : create
        ParameterDict "1" o-- "1.." ParameterName
        ParameterDict "1" o-- "1.." ParameterValue
        BenchmarkCondition "1" o-- "1" ParameterDict
    }
}

@enduml

Classes to Measure Processing Time#

@startuml classes_measure

title Basic Classes to Measure Processing Time

class "Custom Output without Statistics" as NoStatisticsCustomOutput
note bottom
    Custom outputs without statistics
    are saved in "double" variables.
end note
hide NoStatisticsCustomOutput circle

package stat_bench {
    package bench_impl {
        interface IBenchmarkCase

        class ThreadableInvoker
    }

    class BenchmarkCondition

    package clock {
        class StopWatch
        ThreadableInvoker ..> StopWatch : create

        class MonotoneTimePoint
        StopWatch ..> MonotoneTimePoint : create

        class Duration
        StopWatch ..> Duration : create
    }

    package stat {
        class CustomStatOutput

        class Statistics
        CustomStatOutput ..> Statistics : create
    }

    package measurer {
        interface IMeasurer

        class Measurement
        IMeasurer ..> Measurement : create
        Measurement "1" o-- "1" BenchmarkCondition
        Measurement "1" o-- "1.." Duration
        Measurement "1" o-- "1.." CustomStatOutput
        Measurement "1" o-- "1.." Statistics
        Measurement "1" o-- "1.." NoStatisticsCustomOutput
    }

    class InvocationContext
    InvocationContext "1" o-- "1" BenchmarkCondition
    InvocationContext "1" o-- "1.." Duration
    InvocationContext "1" o-- "1.." CustomStatOutput
    InvocationContext "1" o-- "1.." NoStatisticsCustomOutput
    IMeasurer ..> InvocationContext : create
    IBenchmarkCase ..> InvocationContext : use
    InvocationContext ..> ThreadableInvoker : use
}

@enduml

Classes to Report Benchmark Results#

@startuml classes_reporter

title Basic Classes to Report Benchmark Results

package stat_bench {
    package measurer {
        class Measurement
    }

    package reporter {
        interface IReporter
        IReporter ..> Measurement : use

        class ConsoleReporter
        IReporter <|.. ConsoleReporter

        class DataFileReporterBase
        IReporter <|.. DataFileReporterBase

        class JsonReporter
        DataFileReporterBase <|.. JsonReporter

        class MsgPackReporter
        DataFileReporterBase <|.. MsgPackReporter

        class CompressedMsgPackReporter
        DataFileReporterBase <|.. CompressedMsgPackReporter

        class PlotReporter
        IReporter <|.. PlotReporter
    }
}

@enduml

Classes to Plot Benchmark Results#

@startuml classes_plot

title Basic Classes to Plot Benchmark Results

package stat_bench {
    package reporter {
        class PlotReporter
    }

    package plots {
        interface IPlotter
        PlotReporter "1" o-- "1" IPlotter

        class PlotlyPlotter
        IPlotter <|.. PlotlyPlotter

        interface IFigure
        IPlotter ..> IFigure : create

        class PlotlyFigure
        IFigure <|.. PlotlyFigure
        PlotlyPlotter ..> PlotlyFigure : create

        interface ITrace
        IFigure ..> ITrace : create

        interface IPlotlyTrace
        ITrace <|-- IPlotlyTrace
        PlotlyFigure "1" o-- "1.." IPlotlyTrace

        class XxxTrace
        note right
            Xxx is a placeholder
            for the actual plot type.
        end note
        IPlotlyTrace <|.. XxxTrace
        PlotlyFigure ..> XxxTrace : create

        interface IPlot
        PlotReporter "1" o-- "1.." IPlot

        class XxxPlot
        note right
            Xxx is a placeholder
            for the actual plot type.
        end note
        IPlot <|.. XxxPlot
        XxxPlot ..> IPlotter : use
    }
}

@enduml