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) private void Process_Exited(object? sender, EventArgs e)
{ {
finished = true; Finished = true;
finish = DateTime.Now; Finish = DateTime.Now;
} }
[Export] [Export]

View File

@ -40,7 +40,7 @@ namespace AZ.Compute.Agent
[Export] float networkSpeed; [Export] float networkSpeed;
[Export] Job[] jobs=new Job[0]; [Export] Job[] jobs = new Job[0];
[Export] [Export]
@ -73,7 +73,7 @@ namespace AZ.Compute.Agent
totalNetworkBytes = (ulong)nic.GetIPv4Statistics().BytesReceived + (ulong)nic.GetIPv4Statistics().BytesSent; 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'")) using (ManagementObject Mo = new ManagementObject("Win32_Processor.DeviceID='CPU0'"))
@ -114,7 +114,8 @@ namespace AZ.Compute.Agent
foreach (Job job in jobs) 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) catch (Exception ex)

View File

@ -86,6 +86,7 @@
<th>Name</th> <th>Name</th>
<th>Start</th> <th>Start</th>
<th>Finished</th> <th>Finished</th>
<th>Time</th>
<!-- <th>Command</th> <!-- <th>Command</th>
<th>Start</th> <th>Start</th>
<th>CPU</th> <th>CPU</th>
@ -96,7 +97,8 @@
<tr repeat> <tr repeat>
<td>${d.Name}</td> <td>${d.Name}</td>
<td>${d.Start.toLocaleTimeString()}</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> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -50,4 +50,13 @@ async function addAgent() {
const FORMAT_CONNECTION_STATUS = (x) => ["Offline", "Connecting...", "Online"][x]; 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;
}