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