+
+ private beforeTaskRunHook (message: MessageValue<Data>): TaskPerformance {
+ // TODO: conditional accounting
+ const timestamp = performance.now()
+ return {
+ timestamp,
+ waitTime: timestamp - (message.submissionTimestamp ?? 0),
+ elu: performance.eventLoopUtilization()
+ }
+ }
+
+ private afterTaskRunHook (taskPerformance: TaskPerformance): TaskPerformance {
+ return {
+ ...taskPerformance,
+ ...{
+ runTime: performance.now() - taskPerformance.timestamp,
+ elu: performance.eventLoopUtilization(taskPerformance.elu)
+ }
+ }
+ }