20 #include "SheafSystem/report.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/namespace_poset.h" 24 #include "SheafSystem/std_fstream.h" 25 #include "SheafSystem/std_iostream.h" 26 #include "SheafSystem/std_iomanip.h" 42 invariance(watch().invariant());
43 invariance(watch().lap_ct() == names().ct());
44 invariance(name_space() != 0 ? watch().lap_ct() == memory().ct() :
true);
85 _name_space = xname_space;
144 for (
int i=0; i<3; i++)
145 _memory_parts[i].clear();
165 _names.push_back(xname);
166 size_t lmemory_parts[4];
170 _memory.push_back(deep_size(*_name_space,
true, lmemory_parts));
171 for (
int i=0; i<4; i++)
172 _memory_parts[i].push_back(lmemory_parts[i]);
186 write(
const std::string& xfile_name)
const 192 ofstream lofs(xfile_name.c_str());
194 lofs <<
"Point,Time (sec),";
197 lofs <<
"Memory (bytes),";
198 lofs <<
"Cover Relation Graph,";
199 lofs <<
"ID Spaces,";
200 lofs <<
"Subposets,";
201 lofs <<
"DOF Tuples,";
205 for(
size_t i=0; i<_watch.lap_ct(); i++)
207 lofs << _names[i] <<
"," << _watch.lap_time(i) <<
",";
210 lofs << _memory[i] <<
",";
211 lofs << _memory_parts[0][i] <<
",";
212 lofs << _memory_parts[1][i] <<
",";
213 lofs << _memory_parts[2][i] <<
",";
214 lofs << _memory_parts[3][i] <<
",";
219 lofs <<
"Total," << _watch.cumulative_time() <<
",";
222 size_t lmemory_parts[4];
223 lofs << deep_size(*_name_space,
true, lmemory_parts) <<
",";
224 lofs << lmemory_parts[0] <<
",";
225 lofs << lmemory_parts[1] <<
",";
226 lofs << lmemory_parts[2] <<
",";
227 lofs << lmemory_parts[3] <<
",";
256 xos <<
"Report: " << xreport.
title() << endl << endl;
260 xos << setw(lcol1) <<
"Point" << setw(lcol2) <<
"Time (sec)";
263 xos << setw(lcol3) <<
"Memory (bytes)";
264 xos << setw(lcol4) <<
"Cover Relation Graph";
265 xos << setw(lcol5) <<
"ID Spaces";
266 xos << setw(lcol6) <<
"Subposets";
267 xos << setw(lcol7) <<
"DOF Tuples";
273 size_t ltotal = lcol1 + lcol2;
275 ltotal += lcol3 + lcol4 + lcol5 + lcol6 + lcol7;
277 for(
size_t i=0; i<ltotal; i++)
287 for(
size_t i=0; i<lwatch.
lap_ct(); ++i)
289 xos << setw(lcol1) << xreport.
names()[i]
290 << setw(lcol2) << lwatch.
lap_time(i);
294 xos << setw(lcol3) << xreport.
memory()[i];
306 xos << setw(lcol1) <<
"Total" << setw(lcol2) << lwatch.
cumulative_time();
309 size_t lmemory_parts[4];
310 xos << setw(lcol3) << deep_size(*xreport.
name_space(),
true, lmemory_parts);
311 xos << setw(lcol4) << lmemory_parts[0];
312 xos << setw(lcol5) << lmemory_parts[1];
313 xos << setw(lcol6) << lmemory_parts[2];
314 xos << setw(lcol7) << lmemory_parts[3];
std::string title() const
Title of the report.
block< size_t > memory() const
Deep size of the namespace poset for each point.
void write(const std::string &xfile_name) const
Write the report to a comma separated value file.
double cumulative_time() const
The accumulated time in seconds between start()'s and stop()'s since the last reset().
block< std::string > names() const
Names of the report points.
double lap_time(int i) const
The length in seconds of the xi-th lap.
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
size_t lap_ct() const
The number of laps that have be marked.
virtual bool invariant() const
Class invariant.
report()
Default constructor.
void point(const std::string &xname)
Mark a point named, xname, in the report.
void reset()
Reset the report.
virtual ~report()
Destructor.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
block< size_t > memory_part(int lpart) const
Deep size of the namespace for each component for each point.
A report generating class.
A clock for timing intervals.
stop_watch watch() const
Stop watch used to time the report points.
void start(const std::string &xname)
Starts a new report with title, xtitle.
const namespace_poset * name_space() const
Namespace for the report.