This commit is contained in:
2024-06-28 11:58:02 +03:00
parent da56ec65d3
commit 5c7e78d39f
4 changed files with 19 additions and 2 deletions

View File

@@ -23,6 +23,8 @@ namespace AZ.Compute.Agent
NetworkInterface nic;
ulong totalNetworkBytes;
const double nicSpeed = 10 * 1024 * 1024; // 10 MBps
[Export] string id;
[Export] string ip;
@@ -103,7 +105,9 @@ namespace AZ.Compute.Agent
var ntb = (ulong)nic.GetIPv4Statistics().BytesReceived + (ulong)nic.GetIPv4Statistics().BytesSent;
network = (float)(((ntb - totalNetworkBytes) / 5.0) / nic.Speed);
network = (float)(((ntb - totalNetworkBytes) / 5.0) / nicSpeed);
totalNetworkBytes = ntb;
Cpu = cpuCounter.NextValue();
Ram = ramCounter.NextValue();