Skip to content

API reference / @jsprismarine/chunkgen / CgroupThrottleSampler

Class: CgroupThrottleSampler ​

Defined in: ConcurrencyGovernor.ts:175

Samples this process's control group throttle counter.

Finds cpu.stat once: the version 2 file under the process's own group, then the version 1 cpu controller's file. Anywhere else, including macOS and Windows, there is nothing to read and every sample is undefined, which the governor treats as no information.

Constructors ​

Constructor ​

new CgroupThrottleSampler(files?, root?): CgroupThrottleSampler

Defined in: ConcurrencyGovernor.ts:179

Parameters ​

files? ​

CgroupFiles = readFromDisk

root? ​

string = '/sys/fs/cgroup'

Returns ​

CgroupThrottleSampler

Accessors ​

available ​

Get Signature ​

get available(): boolean

Defined in: ConcurrencyGovernor.ts:197

Whether a throttle counter was found.

Returns ​

boolean

Methods ​

sample() ​

sample(): number | undefined

Defined in: ConcurrencyGovernor.ts:205

Returns ​

number | undefined

How many times the group was throttled since the previous sample, 0 on the first, or undefined when there is no counter to read.