1 /*
2  * Copyright (C) 1996-2021 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 #ifndef SQUID_CPU_AFFINITY_MAP_H
10 #define SQUID_CPU_AFFINITY_MAP_H
11 
12 #include <vector>
13 
14 class CpuAffinitySet;
15 
16 /// stores cpu_affinity_map configuration
17 class CpuAffinityMap
18 {
19 public:
20     /// append cpu_affinity_map option
21     bool add(const std::vector<int> &aProcesses, const std::vector<int> &aCores);
22 
23     /// calculate CPU set for this process
24     CpuAffinitySet *calculateSet(const int targetProcess) const;
25 
26     /// returns list of process numbers
processes()27     const std::vector<int> &processes() const { return theProcesses; }
28 
29     /// returns list of cores
cores()30     const std::vector<int> &cores() const { return theCores; }
31 
32 private:
33     std::vector<int> theProcesses; ///< list of process numbers
34     std::vector<int> theCores; ///< list of cores
35 };
36 
37 #endif // SQUID_CPU_AFFINITY_MAP_H
38 
39