ENH use locals

This commit is contained in:
Nathan Dwarshuis 2023-09-28 23:27:46 -04:00
parent cc01482477
commit 187a148631
1 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ return function(update_freq, config, common, width, point)
i_o.assert_exe_exists(NVIDIA_EXE)
local mk_query_cmd = function(props)
return string.format(
return __string_format(
'%s --query-gpu=%s --format=csv,noheader,nounits',
NVIDIA_EXE,
pure.collapse(props, ',')
@ -99,13 +99,13 @@ return function(update_freq, config, common, width, point)
mod_state.gpu_utilization,
mod_state.vid_utilization
= __string_match(nvidia_settings_glob, NV_REGEX)
mod_state.gpu_frequency = tonumber(mod_state.gpu_frequency)
mod_state.gpu_frequency = __tonumber(mod_state.gpu_frequency)
mod_state.error = false
end
-- query total memory if we need it (do this here so we don't turn on
-- the gpu every time we start conky)
if mod_state.total_memory == 0 and config.show_mem_util then
mod_state.total_memory = tonumber(i_o.execute_cmd(mk_query_cmd({'memory.total'})))
mod_state.total_memory = __tonumber(i_o.execute_cmd(mk_query_cmd({'memory.total'})))
end
elseif is_active then
mod_state.error = false