MUQ  0.4.3
MemoryUsage.cpp
Go to the documentation of this file.
2 
3 #include "mymemory.h"
4 
5 #include <iostream>
6 #include <fstream>
7 
8 using namespace muq::Modeling;
9 
10 
11 int main(){
12 
13  int dim = 200;
14  auto mod = std::make_shared<ExpOperator>(dim);
15 
16  int numCalls = 20000;
17  std::vector<int> mem(numCalls);
18 
19  Eigen::VectorXd input = Eigen::VectorXd::Ones(dim);
20  std::vector<Eigen::VectorXd> res;
21  for(int i=0; i<numCalls; ++i){
22  res = mod->Evaluate(input);
23  mem.at(i) = getCurrentRSS( );
24  }
25 
26  // Write the memory usage to a file
27  std::ofstream fout("cpp_memory.txt");
28  for(int i=0; i<numCalls; ++i)
29  fout << mem.at(i) << "\n";
30  fout.close();
31 
32  return 0;
33 }
int main()
Definition: MemoryUsage.cpp:11
size_t getCurrentRSS()
Definition: mymemory.h:40