X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fperformance%2FPerformanceStatistics.ts;h=ef9d393ab41b051d18266bc16f5ddefe090e7a60;hb=44eb6026079c8dc2c77b10a96a42d0c0b2da7c8f;hp=8dae1bea1712ee44b3f098106d4e064f286acbae;hpb=c60af6ca67ad2599e7e3e886f219da6323ead61b;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index 8dae1bea..ef9d393a 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -1,4 +1,4 @@ -// Partial Copyright Jerome Benoit. 2021. All Rights Reserved. +// Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. import { PerformanceEntry, PerformanceObserver, performance } from 'perf_hooks'; import type { URL } from 'url'; @@ -7,7 +7,7 @@ import { parentPort } from 'worker_threads'; import { MessageChannelUtils } from '../charging-station/MessageChannelUtils'; import { MessageType } from '../types/ocpp/MessageType'; import type { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; -import type { Statistics, StatisticsData, TimeSeries } from '../types/Statistics'; +import type { Statistics, TimeSeries } from '../types/Statistics'; import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE } from '../utils/CircularArray'; import Configuration from '../utils/Configuration'; import logger from '../utils/Logger'; @@ -34,7 +34,7 @@ export default class PerformanceStatistics { name: this.objName ?? 'Object name not specified', uri: uri.toString(), createdAt: new Date(), - statisticsData: new Map>(), + statisticsData: new Map(), }; } @@ -140,11 +140,11 @@ export default class PerformanceStatistics { private initializePerformanceObserver(): void { this.performanceObserver = new PerformanceObserver((performanceObserverList) => { const lastPerformanceEntry = performanceObserverList.getEntries()[0]; + // logger.debug( + // `${this.logPrefix()} '${lastPerformanceEntry.name}' performance entry: %j`, + // lastPerformanceEntry + // ); this.addPerformanceEntryToStatistics(lastPerformanceEntry); - logger.debug( - `${this.logPrefix()} '${lastPerformanceEntry.name}' performance entry: %j`, - lastPerformanceEntry - ); }); this.performanceObserver.observe({ entryTypes: ['measure'] }); } @@ -162,16 +162,13 @@ export default class PerformanceStatistics { this.logStatistics(); }, Configuration.getLogStatisticsInterval() * 1000); logger.info( - this.logPrefix() + - ' logged every ' + - Utils.formatDurationSeconds(Configuration.getLogStatisticsInterval()) + `${this.logPrefix()} logged every ${Utils.formatDurationSeconds( + Configuration.getLogStatisticsInterval() + )}` ); } else { logger.info( - this.logPrefix() + - ' log interval is set to ' + - Configuration.getLogStatisticsInterval().toString() + - '. Not logging statistics' + `${this.logPrefix()} log interval is set to ${Configuration.getLogStatisticsInterval().toString()}. Not logging statistics` ); } }