FIX a bunch of bugs
This commit is contained in:
parent
ca27602978
commit
0f53cccfa9
|
@ -31,7 +31,8 @@ return function(update_freq, config, common, width, point)
|
||||||
' -q TotalDedicatedGPUmemory'..
|
' -q TotalDedicatedGPUmemory'..
|
||||||
' -q ThermalSensorReading'..
|
' -q ThermalSensorReading'..
|
||||||
' -q [gpu:0]/GPUCurrentClockFreqs'..
|
' -q [gpu:0]/GPUCurrentClockFreqs'..
|
||||||
' -q [gpu:0]/GPUutilization'
|
' -q [gpu:0]/GPUutilization'..
|
||||||
|
' 2>/dev/null'
|
||||||
|
|
||||||
local NV_REGEX = '(%d+)\n'..
|
local NV_REGEX = '(%d+)\n'..
|
||||||
'(%d+)\n'..
|
'(%d+)\n'..
|
||||||
|
@ -44,8 +45,6 @@ return function(update_freq, config, common, width, point)
|
||||||
used_memory = 0,
|
used_memory = 0,
|
||||||
total_memory = 0,
|
total_memory = 0,
|
||||||
temp_reading = 0,
|
temp_reading = 0,
|
||||||
gpu_frequency = 0,
|
|
||||||
memory_frequency = 0,
|
|
||||||
gpu_utilization = 0,
|
gpu_utilization = 0,
|
||||||
vid_utilization = 0
|
vid_utilization = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@ return function(main_state, common, width, point)
|
||||||
{'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'}
|
{'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'}
|
||||||
)
|
)
|
||||||
local update = function()
|
local update = function()
|
||||||
local stats = __string_match(
|
if main_state.pacman_stats then
|
||||||
main_state.pacman_stats,
|
local stats = __string_match(
|
||||||
'%d+%s+[^%s]+%s+[^%s]+%s+(.*)$'
|
main_state.pacman_stats,
|
||||||
)
|
'%d+%s+[^%s]+%s+[^%s]+%s+(.*)$'
|
||||||
if stats then
|
)
|
||||||
local i = 1
|
local i = 1
|
||||||
for v in __string_gmatch(stats, '%d+') do
|
for v in __string_gmatch(stats, '%d+') do
|
||||||
common.text_rows_set(obj, i, v)
|
common.text_rows_set(obj, i, v)
|
||||||
|
|
|
@ -56,15 +56,6 @@ return function(update_freq, config, common, width, point)
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- battery power plot
|
-- battery power plot
|
||||||
|
|
||||||
local _read_battery_power = sys.battery_power_reader(config.battery)
|
|
||||||
|
|
||||||
local read_battery_power = function(is_using_ac)
|
|
||||||
if is_using_ac then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return _read_battery_power()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local format_ac = function(watts)
|
local format_ac = function(watts)
|
||||||
if watts == 0 then
|
if watts == 0 then
|
||||||
|
@ -75,6 +66,15 @@ return function(update_freq, config, common, width, point)
|
||||||
end
|
end
|
||||||
|
|
||||||
local mk_bat = function(y)
|
local mk_bat = function(y)
|
||||||
|
local _read_battery_power = sys.battery_power_reader(config.battery)
|
||||||
|
|
||||||
|
local read_battery_power = function(is_using_ac)
|
||||||
|
if is_using_ac then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return _read_battery_power()
|
||||||
|
end
|
||||||
|
end
|
||||||
local read_bat_status = sys.battery_status_reader(config.battery)
|
local read_bat_status = sys.battery_status_reader(config.battery)
|
||||||
local obj = common.make_tagged_scaled_timeseries(
|
local obj = common.make_tagged_scaled_timeseries(
|
||||||
point.x,
|
point.x,
|
||||||
|
@ -104,12 +104,13 @@ return function(update_freq, config, common, width, point)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- main functions
|
-- main functions
|
||||||
|
|
||||||
return {
|
return {
|
||||||
header = 'POWER',
|
header = 'POWER',
|
||||||
point = point,
|
point = point,
|
||||||
width = width,
|
width = width,
|
||||||
set_state = nil,
|
set_state = nil,
|
||||||
|
-- TODO make sure these interfaces actually exist before trying to read them
|
||||||
top = pure.concat(
|
top = pure.concat(
|
||||||
pure.map(mk_rate_blockspec, config.rapl_specs),
|
pure.map(mk_rate_blockspec, config.rapl_specs),
|
||||||
{{mk_bat, config.battery ~= '', 0}}
|
{{mk_bat, config.battery ~= '', 0}}
|
||||||
|
|
|
@ -18,15 +18,18 @@ return function(main_state, common, width, point)
|
||||||
common.text_rows_set(obj, 1, i_o.conky('$kernel'))
|
common.text_rows_set(obj, 1, i_o.conky('$kernel'))
|
||||||
local update = function()
|
local update = function()
|
||||||
local last_update, last_sync
|
local last_update, last_sync
|
||||||
|
common.text_rows_set(obj, 2, i_o.conky('$uptime'))
|
||||||
if main_state.pacman_stats then
|
if main_state.pacman_stats then
|
||||||
last_update, last_sync = __string_match(
|
last_update, last_sync = __string_match(
|
||||||
main_state.pacman_stats,
|
main_state.pacman_stats,
|
||||||
"^%d+%s+([^%s]+)%s+([^%s]+).*"
|
"^%d+%s+([^%s]+)%s+([^%s]+).*"
|
||||||
)
|
)
|
||||||
|
common.text_rows_set(obj, 3, last_update)
|
||||||
|
common.text_rows_set(obj, 4, last_sync)
|
||||||
|
else
|
||||||
|
common.text_rows_set(obj, 3, 'N/A')
|
||||||
|
common.text_rows_set(obj, 4, 'N/A')
|
||||||
end
|
end
|
||||||
common.text_rows_set(obj, 2, i_o.conky('$uptime'))
|
|
||||||
common.text_rows_set(obj, 3, last_update)
|
|
||||||
common.text_rows_set(obj, 4, last_sync)
|
|
||||||
end
|
end
|
||||||
local static = pure.partial(common.text_rows_draw_static, obj)
|
local static = pure.partial(common.text_rows_draw_static, obj)
|
||||||
local dynamic = pure.partial(common.text_rows_draw_dynamic, obj)
|
local dynamic = pure.partial(common.text_rows_draw_dynamic, obj)
|
||||||
|
|
Loading…
Reference in New Issue