ENH update graphics for optimus-manager
This commit is contained in:
parent
fa0ad15c70
commit
45a3903144
|
@ -8,7 +8,6 @@ local LabelPlot = require 'LabelPlot'
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
|
|
||||||
local __tonumber = tonumber
|
local __tonumber = tonumber
|
||||||
local __string_find = string.find
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
|
|
||||||
local _MODULE_Y_ = 145
|
local _MODULE_Y_ = 145
|
||||||
|
@ -178,7 +177,7 @@ glob will be of the form:
|
||||||
<gpu_freq>,<mem_freq>
|
<gpu_freq>,<mem_freq>
|
||||||
graphics=<gpu_util>, memory=<mem_util>, video=<vid_util>, PCIe=<pci_util>
|
graphics=<gpu_util>, memory=<mem_util>, video=<vid_util>, PCIe=<pci_util>
|
||||||
--]]
|
--]]
|
||||||
local NV_QUERY = 'optirun nvidia-settings -c :8 -t'..
|
local NV_QUERY = 'nvidia-settings -t'..
|
||||||
' -q UsedDedicatedGPUMemory'..
|
' -q UsedDedicatedGPUMemory'..
|
||||||
' -q TotalDedicatedGPUMemory'..
|
' -q TotalDedicatedGPUMemory'..
|
||||||
' -q ThermalSensorReading'..
|
' -q ThermalSensorReading'..
|
||||||
|
@ -208,22 +207,16 @@ local nvidia_off = function(cr)
|
||||||
LabelPlot.update(vid_util.plot, 0)
|
LabelPlot.update(vid_util.plot, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
local update = function(cr)
|
local gpu_bus_ctrl = '/sys/bus/pci/devices/0000:01:00.0/power/control'
|
||||||
-- check if bbswitch is on
|
|
||||||
if Util.read_file('/proc/acpi/bbswitch', '.+%s+(%u+)') == 'ON' then
|
|
||||||
|
|
||||||
-- bbswitch might be on, but only because conky is constantly querying
|
local update = function(cr)
|
||||||
-- it and there appears to be some lag between closing all optirun
|
if Util.read_file(gpu_bus_ctrl, nil, '*l') == 'on' then
|
||||||
-- processes and flipping bbswitch off. If bbswitch is on and there are
|
local nvidia_settings_glob = Util.execute_cmd(NV_QUERY)
|
||||||
-- no optirun processes, we call this "Mixed." In this case we don't
|
if nvidia_settings_glob == '' then
|
||||||
-- check anything (to allow bbswitch to actually switch off) and set all
|
Text.set(status.value, cr, 'Error')
|
||||||
-- values to N/A and 0.
|
|
||||||
if not __string_find(Util.execute_cmd('ps -A -o comm'), 'optirun') then
|
|
||||||
Text.set(status.value, cr, 'Mixed')
|
|
||||||
nvidia_off(cr)
|
nvidia_off(cr)
|
||||||
else
|
else
|
||||||
Text.set(status.value, cr, 'On')
|
Text.set(status.value, cr, 'On')
|
||||||
local nvidia_settings_glob = Util.execute_cmd(NV_QUERY)
|
|
||||||
|
|
||||||
local used_memory, total_memory, temp_reading, gpu_frequency,
|
local used_memory, total_memory, temp_reading, gpu_frequency,
|
||||||
memory_frequency, gpu_utilization, vid_utilization
|
memory_frequency, gpu_utilization, vid_utilization
|
||||||
|
|
Loading…
Reference in New Issue