repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
perf: optimize worker choice strategies
[poolifier.git]
/
src
/
pools
/
worker.ts
diff --git
a/src/pools/worker.ts
b/src/pools/worker.ts
index 4d935a113336921a5f49e6858046b07a863096fd..598e6be82ca22588c34f04d6a0c402359956b66d 100644
(file)
--- 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'
import type { CircularArray } from '../circular-array'
import type { Queue } from '../queue'
@@
-57,50
+56,60
@@
export interface Task<Data = unknown> {
}
/**
}
/**
- * Measure statistics.
+ * Measure
ment
statistics.
*
* @internal
*/
*
* @internal
*/
-export interface MeasureStatistics {
+export interface Measure
ment
Statistics {
/**
/**
- * Measure
aggregation
.
+ * Measure
ment aggregate
.
*/
*/
- aggregat
ion
: number
+ aggregat
e
: number
/**
/**
- * Measure average.
+ * Measure
ment
average.
*/
average: number
/**
*/
average: number
/**
- * Measure median.
+ * Measure
ment
median.
*/
median: number
/**
*/
median: number
/**
- * Measure history.
+ * Measure
ment
history.
*/
history: CircularArray<number>
}
/**
*/
history: CircularArray<number>
}
/**
- *
Task
statistics.
+ *
Event loop utilization measurement
statistics.
*
* @internal
*/
*
* @internal
*/
+export interface EventLoopUtilizationMeasurementStatistics {
+ idle: MeasurementStatistics
+ active: MeasurementStatistics
+ utilization: number
+}
+/**
+ * Task statistics.
+ *
+ * @internal
+ */
export interface TaskStatistics {
/**
export interface TaskStatistics {
/**
- * Number of
tasks executed
.
+ * Number of
executed tasks
.
*/
executed: number
/**
*/
executed: number
/**
- * Number of
tasks executing
.
+ * Number of
executing tasks
.
*/
executing: number
/**
*/
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
}
*/
failed: number
}
@@
-118,15
+127,15
@@
export interface WorkerUsage {
/**
* Tasks runtime statistics.
*/
/**
* Tasks runtime statistics.
*/
- runTime: MeasureStatistics
+ runTime: Measure
ment
Statistics
/**
* Tasks wait time statistics.
*/
/**
* Tasks wait time statistics.
*/
- waitTime: MeasureStatistics
+ waitTime: Measure
ment
Statistics
/**
/**
- *
Event loop utilization
.
+ *
Tasks event loop utilization statistics
.
*/
*/
- elu: EventLoopUtilization
| undefined
+ elu: EventLoopUtilization
MeasurementStatistics
}
/**
}
/**