49 #ifndef _ZOLTAN2_METRICOUTPUT_MANAGER_CPP_
50 #define _ZOLTAN2_METRICOUTPUT_MANAGER_CPP_
91 bool metricsOn, std::string units=std::string(
""),
int width=10):
93 os_(static_cast<std::ostream *>(&Os)), osFile_(&Os),
94 iPrint_(doPrinting), wePrint_(metricsOn),
95 units_(units), width_(width){}
108 bool metricsOn, std::string units=std::string(
""),
int width=10):
109 me_(rank), os_(&Os), osFile_(NULL),
110 iPrint_(doPrinting), wePrint_(metricsOn),
111 units_(units), width_(width){}
129 inline void print(
const std::string &msg,
const T val){
132 os_->width(10); os_->fill(
'*');
133 *os_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
134 os_->width(0); os_->fill(
' ');
137 osFile_->width(10); osFile_->fill(
'*');
138 *osFile_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
139 osFile_->width(0); osFile_->fill(
' ');
150 inline void print(
const char *msg, T val){
153 os_->width(10); os_->fill(
'*');
154 *os_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
155 os_->width(0); os_->fill(
' ');
158 osFile_->width(10); osFile_->fill(
'*');
159 *osFile_ << me_ <<
": " << val <<
" " << units_ <<
", " << msg << std::endl;
160 osFile_->width(0); osFile_->fill(
' ');
169 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.