temperature is added
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
@author: Crystian
|
||||
@title: Crystools
|
||||
@nickname: Crystools
|
||||
@version: 1.11.0
|
||||
@version: 1.12.0
|
||||
@project: "https://github.com/crystian/ComfyUI-Crystools",
|
||||
@description: Plugins for multiples uses, mainly for debugging, you need them! IG: https://www.instagram.com/crystian.ia
|
||||
"""
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
version = "1.11.0"
|
||||
version = "1.12.0"
|
||||
|
||||
+20
-1
@@ -17,9 +17,11 @@ class CGPUInfo:
|
||||
cudaDevicesFound = 0
|
||||
switchGPU = True
|
||||
switchVRAM = True
|
||||
switchTemperature = True
|
||||
gpus = []
|
||||
gpusUtilization = []
|
||||
gpusVRAM = []
|
||||
gpusTemperature = []
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
@@ -52,6 +54,7 @@ class CGPUInfo:
|
||||
# same index as gpus, with default values
|
||||
self.gpusUtilization.append(True)
|
||||
self.gpusVRAM.append(True)
|
||||
self.gpusTemperature.append(True)
|
||||
|
||||
self.cuda = True
|
||||
logger.info(f'NVIDIA Driver: {pynvml.nvmlSystemGetDriverVersion()}')
|
||||
@@ -76,6 +79,7 @@ class CGPUInfo:
|
||||
def getStatus(self):
|
||||
# logger.debug('CGPUInfo getStatus')
|
||||
gpuUtilization = -1
|
||||
gpuTemperature = -1
|
||||
vramUsed = -1
|
||||
vramTotal = -1
|
||||
vramPercent = -1
|
||||
@@ -87,6 +91,7 @@ class CGPUInfo:
|
||||
gpuType = 'cpu'
|
||||
gpus.append({
|
||||
'gpu_utilization': 0,
|
||||
'gpu_temperature': 0,
|
||||
'vram_total': 0,
|
||||
'vram_used': 0,
|
||||
'vram_used_percent': 0,
|
||||
@@ -102,9 +107,14 @@ class CGPUInfo:
|
||||
for deviceIndex in range(self.cudaDevicesFound):
|
||||
deviceHandle = pynvml.nvmlDeviceGetHandleByIndex(deviceIndex)
|
||||
|
||||
gpuUtilization = 0
|
||||
vramPercent = 0
|
||||
vramUsed = 0
|
||||
vramTotal = 0
|
||||
gpuTemperature = 0
|
||||
|
||||
# GPU Utilization
|
||||
if self.switchGPU and self.gpusUtilization[deviceIndex]:
|
||||
gpuUtilization = 0
|
||||
try:
|
||||
utilization = pynvml.nvmlDeviceGetUtilizationRates(deviceHandle)
|
||||
gpuUtilization = utilization.gpu
|
||||
@@ -130,8 +140,17 @@ class CGPUInfo:
|
||||
|
||||
vramPercent = vramUsed / vramTotal * 100
|
||||
|
||||
# Temperature
|
||||
if self.switchTemperature and self.gpusTemperature[deviceIndex]:
|
||||
try:
|
||||
gpuTemperature = pynvml.nvmlDeviceGetTemperature(deviceHandle, 0)
|
||||
except Exception as e:
|
||||
logger.error('Could not get GPU temperature. Turning off this feature. ' + str(e))
|
||||
self.switchTemperature = False
|
||||
|
||||
gpus.append({
|
||||
'gpu_utilization': gpuUtilization,
|
||||
'gpu_temperature': gpuTemperature,
|
||||
'vram_total': vramTotal,
|
||||
'vram_used': vramUsed,
|
||||
'vram_used_percent': vramPercent,
|
||||
|
||||
@@ -113,6 +113,12 @@ async def getGPUs(request):
|
||||
|
||||
cmonitor.hardwareInfo.GPUInfo.gpusVRAM[int(index)] = settings['vram']
|
||||
|
||||
if 'temperature' in settings is not None:
|
||||
if type(settings['temperature']) is not bool:
|
||||
raise Exception('temperature must be an boolean.')
|
||||
|
||||
cmonitor.hardwareInfo.GPUInfo.gpusTemperature[int(index)] = settings['temperature']
|
||||
|
||||
return web.Response(status=200)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
+73
-10
@@ -63,6 +63,12 @@ class CrystoolsMonitor {
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
Object.defineProperty(this, "monitorTemperatureSettings", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
Object.defineProperty(this, "monitorCPUElement", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
@@ -72,6 +78,7 @@ class CrystoolsMonitor {
|
||||
name: this.menuPrefix + ' [monitor] CPU Usage',
|
||||
type: 'boolean',
|
||||
label: 'CPU',
|
||||
symbol: '%',
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
htmlMonitorSliderRef: undefined,
|
||||
@@ -94,6 +101,7 @@ class CrystoolsMonitor {
|
||||
name: this.menuPrefix + ' [monitor] RAM Used',
|
||||
type: 'boolean',
|
||||
label: 'RAM',
|
||||
symbol: '%',
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
htmlMonitorSliderRef: undefined,
|
||||
@@ -116,6 +124,7 @@ class CrystoolsMonitor {
|
||||
name: this.menuPrefix + ' [monitor] HDD Used',
|
||||
type: 'boolean',
|
||||
label: 'HDD',
|
||||
symbol: '%',
|
||||
tooltip: 'See Partition to show (HDD)',
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
@@ -177,6 +186,7 @@ class CrystoolsMonitor {
|
||||
gpus: [
|
||||
{
|
||||
gpu_utilization: 0,
|
||||
gpu_temperature: 0,
|
||||
vram_total: 0,
|
||||
vram_used: 0,
|
||||
vram_used_percent: 0,
|
||||
@@ -224,15 +234,18 @@ class CrystoolsMonitor {
|
||||
}
|
||||
let label = 'GPU';
|
||||
let labelVRAM = 'VRAM';
|
||||
let labelTemperature = 'Temp';
|
||||
if (moreThanOneGPU) {
|
||||
label = 'GPU ' + index;
|
||||
labelVRAM = 'VRAM' + index;
|
||||
labelTemperature = 'Temp ' + index;
|
||||
}
|
||||
const monitorGPUNElement = {
|
||||
id: 'Crystools.switchGPU' + index,
|
||||
name: this.menuPrefix + `[menu] Display GPU monitor\r\n[${index}] ${name}`,
|
||||
name: this.menuPrefix + `[menu] Display GPU\r\n[${index}] ${name}`,
|
||||
type: 'boolean',
|
||||
label,
|
||||
symbol: '%',
|
||||
title: `${index}: ${name}`,
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
@@ -248,9 +261,10 @@ class CrystoolsMonitor {
|
||||
};
|
||||
const monitorVRAMNElement = {
|
||||
id: 'Crystools.switchVRAM' + index,
|
||||
name: this.menuPrefix + `[menu] Display GPU VRAM monitor\r\n[${index}] ${name}`,
|
||||
name: this.menuPrefix + `[menu] Display GPU VRAM\r\n[${index}] ${name}`,
|
||||
type: 'boolean',
|
||||
label: labelVRAM,
|
||||
symbol: '%',
|
||||
title: `${index}: ${name}`,
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
@@ -264,10 +278,32 @@ class CrystoolsMonitor {
|
||||
});
|
||||
},
|
||||
};
|
||||
const monitorTemperatureNElement = {
|
||||
id: 'Crystools.switchTemperature' + index,
|
||||
name: this.menuPrefix + `[menu] Display GPU Temperature\r\n[${index}] ${name}`,
|
||||
type: 'boolean',
|
||||
label: labelTemperature,
|
||||
symbol: '°',
|
||||
title: `${index}: ${name}`,
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
htmlMonitorSliderRef: undefined,
|
||||
htmlMonitorLabelRef: undefined,
|
||||
cssColor: '#00ff00',
|
||||
cssColorFinal: '#ff0000',
|
||||
onChange: async (value) => {
|
||||
this.updateWidget(monitorTemperatureNElement);
|
||||
void await this.updateServerGPU(index, {
|
||||
temperature: value
|
||||
});
|
||||
},
|
||||
};
|
||||
this.monitorGPUSettings[index] = monitorGPUNElement;
|
||||
this.monitorVRAMSettings[index] = monitorVRAMNElement;
|
||||
this.monitorTemperatureSettings[index] = monitorTemperatureNElement;
|
||||
app.ui.settings.addSetting(this.monitorGPUSettings[index]);
|
||||
app.ui.settings.addSetting(this.monitorVRAMSettings[index]);
|
||||
app.ui.settings.addSetting(this.monitorTemperatureSettings[index]);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -349,6 +385,9 @@ class CrystoolsMonitor {
|
||||
this.monitorVRAMSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updateWidget(monitorSettings);
|
||||
});
|
||||
this.monitorTemperatureSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updateWidget(monitorSettings);
|
||||
});
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, "updateWidget", {
|
||||
@@ -396,6 +435,21 @@ class CrystoolsMonitor {
|
||||
else {
|
||||
}
|
||||
});
|
||||
this.monitorTemperatureSettings.forEach((monitorSettings, index) => {
|
||||
if (data.gpus[index]) {
|
||||
const gpu = data.gpus[index];
|
||||
if (gpu === undefined) {
|
||||
return;
|
||||
}
|
||||
this.updateMonitor(monitorSettings, gpu.gpu_temperature);
|
||||
if (monitorSettings.cssColorFinal && monitorSettings.htmlMonitorSliderRef) {
|
||||
monitorSettings.htmlMonitorSliderRef.style.backgroundColor =
|
||||
`color-mix(in srgb, ${monitorSettings.cssColorFinal} ${gpu.gpu_temperature}%, ${monitorSettings.cssColor})`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, "updateMonitor", {
|
||||
@@ -406,8 +460,8 @@ class CrystoolsMonitor {
|
||||
if (!(monitorSettings.htmlMonitorSliderRef && monitorSettings.htmlMonitorLabelRef)) {
|
||||
return;
|
||||
}
|
||||
monitorSettings.htmlMonitorLabelRef.innerHTML = `${Math.floor(percent)}%`;
|
||||
monitorSettings.htmlMonitorSliderRef.style.width = monitorSettings.htmlMonitorLabelRef.innerHTML;
|
||||
monitorSettings.htmlMonitorLabelRef.innerHTML = `${Math.floor(percent)}${monitorSettings.symbol}`;
|
||||
monitorSettings.htmlMonitorSliderRef.style.width = `${Math.floor(percent)}%`;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, "updateAllAnimationDuration", {
|
||||
@@ -424,6 +478,9 @@ class CrystoolsMonitor {
|
||||
this.monitorVRAMSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updatedAnimationDuration(monitorSettings, value);
|
||||
});
|
||||
this.monitorTemperatureSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updatedAnimationDuration(monitorSettings, value);
|
||||
});
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, "updatedAnimationDuration", {
|
||||
@@ -473,7 +530,13 @@ class CrystoolsMonitor {
|
||||
htmlMonitorSlider.style.position = 'absolute';
|
||||
htmlMonitorSlider.style.height = '100%';
|
||||
htmlMonitorSlider.style.width = '0';
|
||||
htmlMonitorSlider.style.backgroundColor = monitorSettings.cssColor;
|
||||
if (monitorSettings.cssColorFinal) {
|
||||
htmlMonitorSlider.style.backgroundColor =
|
||||
`color-mix(in srgb, ${monitorSettings.cssColorFinal} 0%, ${monitorSettings.cssColor})`;
|
||||
}
|
||||
else {
|
||||
htmlMonitorSlider.style.backgroundColor = monitorSettings.cssColor;
|
||||
}
|
||||
monitorSettings.htmlMonitorSliderRef = htmlMonitorSlider;
|
||||
htmlMonitorContent.append(htmlMonitorSlider);
|
||||
const htmlMonitorLabel = document.createElement('div');
|
||||
@@ -522,11 +585,11 @@ class CrystoolsMonitor {
|
||||
ctoolsRoot.append(htmlContainer);
|
||||
htmlContainer.append(this.createMonitor(this.monitorCPUElement));
|
||||
htmlContainer.append(this.createMonitor(this.monitorRAMElement));
|
||||
this.monitorGPUSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && htmlContainer.append(this.createMonitor(monitorSettings));
|
||||
});
|
||||
this.monitorVRAMSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && htmlContainer.append(this.createMonitor(monitorSettings));
|
||||
this.monitorGPUSettings.forEach((_monitorSettings, index) => {
|
||||
this.monitorGPUSettings[index] && htmlContainer.append(this.createMonitor(this.monitorGPUSettings[index]));
|
||||
this.monitorVRAMSettings[index] && htmlContainer.append(this.createMonitor(this.monitorVRAMSettings[index]));
|
||||
this.monitorTemperatureSettings[index] &&
|
||||
htmlContainer.append(this.createMonitor(this.monitorTemperatureSettings[index]));
|
||||
});
|
||||
htmlContainer.append(this.createMonitor(this.monitorHDDElement));
|
||||
const currentRate = parseFloat(app.ui.settings.getSettingValue(this.idInputRate, this.defaultRate));
|
||||
|
||||
+83
-16
@@ -14,6 +14,7 @@ class CrystoolsMonitor {
|
||||
defaultWhichHDD = '/';
|
||||
monitorGPUSettings: TMonitorSettings[] = [];
|
||||
monitorVRAMSettings: TMonitorSettings[] = [];
|
||||
monitorTemperatureSettings: TMonitorSettings[] = [];
|
||||
|
||||
// CPU Variables
|
||||
monitorCPUElement: TMonitorSettings = {
|
||||
@@ -21,6 +22,7 @@ class CrystoolsMonitor {
|
||||
name: this.menuPrefix + ' [monitor] CPU Usage',
|
||||
type: 'boolean',
|
||||
label: 'CPU',
|
||||
symbol: '%',
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
htmlMonitorSliderRef: undefined,
|
||||
@@ -40,6 +42,7 @@ class CrystoolsMonitor {
|
||||
name: this.menuPrefix + ' [monitor] RAM Used',
|
||||
type: 'boolean',
|
||||
label: 'RAM',
|
||||
symbol: '%',
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
htmlMonitorSliderRef: undefined,
|
||||
@@ -59,6 +62,7 @@ class CrystoolsMonitor {
|
||||
name: this.menuPrefix + ' [monitor] HDD Used',
|
||||
type: 'boolean',
|
||||
label: 'HDD',
|
||||
symbol: '%',
|
||||
tooltip: 'See Partition to show (HDD)',
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
@@ -122,6 +126,7 @@ class CrystoolsMonitor {
|
||||
gpus: [
|
||||
{
|
||||
gpu_utilization: 0,
|
||||
gpu_temperature: 0,
|
||||
vram_total: 0,
|
||||
vram_used: 0,
|
||||
vram_used_percent: 0,
|
||||
@@ -179,17 +184,20 @@ class CrystoolsMonitor {
|
||||
|
||||
let label = 'GPU';
|
||||
let labelVRAM = 'VRAM';
|
||||
let labelTemperature = 'Temp';
|
||||
if (moreThanOneGPU) {
|
||||
label = 'GPU '+index;
|
||||
labelVRAM = 'VRAM'+index;
|
||||
labelTemperature = 'Temp '+index;
|
||||
}
|
||||
|
||||
// GPU Utilization Variables
|
||||
const monitorGPUNElement: TMonitorSettings = {
|
||||
id: 'Crystools.switchGPU' + index,
|
||||
name: this.menuPrefix + `[menu] Display GPU monitor\r\n[${index}] ${name}`,
|
||||
name: this.menuPrefix + `[menu] Display GPU\r\n[${index}] ${name}`,
|
||||
type: 'boolean',
|
||||
label,
|
||||
symbol: '%',
|
||||
title: `${index}: ${name}`,
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
@@ -207,9 +215,10 @@ class CrystoolsMonitor {
|
||||
// GPU VRAM Variables
|
||||
const monitorVRAMNElement: TMonitorSettings = {
|
||||
id: 'Crystools.switchVRAM' + index,
|
||||
name: this.menuPrefix + `[menu] Display GPU VRAM monitor\r\n[${index}] ${name}`,
|
||||
name: this.menuPrefix + `[menu] Display GPU VRAM\r\n[${index}] ${name}`,
|
||||
type: 'boolean',
|
||||
label: labelVRAM,
|
||||
symbol: '%',
|
||||
title: `${index}: ${name}`,
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
@@ -224,12 +233,37 @@ class CrystoolsMonitor {
|
||||
},
|
||||
};
|
||||
|
||||
// GPU Temperature Variables
|
||||
const monitorTemperatureNElement: TMonitorSettings = {
|
||||
id: 'Crystools.switchTemperature' + index,
|
||||
name: this.menuPrefix + `[menu] Display GPU Temperature\r\n[${index}] ${name}`,
|
||||
type: 'boolean',
|
||||
label: labelTemperature,
|
||||
symbol: '°',
|
||||
title: `${index}: ${name}`,
|
||||
defaultValue: true,
|
||||
htmlMonitorRef: undefined,
|
||||
htmlMonitorSliderRef: undefined,
|
||||
htmlMonitorLabelRef: undefined,
|
||||
cssColor: '#00ff00',
|
||||
cssColorFinal: '#ff0000',
|
||||
onChange: async(value: boolean) => {
|
||||
this.updateWidget(monitorTemperatureNElement);
|
||||
void await this.updateServerGPU(index,{
|
||||
temperature: value
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
this.monitorGPUSettings[index] = monitorGPUNElement;
|
||||
this.monitorVRAMSettings[index] = monitorVRAMNElement;
|
||||
this.monitorTemperatureSettings[index] = monitorTemperatureNElement;
|
||||
// @ts-ignore
|
||||
app.ui.settings.addSetting(this.monitorGPUSettings[index]);
|
||||
// @ts-ignore
|
||||
app.ui.settings.addSetting(this.monitorVRAMSettings[index]);
|
||||
// @ts-ignore
|
||||
app.ui.settings.addSetting(this.monitorTemperatureSettings[index]);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -289,6 +323,9 @@ class CrystoolsMonitor {
|
||||
this.monitorVRAMSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updateWidget(monitorSettings);
|
||||
});
|
||||
this.monitorTemperatureSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updateWidget(monitorSettings);
|
||||
});
|
||||
};
|
||||
|
||||
updateWidget = (monitorSettings: TMonitorSettings): void => {
|
||||
@@ -310,7 +347,6 @@ class CrystoolsMonitor {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.monitorGPUSettings.forEach((monitorSettings, index) => {
|
||||
if (data.gpus[index]) {
|
||||
const gpu = data.gpus[index];
|
||||
@@ -338,6 +374,24 @@ class CrystoolsMonitor {
|
||||
// console.error('UpdateAllMonitors: no GPU VRAM data for index', index);
|
||||
}
|
||||
});
|
||||
|
||||
this.monitorTemperatureSettings.forEach((monitorSettings, index) => {
|
||||
if (data.gpus[index]) {
|
||||
const gpu = data.gpus[index];
|
||||
if (gpu === undefined) {
|
||||
// console.error('UpdateAllMonitors: no GPU VRAM data for index', index);
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateMonitor(monitorSettings, gpu.gpu_temperature);
|
||||
if(monitorSettings.cssColorFinal && monitorSettings.htmlMonitorSliderRef){
|
||||
monitorSettings.htmlMonitorSliderRef.style.backgroundColor =
|
||||
`color-mix(in srgb, ${monitorSettings.cssColorFinal} ${gpu.gpu_temperature}%, ${monitorSettings.cssColor})`;
|
||||
}
|
||||
} else {
|
||||
// console.error('UpdateAllMonitors: no GPU VRAM data for index', index);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
updateMonitor = (monitorSettings: TMonitorSettings, percent: number): void => {
|
||||
@@ -345,8 +399,8 @@ class CrystoolsMonitor {
|
||||
return;
|
||||
}
|
||||
|
||||
monitorSettings.htmlMonitorLabelRef.innerHTML = `${Math.floor(percent)}%`;
|
||||
monitorSettings.htmlMonitorSliderRef.style.width = monitorSettings.htmlMonitorLabelRef.innerHTML;
|
||||
monitorSettings.htmlMonitorLabelRef.innerHTML = `${Math.floor(percent)}${monitorSettings.symbol}`;
|
||||
monitorSettings.htmlMonitorSliderRef.style.width = `${Math.floor(percent)}%`;
|
||||
};
|
||||
|
||||
updateAllAnimationDuration = (value: number): void => {
|
||||
@@ -359,6 +413,9 @@ class CrystoolsMonitor {
|
||||
this.monitorVRAMSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updatedAnimationDuration(monitorSettings, value);
|
||||
});
|
||||
this.monitorTemperatureSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && this.updatedAnimationDuration(monitorSettings, value);
|
||||
});
|
||||
};
|
||||
|
||||
updatedAnimationDuration = (monitorSettings: TMonitorSettings, value: number): void => {
|
||||
@@ -395,18 +452,23 @@ class CrystoolsMonitor {
|
||||
htmlContainer.append(this.createMonitor(this.monitorRAMElement));
|
||||
|
||||
// gpu0 > gpu1 > vram0 > vram1
|
||||
this.monitorGPUSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && htmlContainer.append(this.createMonitor(monitorSettings));
|
||||
});
|
||||
this.monitorVRAMSettings.forEach((monitorSettings) => {
|
||||
monitorSettings && htmlContainer.append(this.createMonitor(monitorSettings));
|
||||
});
|
||||
// this.monitorGPUSettings.forEach((monitorSettings) => {
|
||||
// monitorSettings && htmlContainer.append(this.createMonitor(monitorSettings));
|
||||
// });
|
||||
// this.monitorVRAMSettings.forEach((monitorSettings) => {
|
||||
// monitorSettings && htmlContainer.append(this.createMonitor(monitorSettings));
|
||||
// });
|
||||
// this.monitorTemperatureSettings.forEach((monitorSettings) => {
|
||||
// monitorSettings && htmlContainer.append(this.createMonitor(monitorSettings));
|
||||
// });
|
||||
|
||||
// gpu0 > vram0 > gpu1 > vram1
|
||||
// this.monitorGPUSettings.forEach((_monitorSettings, index) => {
|
||||
// this.monitorGPUSettings[index] && htmlContainer.append(this.createMonitor(this.monitorGPUSettings[index]));
|
||||
// this.monitorVRAMSettings[index] && htmlContainer.append(this.createMonitor(this.monitorVRAMSettings[index]));
|
||||
// });
|
||||
this.monitorGPUSettings.forEach((_monitorSettings, index) => {
|
||||
this.monitorGPUSettings[index] && htmlContainer.append(this.createMonitor(this.monitorGPUSettings[index]));
|
||||
this.monitorVRAMSettings[index] && htmlContainer.append(this.createMonitor(this.monitorVRAMSettings[index]));
|
||||
this.monitorTemperatureSettings[index] &&
|
||||
htmlContainer.append(this.createMonitor(this.monitorTemperatureSettings[index]));
|
||||
});
|
||||
|
||||
htmlContainer.append(this.createMonitor(this.monitorHDDElement));
|
||||
|
||||
@@ -452,7 +514,12 @@ class CrystoolsMonitor {
|
||||
htmlMonitorSlider.style.position = 'absolute';
|
||||
htmlMonitorSlider.style.height = '100%';
|
||||
htmlMonitorSlider.style.width = '0';
|
||||
htmlMonitorSlider.style.backgroundColor = monitorSettings.cssColor;
|
||||
if(monitorSettings.cssColorFinal){
|
||||
htmlMonitorSlider.style.backgroundColor =
|
||||
`color-mix(in srgb, ${monitorSettings.cssColorFinal} 0%, ${monitorSettings.cssColor})`;
|
||||
} else {
|
||||
htmlMonitorSlider.style.backgroundColor = monitorSettings.cssColor;
|
||||
}
|
||||
monitorSettings.htmlMonitorSliderRef = htmlMonitorSlider;
|
||||
htmlMonitorContent.append(htmlMonitorSlider);
|
||||
|
||||
|
||||
Vendored
+4
@@ -1,5 +1,6 @@
|
||||
type TGpuStatData = {
|
||||
gpu_utilization: number,
|
||||
gpu_temperature: number,
|
||||
vram_total: number,
|
||||
vram_used: number,
|
||||
vram_used_percent: number,
|
||||
@@ -8,6 +9,7 @@ type TGpuStatData = {
|
||||
type TGpuSettings = {
|
||||
utilization?: boolean,
|
||||
vram?: boolean,
|
||||
temperature?: boolean,
|
||||
}
|
||||
|
||||
type TGpuName = {
|
||||
@@ -41,6 +43,7 @@ type TMonitorSettings = {
|
||||
id: string,
|
||||
name: string,
|
||||
label: string, // on monitor
|
||||
symbol: string, // on monitor
|
||||
title?: string, // on monitor
|
||||
tooltip?: string, // on settings
|
||||
type: 'boolean' | 'number' | 'string',
|
||||
@@ -50,4 +53,5 @@ type TMonitorSettings = {
|
||||
htmlMonitorSliderRef?: HTMLDivElement,
|
||||
htmlMonitorLabelRef?: HTMLDivElement,
|
||||
cssColor: string,
|
||||
cssColorFinal?: string,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user