Convert all remaining files to typescript.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import options from "options";
|
||||
import { GPU_Stat } from "lib/types/gpustat";
|
||||
|
||||
const { terminal } = options;
|
||||
|
||||
const Stats = () => {
|
||||
const divide = ([total, free]) => free / total;
|
||||
|
||||
const formatSizeInGB = (sizeInKB) =>
|
||||
const formatSizeInGB = (sizeInKB: number) =>
|
||||
Number((sizeInKB / 1024 ** 2).toFixed(2));
|
||||
|
||||
const cpu = Variable(0, {
|
||||
@@ -73,8 +74,10 @@ const Stats = () => {
|
||||
|
||||
const totalGpu = 100;
|
||||
const usedGpu =
|
||||
data.gpus.reduce((acc, gpu) => acc + gpu["utilization.gpu"], 0) /
|
||||
data.gpus.length;
|
||||
data.gpus.reduce((acc: number, gpu: GPU_Stat) => {
|
||||
|
||||
return acc + gpu["utilization.gpu"]
|
||||
}, 0) / data.gpus.length;
|
||||
|
||||
return divide([totalGpu, usedGpu]);
|
||||
} catch (e) {
|
||||
Reference in New Issue
Block a user