WIP don't query GPU unless we need to
This commit is contained in:
parent
ea6d5e6042
commit
b797e46c04
|
@ -52,8 +52,14 @@ return function(update_freq, config, common, width, point)
|
||||||
vid_utilization = 0
|
vid_utilization = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local runtime_status_file = config.dev_power..'/runtime_status'
|
||||||
|
|
||||||
|
local want_nvidia_query = config.show_temp or config.show_clock
|
||||||
|
or config.gpu_util or config.mem_util or config.vid_util
|
||||||
|
|
||||||
local update_state = function()
|
local update_state = function()
|
||||||
if i_o.read_file(config.dev_power, nil, '*l') == 'on' then
|
local is_active = i_o.read_file(runtime_status_file, nil, '*l') == 'active'
|
||||||
|
if is_active and want_nvidia_query then
|
||||||
local nvidia_settings_glob = i_o.execute_cmd(NV_QUERY)
|
local nvidia_settings_glob = i_o.execute_cmd(NV_QUERY)
|
||||||
if nvidia_settings_glob == nil then
|
if nvidia_settings_glob == nil then
|
||||||
mod_state.error = 'Error'
|
mod_state.error = 'Error'
|
||||||
|
@ -68,6 +74,8 @@ return function(update_freq, config, common, width, point)
|
||||||
= __string_match(nvidia_settings_glob, NV_REGEX)
|
= __string_match(nvidia_settings_glob, NV_REGEX)
|
||||||
mod_state.error = false
|
mod_state.error = false
|
||||||
end
|
end
|
||||||
|
elseif is_active then
|
||||||
|
mod_state.error = false
|
||||||
else
|
else
|
||||||
mod_state.error = 'Off'
|
mod_state.error = 'Off'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue