TECA
The Toolkit for Extreme Climate Analysis
teca_memory_profiler.h
1 #ifndef teca_memory_profiler_h
2 #define teca_memory_profiler_h
3 
4 #include "teca_mpi.h"
5 #include <string>
6 
7 extern "C" void *profile(void *argp);
8 
9 /// MemoryProfiler - A sampling memory use profiler.
10 /**
11  * The class samples process memory usage at the specified interval
12  * given in seconds. For each sample the time is acquired. Calling
13  * Initialize starts profiling, and Finalize ends it. During
14  * Finalization the buffers are written using MPI-I/O to the
15  * file name provided.
16  */
18 {
19 public:
22 
24  void operator=(const teca_memory_profiler &) = delete;
25 
26  // start and stop the profiler
27  int initialize();
28  int finalize();
29 
30  // Set the interval in seconds between querying
31  // the processes memory use.
32  void set_interval(double interval);
33  double get_interval() const;
34 
35  // Set the communicator for parallel I/O
36  void set_communicator(MPI_Comm comm);
37 
38  // Set the file name to write the data to
39  void set_filename(const std::string &filename);
40  const char *get_filename() const;
41 
42  friend void *profile(void *argp);
43 
44 private:
45  struct internals_type;
46  internals_type *internals;
47 };
48 
49 #endif
teca_file_util::filename
std::string filename(const std::string &filename)
teca_memory_profiler
MemoryProfiler - A sampling memory use profiler.
Definition: teca_memory_profiler.h:17