53 #ifdef MUELU_USE_MALLINFO
64 #ifdef MUELU_USE_MALLINFO
65 struct mallinfo mem_stats = mallinfo();
66 double memory = mem_stats.hblkhd + mem_stats.usmblks + mem_stats.uordblks;
69 sprintf(memchar,
"%12.1f MB", memory / 1048576.0);
70 std::string mem(memchar);
74 std::ostringstream mem;
75 std::ifstream proc(
"/proc/self/status");
79 while (getline(proc, s), !proc.fail()) {
80 if (s.substr(0, 6) ==
"VmSize") {
90 #ifdef MUELU_USE_MALLINFO
91 struct mallinfo mem_stats = mallinfo();
92 double memory = mem_stats.hblkhd + mem_stats.usmblks + mem_stats.uordblks;
95 sprintf(memchar,
"%12.1f MB", memory / 1048576.0);
96 std::string mem(memchar);
100 std::ostringstream mem;
101 std::ifstream proc(
"/proc/meminfo");
103 while (getline(proc, s), !proc.fail()) {
104 if (s.substr(0, 7) ==
"MemFree") {
114 double maxTime = 0, minTime = 0, avgTime = 0;
117 int ntimers = 1, root = 0;
118 MPI_Reduce(&localTime, &maxTime, ntimers, MPI_DOUBLE, MPI_MAX, root, MPI_COMM_WORLD);
119 MPI_Reduce(&localTime, &minTime, ntimers, MPI_DOUBLE, MPI_MIN, root, MPI_COMM_WORLD);
120 MPI_Reduce(&localTime, &avgTime, ntimers, MPI_DOUBLE, MPI_SUM, root, MPI_COMM_WORLD);
129 std::cout <<
"&&&" << timer.
name()
130 <<
" 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()