13 #ifndef _ZOLTAN2_METRICOUTPUT_MANAGER_CPP_
14 #define _ZOLTAN2_METRICOUTPUT_MANAGER_CPP_
55 bool metricsOn, std::string units=std::string(
""),
int width=10):
57 os_(static_cast<std::ostream *>(&Os)), osFile_(&Os),
58 iPrint_(doPrinting), wePrint_(metricsOn),
59 units_(units), width_(width){}
72 bool metricsOn, std::string units=std::string(
""),
int width=10):
73 me_(rank), os_(&Os), osFile_(NULL),
74 iPrint_(doPrinting), wePrint_(metricsOn),
75 units_(units), width_(width){}
93 inline void print(
const std::string &msg,
const T val){
96 os_->width(10); os_->fill(
'*');
97 *os_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
98 os_->width(0); os_->fill(
' ');
101 osFile_->width(10); osFile_->fill(
'*');
102 *osFile_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
103 osFile_->width(0); osFile_->fill(
' ');
114 inline void print(
const char *msg, T val){
117 os_->width(10); os_->fill(
'*');
118 *os_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
119 os_->width(0); os_->fill(
' ');
122 osFile_->width(10); osFile_->fill(
'*');
123 *osFile_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
124 osFile_->width(0); osFile_->fill(
' ');
133 std::ofstream *osFile_;
void print(const std::string &msg, const T val)
Print a line of information.
MetricOutputManager handles output of profiling messages.
void print(const char *msg, T val)
A version of print that takes char to avoid the cost of converting char * to string.
MetricOutputManager(int rank, bool doPrinting, std::ostream &Os, bool metricsOn, std::string units=std::string(""), int width=10)
Constructor for output to a stream.
std::ostream * getOStream() const
Return the output stream for messages.
bool getMetricsOn() const
Return true if any process outputs metrics.
~MetricOutputManager()
Destructor.
MetricOutputManager(int rank, bool doPrinting, std::ofstream &Os, bool metricsOn, std::string units=std::string(""), int width=10)
Constructor for output to a file.