squid-
cache.org
Optimising Web Delivery
Docs
Download
Donate
Support
About
Contact
Shop
Blog
src
DelayBucket.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
/* DEBUG: section 77 Delay Pools */
10
11
#include "
squid.h
"
12
13
#if USE_DELAY_POOLS
14
#include "
DelayBucket.h
"
15
#include "
DelaySpec.h
"
16
#include "
SquidConfig.h
"
17
#include "
Store.h
"
18
19
void
20
DelayBucket::stats
(
StoreEntry
*entry)
const
21
{
22
storeAppendPrintf
(entry,
"%d"
,
level
());
23
}
24
25
void
26
DelayBucket::update
(
DelaySpec
const
&rate,
int
incr)
27
{
28
if
(rate.
restore_bps
!= -1 &&
29
(
level
() += rate.
restore_bps
* incr) > rate.
max_bytes
)
30
level
() = rate.
max_bytes
;
31
}
32
33
int
34
DelayBucket::bytesWanted
(
int
minimum,
int
maximum)
const
35
{
36
int
result =
max
(minimum,
min
(maximum,
level
()));
37
return
result;
38
}
39
40
void
41
DelayBucket::bytesIn
(
int
qty)
42
{
43
level
() -= qty;
44
}
45
46
void
47
DelayBucket::init
(
DelaySpec
const
&rate)
48
{
49
level
() = (
int
) (((
double
)rate.
max_bytes
*
50
Config
.
Delay
.
initial
) / 100);
51
}
52
53
#endif
/* USE_DELAY_POOLS */
54
DelayBucket.h
DelaySpec.h
Config
class SquidConfig Config
Definition:
SquidConfig.cc:12
SquidConfig.h
Store.h
DelayBucket::init
void init(DelaySpec const &)
Definition:
DelayBucket.cc:47
DelayBucket::update
void update(DelaySpec const &, int incr)
Definition:
DelayBucket.cc:26
DelayBucket::bytesIn
void bytesIn(int qty)
Definition:
DelayBucket.cc:41
DelayBucket::stats
void stats(StoreEntry *) const
Definition:
DelayBucket.cc:20
DelayBucket::level
int const & level() const
Definition:
DelayBucket.h:24
DelayBucket::bytesWanted
int bytesWanted(int min, int max) const
Definition:
DelayBucket.cc:34
DelayConfig::initial
unsigned short initial
Definition:
DelayConfig.h:28
DelaySpec
Definition:
DelaySpec.h:16
DelaySpec::restore_bps
int restore_bps
Definition:
DelaySpec.h:23
DelaySpec::max_bytes
int64_t max_bytes
Definition:
DelaySpec.h:24
SquidConfig::Delay
DelayConfig Delay
Definition:
SquidConfig.h:445
StoreEntry
Definition:
Store.h:42
max
A const & max(A const &lhs, A const &rhs)
Definition:
compat_shared.h:124
min
A const & min(A const &lhs, A const &rhs)
Definition:
compat_shared.h:103
squid.h
storeAppendPrintf
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition:
store.cc:841
int
int unsigned int
Definition:
stub_fd.cc:19
Introduction
About Squid
Why Squid?
Squid Developers
How to Donate
How to Help Out
Getting Squid
Squid Source Packages
Squid Deployment Case-Studies
Squid Software Foundation
Documentation
Quick Setup
Configuration:
Reference
Examples
FAQ
and
Wiki
Guide Books:
Beginners
Definitive
Non-English
More...
Support
Security Advisories
Bugzilla Database
Mailing lists
Contacting us
Commercial services
Project Sponsors
Squid-based products
Miscellaneous
Developer Resources
Related Writings
Related Software:
Authenticators
Ecap
Icap
Ident
Log Analysis
Monitor
Proxies
Redirectors
General
Squid Artwork
Web Site Translations
Japanese
Mirrors
Website:
...
full list
FTP Package Archive