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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
////////////////////////////////////////////////////////////////////////////////
//
// ScreenReport.hh
//
// produced: 2024-04-15 jr
//
////////////////////////////////////////////////////////////////////////////////
#ifndef SCREENREPORT_HH
#define SCREENREPORT_HH
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include "Signal.hh"
#include "Global.hh"
#include "CommandlineOptions.hh"
#include "ContainerIO.hh"
#include "Message.hh"
typedef std::vector<int> progress_vector_type;
namespace topcom {
// the following class can be used to organize the reporting
// of intermediate results to the screen:
class ScreenReport {
public:
static const char* field_separator;
private:
long _countdown;
long _old_count;
public:
inline ScreenReport();
inline ScreenReport(const ScreenReport&);
inline ScreenReport& operator=(const ScreenReport&);
// report only according to frequency settings:
bool decide_report(const size_type);
Message& execute_worker_report(Message&,
const int,
const size_type,
const size_type,
const size_type,
const size_type,
const size_type,
const progress_vector_type&) const;
Message& execute_master_report(Message&,
const int,
const size_type,
const size_type,
const size_type,
const size_type,
const size_type,
const size_type,
const size_type,
const size_type) const;
// report the various possible numbers inside a data line:
Message& report_master(Message&) const;
Message& report_workerID(Message&, int) const;
Message& report_nodecount(Message&, const size_type) const;
Message& report_symcount(Message&, const size_type) const;
Message& report_totalcount(Message&, const size_type) const;
Message& report_deadendcount(Message&, const size_type) const;
Message& report_earlydeadendcount(Message&, const size_type) const;
Message& report_workbuffersize(Message&, const size_type) const;
Message& report_minworkbuffersize(Message&, const size_type) const;
Message& report_nodebudget(Message&, const size_type) const;
Message& report_idlethreads(Message&, const int idlethreads) const;
Message& report_progressvector(Message&, const progress_vector_type& progressvector) const;
};
inline ScreenReport::ScreenReport() :
_countdown(CommandlineOptions::report_frequency()),
_old_count(0) {}
inline ScreenReport::ScreenReport(const ScreenReport& sr) :
_countdown(sr._countdown),
_old_count(sr._old_count) {}
inline ScreenReport& ScreenReport::operator=(const ScreenReport& sr) {
if (this == &sr) {
return *this;
}
_countdown = sr._countdown;
_old_count = sr._old_count;
return *this;
}
}; // namespace topcom
#endif
// eof CommandlineOptions.hh
|