Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
PTL::TaskAllocatorList Class Reference

#include <TaskAllocatorList.hh>

Public Member Functions

 ~TaskAllocatorList ()
 
void Register (TaskAllocatorBase *)
 
void Destroy (int nStat=0, int verboseLevel=0)
 
int Size () const
 

Static Public Member Functions

static TaskAllocatorListGetAllocatorList ()
 
static TaskAllocatorListGetAllocatorListIfExist ()
 

Detailed Description

Definition at line 38 of file TaskAllocatorList.hh.

Constructor & Destructor Documentation

◆ ~TaskAllocatorList()

TaskAllocatorList::~TaskAllocatorList ( )

Definition at line 65 of file TaskAllocatorList.cc.

65{ fAllocatorList() = nullptr; }

Member Function Documentation

◆ Destroy()

void TaskAllocatorList::Destroy ( int  nStat = 0,
int  verboseLevel = 0 
)

Definition at line 78 of file TaskAllocatorList.cc.

79{
80 int i = 0, j = 0;
81 double tmem = 0;
82 if(verboseLevel > 0)
83 {
84 std::cout << "================== Deleting memory pools ==================="
85 << std::endl;
86 }
87 for(auto& itr : fList)
88 {
89 double mem = itr->GetAllocatedSize();
90 if(i < nStat)
91 {
92 i++;
93 tmem += mem;
94 itr->ResetStorage();
95 continue;
96 }
97 j++;
98 tmem += mem;
99 if(verboseLevel > 1)
100 {
101 std::cout << "Pool ID '" << itr->GetPoolType()
102 << "', size : " << std::setprecision(3) << mem / 1048576
103 << std::setprecision(6) << " MB" << std::endl;
104 }
105 itr->ResetStorage();
106 // delete *itr;
107 }
108 if(verboseLevel > 0)
109 {
110 std::cout << "Number of memory pools allocated: " << Size()
111 << "; of which, static: " << i << std::endl;
112 std::cout << "Dynamic pools deleted: " << j
113 << " / Total memory freed: " << std::setprecision(2) << tmem / 1048576
114 << std::setprecision(6) << " MB" << std::endl;
115 std::cout << "============================================================"
116 << std::endl;
117 }
118 fList.clear();
119}

◆ GetAllocatorList()

TaskAllocatorList * TaskAllocatorList::GetAllocatorList ( )
static

Definition at line 42 of file TaskAllocatorList.cc.

43{
44 if(!fAllocatorList())
45 {
46 fAllocatorList() = new TaskAllocatorList;
47 }
48 return fAllocatorList();
49}

Referenced by PTL::TaskAllocatorBase::TaskAllocatorBase().

◆ GetAllocatorListIfExist()

TaskAllocatorList * TaskAllocatorList::GetAllocatorListIfExist ( )
static

Definition at line 54 of file TaskAllocatorList.cc.

55{
56 return fAllocatorList();
57}

◆ Register()

void TaskAllocatorList::Register ( TaskAllocatorBase alloc)

Definition at line 70 of file TaskAllocatorList.cc.

71{
72 fList.push_back(alloc);
73}

Referenced by PTL::TaskAllocatorBase::TaskAllocatorBase().

◆ Size()

int TaskAllocatorList::Size ( ) const

Definition at line 124 of file TaskAllocatorList.cc.

125{
126 return fList.size();
127}

Referenced by Destroy().


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