This commit is contained in:
1 parent
fe3797fd18
commit
290b9db8ce
6 files changed
+98
-4
No files matched your search
@@ -3,6 +3,7 @@ const { execFile } = require('node:child_process');
|
||||
const { promisify } = require('node:util');
|
||||
const { performance } = require('node:perf_hooks');
|
||||
const { runtimePerformance } = require('./performance-monitor');
|
||||
const { readWindowsCountersOffThread } = require('./system-metrics-reader');
|
||||
|
||||
const WINDOWS_PROBE = "$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; $d=@(Get-CimInstance Win32_PerfRawData_PerfDisk_PhysicalDisk | ForEach-Object { @{ Name=$_.Name; Timestamp_PerfTime=[string]$_.Timestamp_PerfTime; Frequency_PerfTime=[string]$_.Frequency_PerfTime; Timestamp_Sys100NS=[string]$_.Timestamp_Sys100NS; PercentIdleTime=[string]$_.PercentIdleTime; DiskReadBytesPersec=[string]$_.DiskReadBytesPersec; DiskWriteBytesPersec=[string]$_.DiskWriteBytesPersec; DiskReadsPersec=[string]$_.DiskReadsPersec; DiskWritesPersec=[string]$_.DiskWritesPersec; CurrentDiskQueueLength=[string]$_.CurrentDiskQueueLength } }); $v=@(Get-CimInstance Win32_LogicalDisk -Filter 'DriveType=3' | ForEach-Object { @{ DeviceID=$_.DeviceID; Size=[string]$_.Size; FreeSpace=[string]$_.FreeSpace } }); @{disks=$d;volumes=$v} | ConvertTo-Json -Depth 4 -Compress";
|
||||
|
||||
@@ -61,7 +62,7 @@ class SystemMetrics {
|
||||
this.processCpu = options.processCpu || process.cpuUsage;
|
||||
this.processMemory = options.processMemory || process.memoryUsage;
|
||||
this.shouldCollect = options.shouldCollect || (() => true);
|
||||
this.readDisks = options.readDisks || (process.platform === 'win32' ? readWindowsCounters : null);
|
||||
this.readDisks = options.readDisks || (process.platform === 'win32' ? readWindowsCountersOffThread : null);
|
||||
this.limit = Math.max(1, Math.min(60, options.limit || 60));
|
||||
this.samples = [];
|
||||
this.previous = null;
|
||||
|
||||
Reference in new issue
Block a user