提交 a155500b 编写于 作者: N nicolargo

GPU temperature not shown in webview #1849

上级 2baf73ff
......@@ -27,7 +27,8 @@ export default function GlancesPluginGpuController($scope, GlancesStats, ARGUMEN
vm.name = "GPU";
vm.mean = {
proc: null,
mem: null
mem: null,
temperature: null
};
var sameName = true;
......@@ -38,6 +39,7 @@ export default function GlancesPluginGpuController($scope, GlancesStats, ARGUMEN
vm.mean.proc += gpu.proc;
vm.mean.mem += gpu.mem;
vm.mean.temperature += gpu.temperature;
vm.gpus.push(gpu);
}
......@@ -50,6 +52,7 @@ export default function GlancesPluginGpuController($scope, GlancesStats, ARGUMEN
vm.mean.proc = vm.mean.proc / stats.length;
vm.mean.mem = vm.mean.mem / stats.length;
vm.mean.temperature = vm.mean.temperature / stats.length;
}
vm.getDecoration = function (gpuId, value) {
......
......@@ -17,6 +17,14 @@
</div>
<div class="table-cell" ng-if="vm.mean.mem == null">N/A</div>
</div>
<div class="table-row" ng-if="arguments.meangpu || vm.gpus.length === 1">
<div class="table-cell text-left">temperature::</div>
<div class="table-cell" ng-class="vm.getMeanDecoration('temperature')" ng-if="vm.mean.temperature != null">{{ vm.mean.temperature | number
:
0 }}%
</div>
<div class="table-cell" ng-if="vm.mean.temperature == null">N/A</div>
</div>
<div class="table-row" ng-if="!arguments.meangpu && vm.gpus.length > 1" ng-repeat="gpu in vm.gpus">
<div class="table-cell text-left">
{{ gpu.gpu_id }}:
......@@ -25,6 +33,9 @@
mem:
<span ng-class="vm.getDecoration(gpu.gpu_id, 'mem')" ng-if="gpu.mem != null">{{ gpu.mem | number : 0 }}%</span>
<span ng-if="gpu.mem == null">N/A</span>
temp:
<span ng-class="vm.getDecoration(gpu.gpu_id, 'temperature')" ng-if="gpu.temperature != null">{{ gpu.temperature | number : 0 }}C</span>
<span ng-if="gpu.temperature == null">N/A</span>
</div>
</div>
</div>
......
......@@ -88,6 +88,38 @@ class Plugin(GlancesPlugin):
stats = self.get_init_value()
if not self.nvml_ready:
# !!!
# Uncomment to test on computer without GPU
# One GPU sample:
# self.stats = [
# {
# "key": "gpu_id",
# "gpu_id": 0,
# "name": "Fake GeForce GTX",
# "mem": 5.792331695556641,
# "proc": 4,
# "temperature": 26
# }
# ]
# Two GPU sample:
# self.stats = [
# {
# "key": "gpu_id",
# "gpu_id": 0,
# "name": "Fake GeForce GTX1",
# "mem": 5.792331695556641,
# "proc": 4,
# "temperature": 26
# },
# {
# "key": "gpu_id",
# "gpu_id": 1,
# "name": "Fake GeForce GTX2",
# "mem": 15,
# "proc": 8,
# "temperature": 65
# }
# ]
return self.stats
if self.input_method == 'local':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册