GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — async-profiler/src/rateLimit.cpp at jonoffcpu-dev · jonoffcpu/async-profiler Expand file tree/ Copy pathrateLimit.cppMore file actions 37 lines (31 loc) · 1.05 KB / Copy pathrateLimit.cppFile metadata and controls37 lines (31 loc) · 1.05 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 /* * Copyright The async-profiler authors * SPDX-License-Identifier: Apache-2.0 */ #include <algorithm> #include "rateLimit.h" RateLimit::Budget RateLimit::_budget[EC_CATEGORIES]; int RateLimit::_enabled_categories = 0; void RateLimit::enable(Arguments& args) { int enabled_categories = 0; for (int i = 0; i < EC_CATEGORIES; i++) { if (args._rate_limit[i] >= 0) { _budget[i].budget = _budget[i].limit = args._rate_limit[i]; enabled_categories |= 1 << i; } } storeRelease(_enabled_categories, enabled_categories); } void RateLimit::disable() { storeRelease(_enabled_categories, 0); } void RateLimit::refill() { if (_enabled_categories == 0) return; for (int i = 0; i < EC_CATEGORIES; i++) { if (_enabled_categories & (1 << i)) { // Allow up to 100% budget carryover to account for short bursts long carryover = std::min(std::max(_budget[i].budget, 0L), _budget[i].limit); storeRelease(_budget[i].budget, _budget[i].limit + carryover); } } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |