This commit is contained in:
2024-06-28 12:13:42 +03:00
parent 5398af0d3e
commit e6b738de58
4 changed files with 19 additions and 7 deletions

View File

@ -39,8 +39,8 @@ namespace AZ.Compute.Agent
private void Process_Exited(object? sender, EventArgs e)
{
finished = true;
finish = DateTime.Now;
Finished = true;
Finish = DateTime.Now;
}
[Export]

View File

@ -40,7 +40,7 @@ namespace AZ.Compute.Agent
[Export] float networkSpeed;
[Export] Job[] jobs=new Job[0];
[Export] Job[] jobs = new Job[0];
[Export]
@ -73,7 +73,7 @@ namespace AZ.Compute.Agent
totalNetworkBytes = (ulong)nic.GetIPv4Statistics().BytesReceived + (ulong)nic.GetIPv4Statistics().BytesSent;
Ip = nic.GetIPProperties().UnicastAddresses.First(x=> x.Address.AddressFamily == AddressFamily.InterNetwork).Address.ToString();
Ip = nic.GetIPProperties().UnicastAddresses.First(x => x.Address.AddressFamily == AddressFamily.InterNetwork).Address.ToString();
using (ManagementObject Mo = new ManagementObject("Win32_Processor.DeviceID='CPU0'"))
@ -114,7 +114,8 @@ namespace AZ.Compute.Agent
foreach (Job job in jobs)
{
job.Ram = (float)(job.Process.PeakWorkingSet64 / 1048576.0);
if (!job.Finished)
job.Ram = (float)(job.Process.PeakWorkingSet64 / 1048576.0);
}
}
catch (Exception ex)

View File

@ -86,6 +86,7 @@
<th>Name</th>
<th>Start</th>
<th>Finished</th>
<th>Time</th>
<!-- <th>Command</th>
<th>Start</th>
<th>CPU</th>
@ -96,7 +97,8 @@
<tr repeat>
<td>${d.Name}</td>
<td>${d.Start.toLocaleTimeString()}</td>
<td>${d.Finished}</td>
<td>${d.Finishefd ? 'Yes' : 'No'}</td>
<td>${d.Finished ? FORMAT_TIME(d.Finish - d.Start) : FORMAT_TIME(new Date() - d.Start)}</td>
</tr>
</tbody>
</table>

View File

@ -50,4 +50,13 @@ async function addAgent() {
const FORMAT_CONNECTION_STATUS = (x) => ["Offline", "Connecting...", "Online"][x];
const FORMAT_TIME = (x) => {
var hours = Math.floor(x / 3600);
var minutes = Math.floor((x - (hours * 3600)) / 60);
var seconds = x - (hours * 3600) - (minutes * 60);
if (hours < 10) { hours = "0" + hours; }
if (minutes < 10) { minutes = "0" + minutes; }
if (seconds < 10) { seconds = "0" + seconds; }
return hours + ':' + minutes + ':' + seconds;
}