CbmRoot
Loading...
Searching...
No Matches
MemoryLogger.h
Go to the documentation of this file.
1/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Felix Weiglhofer [committer] */
4
5#pragma once
6
7#include <cstddef>
8
14namespace cbm::algo
15{
16
21
22 public:
26 MemoryLogger() = default;
27
31 ~MemoryLogger() = default;
32
36 void Log();
37
38 private:
39 size_t mLastRSS = 0;
40
41 // Convert bytes to MB
42 // Template to allow for different integer types
43 template<typename T>
44 T BytesToMB(T bytes) const;
45 };
46
47} // namespace cbm::algo
Track the memory usage of the process and write it to the log.
void Log()
Log the current memory usage.
MemoryLogger()=default
Constructor.
~MemoryLogger()=default
Destructor.
T BytesToMB(T bytes) const