Remove configuration files and scripts related to the Resource Monitor Service; implement core service functionality for monitoring system resources including CPU, RAM, GPU, and running processes; add API endpoints for resource usage and process management; integrate NVIDIA Management Library for GPU metrics; establish service as a Windows service with appropriate settings.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public static class NvmlWrapper
|
||||
{
|
||||
[DllImport("nvml.dll", EntryPoint = "nvmlInit_v2")]
|
||||
public static extern int NvmlInit();
|
||||
|
||||
[DllImport("nvml.dll", EntryPoint = "nvmlShutdown")]
|
||||
public static extern int NvmlShutdown();
|
||||
|
||||
// Get device count
|
||||
/* [DllImport("nvml.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int nvmlDeviceGetCount_v2(ref uint deviceCount); */
|
||||
|
||||
/* public static int NvmlDeviceGetCount(ref uint deviceCount)
|
||||
{
|
||||
return nvmlDeviceGetCount_v2(ref deviceCount);
|
||||
} */
|
||||
|
||||
[DllImport("nvml.dll", EntryPoint = "nvmlDeviceGetHandleByIndex_v2")]
|
||||
public static extern int NvmlDeviceGetHandleByIndex(int index, out IntPtr device);
|
||||
|
||||
[DllImport("nvml.dll", EntryPoint = "nvmlDeviceGetUtilizationRates")]
|
||||
public static extern int NvmlDeviceGetUtilizationRates(IntPtr device, out NvmlUtilization utilization);
|
||||
|
||||
[DllImport("nvml.dll", EntryPoint = "nvmlDeviceGetTemperature")]
|
||||
public static extern int NvmlDeviceGetTemperature(IntPtr device, uint sensorType, out uint temp);
|
||||
|
||||
[DllImport("nvml.dll", EntryPoint = "nvmlDeviceGetFanSpeed")]
|
||||
public static extern int NvmlDeviceGetFanSpeed(IntPtr device, out uint speed);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NvmlUtilization
|
||||
{
|
||||
public uint Gpu;
|
||||
public uint Memory;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user