MCPcopy Create free account
hub / github.com/ceph/ceph / get

Method get

src/common/Throttle.cc:154–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154bool Throttle::get(int64_t c, int64_t m)
155{
156 if (0 == max && 0 == m) {
157 count += c;
158 return false;
159 }
160
161 ceph_assert(c >= 0);
162 ldout(cct, 10) << "get " << c << " (" << count.load() << " -> " << (count.load() + c) << ")" << dendl;
163 if (logger) {
164 logger->inc(l_throttle_get_started);
165 }
166 bool waited = false;
167 {
168 std::unique_lock l(lock);
169 if (m) {
170 ceph_assert(m > 0);
171 _reset_max(m);
172 }
173 waited = _wait(c, l);
174 count += c;
175 }
176 if (logger) {
177 logger->inc(l_throttle_get);
178 logger->inc(l_throttle_get_sum, c);
179 logger->set(l_throttle_val, count);
180 }
181 return waited;
182}
183
184/* Returns true if it successfully got the requested amount,
185 * or false if it would block.

Callers 15

supportedMethod · 0.45
lookup_or_createMethod · 0.45
log_log_entryMethod · 0.45
ThrottleMethod · 0.45
BackoffThrottleMethod · 0.45
add_tokensMethod · 0.45
ref_castFunction · 0.45
waitMethod · 0.45
initMethod · 0.45
shutdownMethod · 0.45
frag.ccFile · 0.45

Calls 12

make_timespanFunction · 0.85
nowFunction · 0.50
loadMethod · 0.45
incMethod · 0.45
setMethod · 0.45
countMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
waitMethod · 0.45
wait_forMethod · 0.45
pop_frontMethod · 0.45
tincMethod · 0.45

Tested by

no test coverage detected