Skip to content

Commit

Permalink
added GPU stats for windows #1
Browse files Browse the repository at this point in the history
  • Loading branch information
hicodersofficial committed May 16, 2022
1 parent b38fdd6 commit 464bef2
Show file tree
Hide file tree
Showing 5 changed files with 3,081 additions and 749 deletions.
37 changes: 37 additions & 0 deletions lib/core/gpuStats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"use strict";

const gpuInfo = require("gpu-info");
const logger = require("../utils/logger");
const platform = require("os").platform();

/**
* Show GPU information
* @async
*/
async function gpuSpecs() {
try {
console.log(platform);
const data = await gpuInfo();
logger.info(`GPU Information (GPU Count ${data.length})`);
for (let i = 0; i < data.length; i++) {
const gpu = data[i];
logger.info(i + 1);
const info = {
Status: gpu.Status,
name: gpu.Name,
"Max Refresh Rate": gpu.MaxRefreshRate,
"Current Refresh Rate": gpu.CurrentRefreshRate,
"GPU Size": (gpu.AdapterRAM / 1024 ** 3).toFixed(2) + " GB",
"Video Processor": gpu.VideoProcessor,
"Driver Version": gpu.DriverVersion,
"Current Resolution": `${gpu.CurrentHorizontalResolution}x${gpu.CurrentVerticalResolution}`,
};
console.table(info);
}
} catch (error) {
logger.info(`GPU Information`);
logger.error(error.message);
}
}

module.exports = gpuSpecs;
2 changes: 2 additions & 0 deletions lib/thisPc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const cupUsages = require("./periodic/cupUsages");
const getMemory = require("./periodic/memory");
const chalk = require("chalk");
const CONFIG = require("./config/config");
const gpuSpecs = require("./core/gpuStats");

/**
* All available commands for app.
Expand Down Expand Up @@ -66,6 +67,7 @@ switch (true) {
userInfo();
specs();
systemInfo();
gpuSpecs();
break;
}

Expand Down
Loading

0 comments on commit 464bef2

Please sign in to comment.