17 #ifdef MUELU_USE_MALLINFO
28 #ifdef MUELU_USE_MALLINFO
29 struct mallinfo mem_stats = mallinfo();
30 double memory = mem_stats.hblkhd + mem_stats.usmblks + mem_stats.uordblks;
33 sprintf(memchar,
"%12.1f MB", memory / 1048576.0);
34 std::string mem(memchar);
38 std::ostringstream mem;
39 std::ifstream proc(
"/proc/self/status");
43 while (getline(proc, s), !proc.fail()) {
44 if (s.substr(0, 6) ==
"VmSize") {
54 #ifdef MUELU_USE_MALLINFO
55 struct mallinfo mem_stats = mallinfo();
56 double memory = mem_stats.hblkhd + mem_stats.usmblks + mem_stats.uordblks;
59 sprintf(memchar,
"%12.1f MB", memory / 1048576.0);
60 std::string mem(memchar);
64 std::ostringstream mem;
65 std::ifstream proc(
"/proc/meminfo");
67 while (getline(proc, s), !proc.fail()) {
68 if (s.substr(0, 7) ==
"MemFree") {
78 double maxTime = 0, minTime = 0, avgTime = 0;
81 int ntimers = 1, root = 0;
82 MPI_Reduce(&localTime, &maxTime, ntimers, MPI_DOUBLE, MPI_MAX, root, MPI_COMM_WORLD);
83 MPI_Reduce(&localTime, &minTime, ntimers, MPI_DOUBLE, MPI_MIN, root, MPI_COMM_WORLD);
84 MPI_Reduce(&localTime, &avgTime, ntimers, MPI_DOUBLE, MPI_SUM, root, MPI_COMM_WORLD);
93 std::cout <<
"&&&" << timer.
name()
94 <<
" max=" << maxTime <<
" min=" << minTime <<
" avg=" << avgTime << std::endl;
virtual int getSize() const =0
std::string PrintMemoryUsage()
virtual int getRank() const =0
void ReportTimeAndMemory(Teuchos::Time const &timer, Teuchos::Comm< int > const &Comm)
const std::string & name() const
double totalElapsedTime(bool readCurrentTime=false) const
std::string PrintMemoryInfo()