#include <XrdSsiScale.hh>
|
static const uint16_t | defSprd = 4 |
static const uint16_t | maxPend = 64000 |
static const uint16_t | maxSprd = 1024 |
static const uint16_t | maxTune = 128 |
static const uint16_t | midTune = 64 |
static const uint16_t | minTune = 3 |
static const uint16_t | zipTune = 512 |
Definition at line 37 of file XrdSsiScale.hh.
◆ XrdSsiScale()
XrdSsiScale::XrdSsiScale |
( |
| ) |
|
|
inline |
Definition at line 57 of file XrdSsiScale.hh.
57 : Active(0), reActive(0), begEnt(0), nowEnt(0),
58 curSpread(
defSprd), autoTune(
false), needTune(
false)
59 {memset(pendCnt, 0,
sizeof(uint16_t)*
maxSprd);}
static const uint16_t maxSprd
static const uint16_t defSprd
References defSprd, and maxSprd.
◆ ~XrdSsiScale()
XrdSsiScale::~XrdSsiScale |
( |
| ) |
|
|
inline |
◆ getEnt()
int XrdSsiScale::getEnt |
( |
| ) |
|
Definition at line 50 of file XrdSsiScale.cc.
51{
52 static const int tuneMLen = 80;
53 char tuneMsg[tuneMLen]; *tuneMsg = 0;
54
55
56
57
58
59
60 entMutex.Lock();
61 uint16_t endEnt = curSpread;
62 do {for (uint16_t i = nowEnt; i < endEnt; i++)
64 {pendCnt[i]++;
65 nowEnt = i+1;
66 if (!begEnt || i < begEnt) Active++;
67 else reActive++;
68 entMutex.UnLock();
69 if (*tuneMsg)
Log.
Emsg(
"Scale", tuneMsg);
70 return int(i);
71 }
72 }
73
74
75
76
77 if (nowEnt == begEnt)
78 {if (!autoTune || !Tune(tuneMsg, tuneMLen)) break;
79 endEnt = curSpread;
80 } else endEnt = nowEnt;
81 nowEnt = begEnt;
82 } while(true);
83
84
85
86 entMutex.UnLock();
87 if (*tuneMsg)
Log.
Emsg(
"Scale", tuneMsg);
88 return -1;
89}
static const uint16_t maxPend
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
References XrdSsi::Log, and maxPend.
◆ retEnt()
void XrdSsiScale::retEnt |
( |
int | xEnt | ) |
|
Definition at line 95 of file XrdSsiScale.cc.
96{
97
98
99
100
101 if (xEnt >= 0 && xEnt <
int(
maxSprd))
102 {entMutex.Lock();
103 if (pendCnt[xEnt])
104 {pendCnt[xEnt]--;
105 if (!begEnt || xEnt < (int)begEnt)
106 {if (Active) Active--;
107 if (begEnt && needTune && Active <= (reActive + (reActive>>1)))
108 {Retune();
109 return;
110 }
111 } else if (reActive) reActive--;
112 }
113 }
114
115
116
117 entMutex.UnLock();
118}
References maxSprd.
◆ rsvEnt()
bool XrdSsiScale::rsvEnt |
( |
int | xEnt | ) |
|
Definition at line 154 of file XrdSsiScale.cc.
155{
156
157
158
159 if (xEnt >= 0 && xEnt <
int(
maxSprd))
160 {entMutex.Lock();
162 {pendCnt[xEnt]++;
163 entMutex.UnLock();
164 return true;
165 }
166 entMutex.UnLock();
167 }
168 return false;
169}
References maxPend, and maxSprd.
◆ setSpread()
void XrdSsiScale::setSpread |
( |
short | sval | ) |
|
Definition at line 175 of file XrdSsiScale.cc.
176{
177 entMutex.Lock();
178
179 if (sval <= 0)
180 {autoTune = true;
181 if (sval < 0) sval = -sval;
182 } else {
183 autoTune = needTune = false;
184 begEnt = 0;
185 }
186
187 if (sval)
188 {uint16_t newSpread;
189 if (sval <
short(
maxSprd)) newSpread =
static_cast<uint16_t
>(sval);
191 if (autoTune && newSpread < curSpread)
192 {needTune = false;
193 begEnt = 0;
194 }
195 curSpread = newSpread;
196 }
197
198 entMutex.UnLock();
199}
References maxSprd.
◆ defSprd
const uint16_t XrdSsiScale::defSprd = 4 |
|
static |
◆ maxPend
const uint16_t XrdSsiScale::maxPend = 64000 |
|
static |
◆ maxSprd
const uint16_t XrdSsiScale::maxSprd = 1024 |
|
static |
◆ maxTune
const uint16_t XrdSsiScale::maxTune = 128 |
|
static |
◆ midTune
const uint16_t XrdSsiScale::midTune = 64 |
|
static |
◆ minTune
const uint16_t XrdSsiScale::minTune = 3 |
|
static |
◆ zipTune
const uint16_t XrdSsiScale::zipTune = 512 |
|
static |
The documentation for this class was generated from the following files: