X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fworker.ts;h=598e6be82ca22588c34f04d6a0c402359956b66d;hb=d33be4309c69e39da5e81479e40b1a5ec7078bd5;hp=4d935a113336921a5f49e6858046b07a863096fd;hpb=a4e07f7216246b772e13783937a97c87105b8fc3;p=poolifier.git diff --git a/src/pools/worker.ts b/src/pools/worker.ts index 4d935a11..598e6be8 100644 --- a/src/pools/worker.ts +++ b/src/pools/worker.ts @@ -1,4 +1,3 @@ -import type { EventLoopUtilization } from 'node:perf_hooks' import type { CircularArray } from '../circular-array' import type { Queue } from '../queue' @@ -57,50 +56,60 @@ export interface Task { } /** - * Measure statistics. + * Measurement statistics. * * @internal */ -export interface MeasureStatistics { +export interface MeasurementStatistics { /** - * Measure aggregation. + * Measurement aggregate. */ - aggregation: number + aggregate: number /** - * Measure average. + * Measurement average. */ average: number /** - * Measure median. + * Measurement median. */ median: number /** - * Measure history. + * Measurement history. */ history: CircularArray } /** - * Task statistics. + * Event loop utilization measurement statistics. * * @internal */ +export interface EventLoopUtilizationMeasurementStatistics { + idle: MeasurementStatistics + active: MeasurementStatistics + utilization: number +} +/** + * Task statistics. + * + * @internal + */ export interface TaskStatistics { /** - * Number of tasks executed. + * Number of executed tasks. */ executed: number /** - * Number of tasks executing. + * Number of executing tasks. */ executing: number /** - * Number of tasks queued. + * Number of queued tasks. */ - queued: number + readonly queued: number /** - * Number of tasks failed. + * Number of failed tasks. */ failed: number } @@ -118,15 +127,15 @@ export interface WorkerUsage { /** * Tasks runtime statistics. */ - runTime: MeasureStatistics + runTime: MeasurementStatistics /** * Tasks wait time statistics. */ - waitTime: MeasureStatistics + waitTime: MeasurementStatistics /** - * Event loop utilization. + * Tasks event loop utilization statistics. */ - elu: EventLoopUtilization | undefined + elu: EventLoopUtilizationMeasurementStatistics } /**