53 #ifdef MUELU_USE_MALLINFO 66 #ifdef MUELU_USE_MALLINFO 67 struct mallinfo mem_stats = mallinfo();
68 double memory = mem_stats.hblkhd + mem_stats.usmblks + mem_stats.uordblks;
71 sprintf(memchar,
"%12.1f MB",memory/1048576.0);
72 std::string mem(memchar);
76 std::ostringstream mem;
77 std::ifstream proc(
"/proc/self/status");
81 while(getline(proc, s), !proc.fail()) {
82 if(s.substr(0, 6) ==
"VmSize") {
94 #ifdef MUELU_USE_MALLINFO 95 struct mallinfo mem_stats = mallinfo();
96 double memory = mem_stats.hblkhd + mem_stats.usmblks + mem_stats.uordblks;
99 sprintf(memchar,
"%12.1f MB",memory/1048576.0);
100 std::string mem(memchar);
104 std::ostringstream mem;
105 std::ifstream proc(
"/proc/meminfo");
107 while(getline(proc, s), !proc.fail()) {
108 if(s.substr(0, 7) ==
"MemFree") {
118 #ifdef HAVE_MUELU_PROFILING 121 double maxTime=0,minTime=0,avgTime=0;
124 int ntimers=1, root=0;
125 MPI_Reduce(&localTime,&maxTime,ntimers,MPI_DOUBLE,MPI_MAX,root,MPI_COMM_WORLD);
126 MPI_Reduce(&localTime,&minTime,ntimers,MPI_DOUBLE,MPI_MIN,root,MPI_COMM_WORLD);
127 MPI_Reduce(&localTime,&avgTime,ntimers,MPI_DOUBLE,MPI_SUM,root,MPI_COMM_WORLD);
136 std::cout <<
"&&&" << timer.
name()
137 <<
" max=" << maxTime <<
" min=" << minTime <<
" avg=" << avgTime << std::endl;
std::string PrintMemoryUsage()
Namespace for MueLu classes and methods.
void ReportTimeAndMemory(Teuchos::Time const &timer, Teuchos::Comm< int > const &Comm)
const std::string & name() const
virtual int getRank() const=0
double totalElapsedTime(bool readCurrentTime=false) const
std::string PrintMemoryInfo()
virtual int getSize() const=0