ATLAS Offline Software
Tools
LWHists
src
LWPoolSelector.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
7
// //
8
// Header file for class LWPoolSelector //
9
// //
10
// Description: Helper class doing the math which finds //
11
// the actual memory pool to use for a given //
12
// request. //
13
// //
14
// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
15
// Initial version: April 2009 //
16
// //
18
19
#ifndef LWPOOLSELECTOR_H
20
#define LWPOOLSELECTOR_H
21
22
#include <cassert>
23
#include <climits>
24
25
class
LWPoolSelector
{
26
public
:
27
28
static
unsigned
poolSize
(
unsigned
requestsize);
//UINT_MAX indicates need for dynamic new[]
29
static
unsigned
poolIndex
(
unsigned
requestsize);
//UINT_MAX indicates need for dynamic delete[]
30
static
const
unsigned
numberOfPools
= 58;
31
static
unsigned
nPools
() {
return
numberOfPools
; }
32
static
unsigned
maxNonDynamicRequest
() {
return
5400; }
33
34
private
:
35
LWPoolSelector
();
36
~LWPoolSelector
();
37
static
unsigned
roundup
(
unsigned
l
,
unsigned
n
);
38
};
39
41
// Inlines //
43
44
// NB: It is cheap to check if an integer, i satisfies: i>=2**n,
45
// or i<2**n. It is likewise cheap to divide by 2**n.
46
47
inline
unsigned
LWPoolSelector::roundup
(
unsigned
l
,
unsigned
n
) {
48
//Round up to nearest multiple of n without branching
49
assert(
l
>0&&
n
>0);
50
return
n
+
l
-1-(
l
-1)%
n
;
51
}
52
53
inline
unsigned
LWPoolSelector::poolSize
(
unsigned
l
)
54
{
55
assert(
l
>0);
56
if
(
l
<16)
57
return
l
;
58
if
(
l
<64)
59
return
roundup
(
l
,4);
60
if
(
l
<128)
61
return
roundup
(
l
,8);
62
if
(
l
<256)
63
return
roundup
(
l
,16);
64
if
(
l
<=640)
//640 should have room for sizeof(THnX)
65
return
roundup
(
l
,32);
66
if
(
l
<=1024)
67
return
1024;
68
if
(
l
<=
maxNonDynamicRequest
())
69
return
maxNonDynamicRequest
();
70
return
UINT_MAX;
71
}
72
73
inline
unsigned
LWPoolSelector::poolIndex
(
unsigned
l
)
74
{
75
assert(
l
>0);
76
if
(
l
<128) {
77
if
(
l
<16)
78
return
l
-1;
79
if
(
l
<64)
80
return
roundup
(
l
,4)/4+11;
81
return
roundup
(
l
,8)/8+19;
82
}
83
if
(
l
<256)
84
return
roundup
(
l
,16)/16+27;
85
if
(
l
<=640)
86
return
roundup
(
l
,32)/32+35;
87
if
(
l
<=1024)
88
return
nPools
()-2;
89
if
(
l
<=
maxNonDynamicRequest
())
90
return
nPools
()-1;
91
return
UINT_MAX;
92
}
93
94
95
#endif
96
97
LWPoolSelector::nPools
static unsigned nPools()
Definition:
LWPoolSelector.h:31
LWPoolSelector::maxNonDynamicRequest
static unsigned maxNonDynamicRequest()
Definition:
LWPoolSelector.h:32
LWPoolSelector::numberOfPools
static const unsigned numberOfPools
Definition:
LWPoolSelector.h:30
UploadAMITag.l
list l
Definition:
UploadAMITag.larcaf.py:158
LWPoolSelector
Definition:
LWPoolSelector.h:25
LWPoolSelector::~LWPoolSelector
~LWPoolSelector()
beamspotman.n
n
Definition:
beamspotman.py:731
LWPoolSelector::roundup
static unsigned roundup(unsigned l, unsigned n)
Definition:
LWPoolSelector.h:47
LWPoolSelector::poolSize
static unsigned poolSize(unsigned requestsize)
Definition:
LWPoolSelector.h:53
LWPoolSelector::LWPoolSelector
LWPoolSelector()
LWPoolSelector::poolIndex
static unsigned poolIndex(unsigned requestsize)
Definition:
LWPoolSelector.h:73
Generated on Tue Jul 2 2024 21:20:58 for ATLAS Offline Software by
1.8.18