Class: OsCtld::Config::CpuScheduler

Inherits:
Object
  • Object
show all
Defined in:
lib/osctld/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#enableBoolean (readonly) Also known as: enable?

Returns:

  • (Boolean)


8
9
10
# File 'lib/osctld/config.rb', line 8

def enable
  @enable
end

#min_package_container_count_percentInteger (readonly)

Returns:

  • (Integer)


12
13
14
# File 'lib/osctld/config.rb', line 12

def min_package_container_count_percent
  @min_package_container_count_percent
end

#packagesHash<Integer, CpuPackage> (readonly)

Returns:



15
16
17
# File 'lib/osctld/config.rb', line 15

def packages
  @packages
end

#sequential_start_priority_thresholdInteger (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.

Returns:

  • (Integer)


26
27
28
# File 'lib/osctld/config.rb', line 26

def sequential_start_priority_threshold
  @sequential_start_priority_threshold
end