@@ -73,15 +73,28 @@ declare function fileWrite(pid: number): number;
7373 */
7474declare interface NvidiaGPUUtilization {
7575 /**
76- * The utilization of the device's Steaming Multiprocessors (SMs)
76+ * The proportion of the time that ANY kernel is being run
77+ */
78+ gpu : number ;
79+ /**
80+ * The proportion of the *time* that memory is being read/written.
7781 *
78- * This includes most 3D and compute operations .
82+ * This is NOT the amount of memory currently USED .
7983 */
80- smUtilization : number
84+ memoryRW : number ;
85+ }
86+
87+ declare interface NvidiaGPUMemory {
88+ /** In bytes */
89+ free : number ;
90+ /** In bytes */
91+ total : number ;
92+ /** In bytes */
93+ used : number ;
8194}
8295
8396/**
84- * A handle for getting process data from a single Nvidia GPU (internally uses [NVML](https://docs.nvidia.com/deploy/nvml-api/nvml-api-reference.html))
97+ * A handle for getting TOTAL data from a single Nvidia GPU (internally uses [NVML](https://docs.nvidia.com/deploy/nvml-api/nvml-api-reference.html))
8598 */
8699declare class NvidiaGPU {
87100 /**
@@ -95,16 +108,25 @@ declare class NvidiaGPU {
95108
96109 /**
97110 * @param deviceIdx The index of the GPU to get a handle for.
98- * @param pid The process id to search for.
99111 *
100112 * @throws An error if `deviceIdx` is invalid or if we do not have permission to access it.
101113 * @throws
102114 */
103- constructor ( deviceIdx : number , pid : number ) ;
115+ constructor ( deviceIdx : number ) ;
116+
117+ /**
118+ * Returns the device name.
119+ */
120+ name ( ) : string ;
104121
105122 /**
106- * Returns the process's compute utilization since the last query
123+ * Returns the GPU's total compute utilization since the last query
107124 * (or if the last query was a long time ago/never, since the start of the stored buffer).
108125 */
109126 utilization ( ) : NvidiaGPUUtilization ;
127+
128+ /**
129+ * Returns data about the total memory utilization on this GPU.
130+ */
131+ memory ( ) : NvidiaGPUMemory ;
110132}
0 commit comments