QMCPACK
StackKeyParam< N > Class Template Reference
+ Inheritance diagram for StackKeyParam< N >:
+ Collaboration diagram for StackKeyParam< N >:

Public Member Functions

 StackKeyParam ()
 
void add_id (timer_id_t c1)
 
void put_id (timer_id_t c1)
 
timer_id_t get_id (int idx) const
 
bool operator== (const StackKeyParam &rhs)
 
bool operator< (const StackKeyParam &rhs) const
 

Public Attributes

union {
long int long_buckets [N]
 
timer_id_t short_buckets [sizeof(long int) *N/sizeof(timer_id_t)]
 
}; 
 
int level
 

Static Public Attributes

static const int max_level = sizeof(long int) * N
 

Detailed Description

template<int N>
class qmcplusplus::StackKeyParam< N >

Definition at line 60 of file NewTimer.h.

Constructor & Destructor Documentation

◆ StackKeyParam()

StackKeyParam ( )
inline

Definition at line 78 of file NewTimer.h.

78  : level(0)
79  {
80  for (int j = 0; j < N; j++)
81  {
82  long_buckets[j] = 0;
83  }
84  }

Member Function Documentation

◆ add_id()

void add_id ( timer_id_t  c1)
inline

Definition at line 88 of file NewTimer.h.

89  {
90  short_buckets[level] = c1;
91  if (level >= max_level - 1)
92  {
94  }
95  else
96  {
97  level++;
98  }
99  }
bool timer_max_level_exceeded
Definition: NewTimer.cpp:26
static const int max_level
Definition: NewTimer.h:76

◆ get_id()

timer_id_t get_id ( int  idx) const
inline

Definition at line 103 of file NewTimer.h.

Referenced by TimerManager< qmcplusplus::TimerType< CLOCK > >::get_stack_name_from_id().

103 { return short_buckets[idx]; }

◆ operator<()

bool operator< ( const StackKeyParam< N > &  rhs) const
inline

Definition at line 115 of file NewTimer.h.

116  {
117  for (int j = 0; j < N; j++)
118  {
119  if (!(this->long_buckets[j] == rhs.long_buckets[j]))
120  {
121  return this->long_buckets[j] < rhs.long_buckets[j];
122  }
123  }
124  return this->long_buckets[N - 1] < rhs.long_buckets[N - 1];
125  }

◆ operator==()

bool operator== ( const StackKeyParam< N > &  rhs)
inline

Definition at line 105 of file NewTimer.h.

106  {
107  bool same = false;
108  for (int j = 0; j < N; j++)
109  {
110  same &= this->long_buckets[j] == rhs.long_buckets[j];
111  }
112  return same;
113  }

◆ put_id()

void put_id ( timer_id_t  c1)
inline

Definition at line 101 of file NewTimer.h.

101 { short_buckets[level] = c1; }

Member Data Documentation

◆ @27

union { ... }

◆ level

int level

Definition at line 86 of file NewTimer.h.

Referenced by StackKeyParam< 2 >::add_id(), and StackKeyParam< 2 >::put_id().

◆ max_level

const int max_level = sizeof(long int) * N
static

Definition at line 76 of file NewTimer.h.

Referenced by StackKeyParam< 2 >::add_id().


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