1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
////////////////////////////////////////////////////////////////////////////////
//
// Statistics.cc
//
// produced: 17 Sep 2021 jr
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <thread>
#include <cstdlib>
#include "Statistics.hh"
namespace topcom {
std::fstream Statistics::_stats_stream;
size_type Statistics::_no_of_singleton_map_calls = 0;
size_type Statistics::_no_of_structure_map_calls = 0;
// initialization:
void Statistics::init() {
MessageStreams::verbose() << "initializing statistics output ..." << '\n'
<< "... output file: " << CommandlineOptions::stats_file() << " ..." << std::endl;
Statistics::stats_stream().open(CommandlineOptions::stats_file(), std::ios::out | std::ios::trunc);
Statistics::stats_stream() << "//////////////////////////////////////////////////////////////////////////////" << std::endl;
Statistics::stats_stream() << "// statistics file (automatically generated by TOPCOM)" << std::endl;
Statistics::stats_stream() << "//////////////////////////////////////////////////////////////////////////////" << std::endl;
Statistics::stats_stream() << std::endl;
MessageStreams::verbose() << "... done." << std::endl;
}
// termination:
void Statistics::term() {
MessageStreams::verbose() << "terminating statistics output ..." << std::endl;
Statistics::stats_stream() << "terminating statistics:" << std::endl;
Statistics::stats_stream() << "no of singleton-map calls: \t" << _no_of_singleton_map_calls << std::endl;
Statistics::stats_stream() << "no of structure-map calls: \t" << _no_of_structure_map_calls << std::endl;
Statistics::stats_stream().close();
MessageStreams::verbose() << "... done." << std::endl;
}
// report:
void Statistics::report() {
MessageStreams::verbose() << "reporting statistic values ..." << std::endl;
Statistics::stats_stream() << "report statistics:" << std::endl;
Statistics::stats_stream() << "no of singleton-map calls: \t" << _no_of_singleton_map_calls << std::endl;
Statistics::stats_stream() << "no of structure-map calls: \t" << _no_of_structure_map_calls << std::endl;
MessageStreams::verbose() << "... done." << std::endl;
}
// reset:
void Statistics::reset() {
MessageStreams::verbose() << "reset statistic values ..." << std::endl;
Statistics::stats_stream() << "reset statistics:" << std::endl;
_no_of_singleton_map_calls = 0;
_no_of_structure_map_calls = 0;
Statistics::stats_stream() << "no of singleton-map calls: \t" << _no_of_singleton_map_calls << std::endl;
Statistics::stats_stream() << "no of structure-map calls: \t" << _no_of_structure_map_calls << std::endl;
MessageStreams::verbose() << "... done." << std::endl;
}
}; // namespace topcom
// eof CommandlineOptions.cc
|