JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
Benchmark Class Reference

#include <Benchmark.h>

Collaboration diagram for Benchmark:
[legend]

Public Member Functions

 Benchmark ()
 
 Benchmark (const std::string &file)
 
 Benchmark (const Benchmark &b)=delete
 
Benchmarkoperator= (const Benchmark &b)=delete
 
 Benchmark (Benchmark &&b)
 
Benchmarkoperator= (Benchmark &&b)
 
virtual ~Benchmark ()
 
template<typename T >
void addValue (const std::string &header, T &&val)
 
template<typename T >
void addValue (const std::string &prefix, const std::string &header, T &&val)
 
template<typename T >
void addValueAt (const std::string &pointer, T &&val)
 
template<typename T >
void addValueAt (const RJPointer &pointer, T &&val)
 
void addThread (double bloom, double select, double project, double agg, double copy, double serialize, double sample_view_cost)
 
void finishLine ()
 
std::string toString () const
 
std::string lastLineToString () const
 
const RJValuegetLastLine () const
 
std::string currentLineToString () const
 
bool isValid () const
 

Static Public Attributes

static constexpr auto RUNTIME = "/Runtime"
 
static constexpr auto THREADS = "/Runtime/Threads"
 

Protected Member Functions

void parseBenchfile ()
 
void writeBenchfile () const
 

Protected Attributes

std::mutex mut
 
RJDocument benchDoc
 
RJValue currentLine
 
bool valid = false
 
 bool = true
 
fs::path benchfile
 

Detailed Description

The Benchmark class is mainly used to manage the measured execution times of queries. But additional information can also be stored in the benchmark class.

The benchmark file is a JSON document where the top-level entry is an array. This array then contains one benchmark "line" for each query execution.

Constructor & Destructor Documentation

◆ Benchmark() [1/4]

Benchmark::Benchmark ( )

Initializes an in-memory benchmark document. This can be used to display collected informations in CLI

◆ Benchmark() [2/4]

Benchmark::Benchmark ( const std::string &  file)
explicit

Initializes an benchmark document on the filesystem. If the file already exists it is parsed into a JSON document. If this is not a valid benchmark file, an error will be logged and the benchmark will only be in-memory instead.

Parameters
fileThe path to the file, where the benchmark should be stored.
Here is the call graph for this function:

◆ Benchmark() [3/4]

Benchmark::Benchmark ( const Benchmark b)
delete

◆ Benchmark() [4/4]

Benchmark::Benchmark ( Benchmark &&  b)

◆ ~Benchmark()

Benchmark::~Benchmark ( )
virtual

If the benchmark is stored on the filesystem, the file will be flushed and closed. If not, all data is simply discarded.

Here is the call graph for this function:

Member Function Documentation

◆ addThread()

void Benchmark::addThread ( double  bloom,
double  select,
double  project,
double  agg,
double  copy,
double  serialize,
double  sample_view_cost 
)

Adds a new entry in the "thread" attribute with the given values

Here is the caller graph for this function:

◆ addValue() [1/2]

template<typename T >
void Benchmark::addValue ( const std::string &  header,
T &&  val 
)
inline

Adds a value of type T at the JSON path "/<header>"

Parameters
headerThe attribute name to be stored
valThe value to be stored
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addValue() [2/2]

template<typename T >
void Benchmark::addValue ( const std::string &  prefix,
const std::string &  header,
T &&  val 
)
inline

Adds a value of type T at the JSON path "<prefix>/<header>"

Parameters
prefixThe attribute prefix to be stored
headerThe attribute name to be stored
valThe value to be stored
Here is the call graph for this function:

◆ addValueAt() [1/2]

template<typename T >
void Benchmark::addValueAt ( const RJPointer pointer,
T &&  val 
)
inline

Adds a value of type T at the JSON pointer (in string representation) "pointer"

Parameters
pointerThe pointer where the value will be stored
valThe value to be stored

◆ addValueAt() [2/2]

template<typename T >
void Benchmark::addValueAt ( const std::string &  pointer,
T &&  val 
)
inline

Adds a value of type T at the JSON pointer (in string representation) "pointer"

Parameters
pointerThe pointer where the value will be stored
valThe value to be stored
Here is the caller graph for this function:

◆ currentLineToString()

std::string Benchmark::currentLineToString ( ) const

Stringifies the current benchmark line and returns it.

Returns
The current benchmark line as string representation

◆ finishLine()

void Benchmark::finishLine ( )

Completes, and optionally flushes, one line in the benchmark array-document. A new line is created for further use.

Here is the call graph for this function:

◆ getLastLine()

const RJValue & Benchmark::getLastLine ( ) const

Returns the last benchmark line If no line exists before the current one, a null value is returned.

Returns
The last benchmark line as RJValue

◆ isValid()

bool Benchmark::isValid ( ) const

Checks whether the benchmark is in a valid format. If not, all operations on it are no-ops

Returns
True if it is valid, false else.

◆ lastLineToString()

std::string Benchmark::lastLineToString ( ) const

Stringifies the last benchmark line and returns it. If no line exists before the current one, an empty string is returned.

Returns
The last benchmark line as string representation

◆ operator=() [1/2]

Benchmark & Benchmark::operator= ( Benchmark &&  b)

◆ operator=() [2/2]

Benchmark& Benchmark::operator= ( const Benchmark b)
delete

◆ parseBenchfile()

void Benchmark::parseBenchfile ( )
protected
Here is the caller graph for this function:

◆ toString()

std::string Benchmark::toString ( ) const

Stringifies the current benchmark file with all lines and returns it.

Returns
The benchmark file as string representation

◆ writeBenchfile()

void Benchmark::writeBenchfile ( ) const
protected
Here is the caller graph for this function:

Field Documentation

◆ benchDoc

RJDocument Benchmark::benchDoc
protected

◆ benchfile

fs::path Benchmark::benchfile
protected

◆ bool

Benchmark::bool = true
protected

◆ currentLine

RJValue Benchmark::currentLine
protected

◆ mut

std::mutex Benchmark::mut
protected

◆ RUNTIME

constexpr auto Benchmark::RUNTIME = "/Runtime"
staticconstexpr

◆ THREADS

constexpr auto Benchmark::THREADS = "/Runtime/Threads"
staticconstexpr

◆ valid

bool Benchmark::valid = false
protected

The documentation for this class was generated from the following files: