]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/CpuAffinity.cc
4 * DEBUG: section 54 Interprocess Communication
9 #include "base/TextException.h"
10 #include "CpuAffinity.h"
11 #include "CpuAffinityMap.h"
12 #include "CpuAffinitySet.h"
19 static CpuAffinitySet
*TheCpuAffinitySet
= NULL
;
24 Must(!TheCpuAffinitySet
);
25 if (Config
.cpuAffinityMap
) {
26 const int processNumber
= InDaemonMode() ? KidIdentifier
: 1;
27 TheCpuAffinitySet
= Config
.cpuAffinityMap
->calculateSet(processNumber
);
28 if (TheCpuAffinitySet
)
29 TheCpuAffinitySet
->apply();
34 CpuAffinityReconfigure()
36 if (TheCpuAffinitySet
) {
37 TheCpuAffinitySet
->undo();
38 delete TheCpuAffinitySet
;
39 TheCpuAffinitySet
= NULL
;
47 if (Config
.cpuAffinityMap
) {
48 Must(!Config
.cpuAffinityMap
->processes().empty());
49 const int maxProcess
=
50 *std::max_element(Config
.cpuAffinityMap
->processes().begin(),
51 Config
.cpuAffinityMap
->processes().end());
53 // in no-deamon mode, there is one process regardless of squid.conf
54 const int numberOfProcesses
= InDaemonMode() ? NumberOfKids() : 1;
56 if (maxProcess
> numberOfProcesses
) {
57 debugs(54, DBG_IMPORTANT
, "WARNING: 'cpu_affinity_map' has "
58 "non-existing process number(s)");