1 | #pragma once |
---|---|
2 | |
3 | #include "taichi/system/virtual_memory.h" |
4 | |
5 | namespace taichi { |
6 | |
7 | class MemoryMonitor { |
8 | // avoid including py::dict |
9 | // py::dict locals; |
10 | void *locals_; |
11 | std::ofstream log_; |
12 | |
13 | public: |
14 | MemoryMonitor(int pid, std::string output_fn); |
15 | ~MemoryMonitor(); |
16 | uint64 get_usage() const; |
17 | void append_sample(); |
18 | }; |
19 | |
20 | void start_memory_monitoring(std::string output_fn, |
21 | int pid = -1, |
22 | real interval = 1); |
23 | |
24 | } // namespace taichi |
25 |