IgANet
IgANets - Isogeometric Analysis Networks
Loading...
Searching...
No Matches
iganet::MemoryDebugger< id > Class Template Reference

Memory debugger. More...

#include </home/runner/work/iganet/iganet/include/memory.hpp>

Classes

struct  MemoryObject
 Memory object. More...
 

Public Member Functions

 MemoryDebugger ()
 Default constructor.
 
template<typename T , std::size_t N>
void add (const std::string &name, const std::array< T, N > &array)
 Registers std::array to memory debugger.
 
template<typename T >
void add (const std::string &name, const T &obj)
 Registers generic type to memory debugger.
 
void add (const std::string &name, const torch::Tensor &tensor)
 Registers torch::Tensor to memory debugger.
 
void clear ()
 Clears memory debugger.
 
void pretty_print (std::ostream &os=Log(log::info)) const
 Returns a string representation of the memory debugger.
 

Private Member Functions

std::string convert_bytes (int64_t bytes) const
 Converts bytes into best human-readable unit.
 

Private Attributes

int64_t bytes_
 Counter holding the memory of registered objects in bytes.
 
int64_t counter_
 Counter holding the number of registered objects.
 
std::chrono::high_resolution_clock::time_point init_
 Reference time point.
 
std::map< std::chrono::high_resolution_clock::time_point, MemoryObjectobjects_
 Map holding the list of registered objects.
 

Detailed Description

template<std::size_t id = 0>
class iganet::MemoryDebugger< id >

Memory debugger.

Constructor & Destructor Documentation

◆ MemoryDebugger()

template<std::size_t id = 0>
iganet::MemoryDebugger< id >::MemoryDebugger ( )
inline

Default constructor.

Member Function Documentation

◆ add() [1/3]

template<std::size_t id = 0>
template<typename T , std::size_t N>
void iganet::MemoryDebugger< id >::add ( const std::string &  name,
const std::array< T, N > &  array 
)
inline

Registers std::array to memory debugger.

◆ add() [2/3]

template<std::size_t id = 0>
template<typename T >
void iganet::MemoryDebugger< id >::add ( const std::string &  name,
const T &  obj 
)
inline

Registers generic type to memory debugger.

◆ add() [3/3]

template<std::size_t id = 0>
void iganet::MemoryDebugger< id >::add ( const std::string &  name,
const torch::Tensor &  tensor 
)
inline

Registers torch::Tensor to memory debugger.

◆ clear()

template<std::size_t id = 0>
void iganet::MemoryDebugger< id >::clear ( )
inline

Clears memory debugger.

◆ convert_bytes()

template<std::size_t id = 0>
std::string iganet::MemoryDebugger< id >::convert_bytes ( int64_t  bytes) const
inlineprivate

Converts bytes into best human-readable unit.

◆ pretty_print()

template<std::size_t id = 0>
void iganet::MemoryDebugger< id >::pretty_print ( std::ostream &  os = Log(log::info)) const
inline

Returns a string representation of the memory debugger.

Member Data Documentation

◆ bytes_

template<std::size_t id = 0>
int64_t iganet::MemoryDebugger< id >::bytes_
private

Counter holding the memory of registered objects in bytes.

◆ counter_

template<std::size_t id = 0>
int64_t iganet::MemoryDebugger< id >::counter_
private

Counter holding the number of registered objects.

◆ init_

template<std::size_t id = 0>
std::chrono::high_resolution_clock::time_point iganet::MemoryDebugger< id >::init_
private

Reference time point.

◆ objects_

template<std::size_t id = 0>
std::map<std::chrono::high_resolution_clock::time_point, MemoryObject> iganet::MemoryDebugger< id >::objects_
private

Map holding the list of registered objects.


The documentation for this class was generated from the following file: