Class: OsCtld::Config::CpuScheduler
- Inherits:
-
Object
- Object
- OsCtld::Config::CpuScheduler
- Defined in:
- lib/osctld/config.rb
Instance Attribute Summary collapse
- #enable ⇒ Boolean (also: #enable?) readonly
- #min_package_container_count_percent ⇒ Integer readonly
- #packages ⇒ Hash<Integer, CpuPackage> readonly
-
#sequential_start_priority_threshold ⇒ Integer
readonly
Containers with priority beneath this threshold are put on the second CPU package on systems with two CPU packages if sequential start/stop is enabled.
Instance Method Summary collapse
-
#initialize(cfg) ⇒ CpuScheduler
constructor
A new instance of CpuScheduler.
Constructor Details
#initialize(cfg) ⇒ CpuScheduler
Returns a new instance of CpuScheduler.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/osctld/config.rb', line 28 def initialize(cfg) @enable = cfg.fetch('enable', false) @min_package_container_count_percent = cfg.fetch('min_package_container_count_percent', 90) @packages = cfg.fetch('packages', {}).to_h do |k, v| pkg = CpuPackage.new(k, v) [pkg.id, pkg] end @sequential_start_priority_threshold = cfg.fetch('sequential_start_priority_threshold', 1000) end |
Instance Attribute Details
#enable ⇒ Boolean (readonly) Also known as: enable?
8 9 10 |
# File 'lib/osctld/config.rb', line 8 def enable @enable end |
#min_package_container_count_percent ⇒ Integer (readonly)
12 13 14 |
# File 'lib/osctld/config.rb', line 12 def min_package_container_count_percent @min_package_container_count_percent end |
#packages ⇒ Hash<Integer, CpuPackage> (readonly)
15 16 17 |
# File 'lib/osctld/config.rb', line 15 def packages @packages end |
#sequential_start_priority_threshold ⇒ Integer (readonly)
Containers with priority beneath this threshold are put on the second CPU package on systems with two CPU packages if sequential start/stop is enabled. Containers with priority equal or higher than the threshold might be started out of priority order on systems with two CPU packages.
Note that all thus prioritized containers will be put on the second CPU package, and so it is possible to cause imbalance in CPU usage if all the containers are heavy CPU users.
26 27 28 |
# File 'lib/osctld/config.rb', line 26 def sequential_start_priority_threshold @sequential_start_priority_threshold end |