Public Member Functions | Private Member Functions | Private Attributes
hayai::JsonOutputter Class Reference

JSON outputter. More...

#include <hayai_json_outputter.hpp>

Inheritance diagram for hayai::JsonOutputter:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void Begin (const std::size_t &enabledCount, const std::size_t &disabledCount)
 Begin benchmarking.
virtual void BeginTest (const std::string &fixtureName, const std::string &testName, const TestParametersDescriptor &parameters, const std::size_t &runsCount, const std::size_t &iterationsCount)
 Begin benchmark test run.
virtual void End (const std::size_t &executedCount, const std::size_t &disabledCount)
 End benchmarking.
virtual void EndTest (const std::string &fixtureName, const std::string &testName, const TestParametersDescriptor &parameters, const TestResult &result)
 End benchmark test run.
 JsonOutputter (std::ostream &stream)
 Initialize JSON outputter.
virtual void SkipDisabledTest (const std::string &fixtureName, const std::string &testName, const TestParametersDescriptor &parameters, const std::size_t &runsCount, const std::size_t &iterationsCount)
 Skip disabled benchmark test run.

Private Member Functions

void BeginTestObject (const std::string &fixtureName, const std::string &testName, const TestParametersDescriptor &parameters, const std::size_t &runsCount, const std::size_t &iterationsCount, bool disabled)
void EndTestObject ()
void WriteString (const std::string &str)
 Write an escaped string.

Private Attributes

bool _firstTest
std::ostream & _stream

Detailed Description

JSON outputter.

Outputs the result of benchmarks in JSON format with the following structure:

{ "format_version": 1, "benchmarks": [{ "fixture": "DeliveryMan", "name": "DeliverPackage", "parameters": { "declaration": "std::size_t distance", "value": "1" }, "iterations_per_run": 10, "disabled": false, "runs": [{ "duration": 3801.889831 }, ..] }, { "fixture": "DeliveryMan", "name": "DisabledTest", "iterations_per_run": 10, "disabled": true }, ..] }

All durations are represented as milliseconds.

Definition at line 50 of file hayai_json_outputter.hpp.


Constructor & Destructor Documentation

hayai::JsonOutputter::JsonOutputter ( std::ostream &  stream) [inline]

Initialize JSON outputter.

Parameters:
streamOutput stream. Must exist for the entire duration of the outputter's use.

Definition at line 58 of file hayai_json_outputter.hpp.


Member Function Documentation

virtual void hayai::JsonOutputter::Begin ( const std::size_t &  enabledCount,
const std::size_t &  disabledCount 
) [inline, virtual]

Begin benchmarking.

The total number of benchmarks registred is the sum of the two counts passed to the outputter.

Parameters:
enabledCountNumber of benchmarks to be executed.
disabledCountNumber of disabled benchmarks to be skipped.

Implements hayai::Outputter.

Definition at line 66 of file hayai_json_outputter.hpp.

virtual void hayai::JsonOutputter::BeginTest ( const std::string &  fixtureName,
const std::string &  testName,
const TestParametersDescriptor parameters,
const std::size_t &  runsCount,
const std::size_t &  iterationsCount 
) [inline, virtual]

Begin benchmark test run.

Parameters:
fixtureNameFixture name.
testNameTest name.
parametersTest parameter description.
runsCountNumber of runs to be executed.
iterationsCountNumber of iterations per run.

Implements hayai::Outputter.

Definition at line 99 of file hayai_json_outputter.hpp.

void hayai::JsonOutputter::BeginTestObject ( const std::string &  fixtureName,
const std::string &  testName,
const TestParametersDescriptor parameters,
const std::size_t &  runsCount,
const std::size_t &  iterationsCount,
bool  disabled 
) [inline, private]

Definition at line 173 of file hayai_json_outputter.hpp.

virtual void hayai::JsonOutputter::End ( const std::size_t &  executedCount,
const std::size_t &  disabledCount 
) [inline, virtual]

End benchmarking.

Parameters:
executedCountNumber of benchmarks that have been executed.
disabledCountNumber of benchmarks that have been skipped because they are disabled.

Implements hayai::Outputter.

Definition at line 87 of file hayai_json_outputter.hpp.

virtual void hayai::JsonOutputter::EndTest ( const std::string &  fixtureName,
const std::string &  testName,
const TestParametersDescriptor parameters,
const TestResult result 
) [inline, virtual]

End benchmark test run.

Parameters:
fixtureNameFixture name.
testNameTest name.
parametersTest parameter description.
resultTest result.

Implements hayai::Outputter.

Definition at line 130 of file hayai_json_outputter.hpp.

void hayai::JsonOutputter::EndTestObject ( ) [inline, private]

Definition at line 265 of file hayai_json_outputter.hpp.

virtual void hayai::JsonOutputter::SkipDisabledTest ( const std::string &  fixtureName,
const std::string &  testName,
const TestParametersDescriptor parameters,
const std::size_t &  runsCount,
const std::size_t &  iterationsCount 
) [inline, virtual]

Skip disabled benchmark test run.

Parameters:
fixtureNameFixture name.
testNameTest name.
parametersTest parameter description.
runsCountNumber of runs to be executed.
iterationsCountNumber of iterations per run.

Implements hayai::Outputter.

Definition at line 114 of file hayai_json_outputter.hpp.

void hayai::JsonOutputter::WriteString ( const std::string &  str) [inline, private]

Write an escaped string.

The escaping is currently very rudimentary and assumes that names, parameters etc. are ASCII.

Parameters:
strString to write.

Definition at line 278 of file hayai_json_outputter.hpp.


Member Data Documentation

Definition at line 327 of file hayai_json_outputter.hpp.

std::ostream& hayai::JsonOutputter::_stream [private]

Definition at line 326 of file hayai_json_outputter.hpp.


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


hayai
Author(s): Nick Bruun
autogenerated on Thu Jun 6 2019 18:13:44