REF actually rename all modules lowercase

This commit is contained in:
Nathan Dwarshuis 2021-07-29 22:39:38 -04:00
parent 4d0e9d03ed
commit bdd7902574
11 changed files with 51 additions and 51 deletions

2
core

@ -1 +1 @@
Subproject commit f04271472373e5ae290108dc27742fef5f32def5
Subproject commit b3c558845da08e92febc612260d710f06c2c7b9a

View File

@ -1,7 +1,7 @@
local M = {}
local F = require 'primitive'
local Util = require 'Util'
local util = require 'util'
local theme = require 'theme'
local dial = require 'dial'
local rect = require 'rect'
@ -139,7 +139,7 @@ local default_plot_config = timeseries.config(
M.percent_label_config = timeseries.label_config(
theme.INACTIVE_TEXT_FG,
label_font_spec,
function(_) return function(z) return Util.round_to_string(z * 100)..'%' end end
function(_) return function(z) return util.round_to_string(z * 100)..'%' end end
)
M.initthemedLabelPlot = function(x, y, w, h, label_config, update_freq)
@ -224,7 +224,7 @@ end
M.converted_y_label_format_generator = function(unit)
return function(plot_max)
local new_prefix, new_max = Util.convert_data_val(plot_max)
local new_prefix, new_max = util.convert_data_val(plot_max)
local conversion_factor = plot_max / new_max
local fmt = M.y_label_format_string(new_max, new_prefix..unit..'/s')
return function(bytes)

View File

@ -1,5 +1,5 @@
local line = require 'line'
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
@ -65,11 +65,11 @@ return function()
local update = function(trigger)
if trigger == 0 then
local smart_pid = Util.execute_cmd('pidof smartd', nil, '*n')
local smart_pid = util.execute_cmd('pidof smartd', nil, '*n')
common.text_row_set(smart, (smart_pid == '') and 'Error' or 'Running')
for i = 1, FS_NUM do
local percent = Util.conky_numeric(CONKY_USED_PERC[i])
local percent = util.conky_numeric(CONKY_USED_PERC[i])
common.compound_bar_set(fs, i, percent * 0.01)
end
end

View File

@ -1,6 +1,6 @@
local text = require 'text'
local line = require 'line'
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
@ -109,19 +109,19 @@ return function(update_freq)
end
local GPU_UTIL_Y = SEP_Y3 + SEPARATOR_SPACING
local gpu_util = build_plot(GPU_UTIL_Y, 'GPU Utilization')
local gpu_util = build_plot(GPU_UTIL_Y, 'GPU utilization')
-----------------------------------------------------------------------------
-- gpu memory consumption plot
local MEM_UTIL_Y = GPU_UTIL_Y + PLOT_HEIGHT + PLOT_SEC_BREAK * 2
local mem_util = build_plot(MEM_UTIL_Y, 'memory Utilization')
local mem_util = build_plot(MEM_UTIL_Y, 'memory utilization')
-----------------------------------------------------------------------------
-- gpu video utilization plot
local VID_UTIL_Y = MEM_UTIL_Y + PLOT_HEIGHT + PLOT_SEC_BREAK * 2
local vid_util = build_plot(VID_UTIL_Y, 'Video Utilization')
local vid_util = build_plot(VID_UTIL_Y, 'Video utilization')
-----------------------------------------------------------------------------
-- update function
@ -139,7 +139,7 @@ return function(update_freq)
' -q TotalDedicatedGPUmemory'..
' -q ThermalSensorReading'..
' -q [gpu:0]/GPUCurrentClockFreqs'..
' -q [gpu:0]/GPUUtilization'
' -q [gpu:0]/GPUutilization'
local NV_REGEX = '(%d+)\n'..
'(%d+)\n'..
@ -159,8 +159,8 @@ return function(update_freq)
end
local update = function()
if Util.read_file(GPU_BUS_CTRL, nil, '*l') == 'on' then
local nvidia_settings_glob = Util.execute_cmd(NV_QUERY)
if util.read_file(GPU_BUS_CTRL, nil, '*l') == 'on' then
local nvidia_settings_glob = util.execute_cmd(NV_QUERY)
if nvidia_settings_glob == '' then
text.set(status.value, 'Error')
nvidia_off()

View File

@ -1,6 +1,6 @@
local timeseries = require 'timeseries'
local texttable = require 'texttable'
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
local func = require 'func'
@ -41,7 +41,7 @@ return function(update_freq)
-- mem consumption dial
local get_meminfo_field = function(field)
return tonumber(Util.read_file('/proc/meminfo', field..':%s+(%d+)'))
return tonumber(util.read_file('/proc/meminfo', field..':%s+(%d+)'))
end
local memtotal = get_meminfo_field('MemTotal')
@ -135,7 +135,7 @@ return function(update_freq)
-- main functions
local update = function()
local conky = Util.conky
local conky = util.conky
-- see manpage for free command for formulas
local memfree,
@ -144,7 +144,7 @@ return function(update_freq)
swapfree,
shmem,
sreclaimable
= __string_match(Util.read_file('/proc/meminfo'), MEMINFO_REGEX)
= __string_match(util.read_file('/proc/meminfo'), MEMINFO_REGEX)
local used_percent =
(memtotal -

View File

@ -1,4 +1,4 @@
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
local func = require 'func'
@ -8,7 +8,7 @@ return function(update_freq)
local PLOT_HEIGHT = 56
local get_interfaces = function()
local s = Util.execute_cmd('realpath /sys/class/net/* | grep -v virtual')
local s = util.execute_cmd('realpath /sys/class/net/* | grep -v virtual')
local interfaces = {}
for iface in string.gmatch(s, '/([^/\n]+)\n') do
interfaces[#interfaces + 1] = iface
@ -27,7 +27,7 @@ return function(update_freq)
)
local get_bits = function(path)
return Util.read_file(path, nil, '*n') * 8
return util.read_file(path, nil, '*n') * 8
end
local read_interfaces = function()
@ -44,8 +44,8 @@ return function(update_freq)
local init_rx_bits, init_tx_bits = read_interfaces()
local value_format_function = function(bits)
local unit, value = Util.convert_data_val(bits)
return Util.precision_round_to_string(value, 3)..' '..unit..'b/s'
local unit, value = util.convert_data_val(bits)
return util.precision_round_to_string(value, 3)..' '..unit..'b/s'
end
local build_plot = function(y, label, init)

View File

@ -1,4 +1,4 @@
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
@ -13,7 +13,7 @@ return function(update_freq)
local BAT_VOLTAGE_PATH = '/sys/class/power_supply/BAT0/voltage_now'
local read_milli = function(path)
return Util.read_file(path, nil, '*n') * 0.000001
return util.read_file(path, nil, '*n') * 0.000001
end
local read_pkg0_joules = function()
@ -46,7 +46,7 @@ return function(update_freq)
end
local format_rapl = function(watts)
return Util.precision_round_to_string(watts, 3)..' W'
return util.precision_round_to_string(watts, 3)..' W'
end
local build_rate_plot = function(y, label, init)

View File

@ -1,10 +1,10 @@
local compounddial = require 'compounddial'
local line = require 'line'
local texttable = require 'texttable'
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
local CPU = require 'CPU'
local cpu = require 'cpu'
local func = require 'func'
local __math_floor = math.floor
@ -34,13 +34,13 @@ return function(update_freq)
-----------------------------------------------------------------------------
-- cores (loads and temps)
local cpu_loads = CPU.init_cpu_loads()
local ncpus = CPU.get_cpu_number()
local ncores = CPU.get_core_number()
local cpu_loads = cpu.init_cpu_loads()
local ncpus = cpu.get_cpu_number()
local ncores = cpu.get_core_number()
local nthreads = ncpus / ncores
local hwp_paths = CPU.get_hwp_paths()
local coretemp_paths = CPU.get_coretemp_paths()
CPU.read_cpu_loads(cpu_loads) -- prime load matrix by side effect
local hwp_paths = cpu.get_hwp_paths()
local coretemp_paths = cpu.get_coretemp_paths()
cpu.read_cpu_loads(cpu_loads) -- prime load matrix by side effect
local cores = {}
@ -128,17 +128,17 @@ return function(update_freq)
geometry.SECTION_WIDTH,
TABLE_HEIGHT,
NUM_ROWS,
{'Name', 'PID', 'CPU (%)'}
{'Name', 'PID', 'cpu (%)'}
)
-----------------------------------------------------------------------------
-- main functions
local update = function(trigger)
local conky = Util.conky
local conky = util.conky
local load_sum = 0
cpu_loads = CPU.read_cpu_loads(cpu_loads)
cpu_loads = cpu.read_cpu_loads(cpu_loads)
for _, load_data in pairs(cpu_loads) do
local cur = load_data.percent_active
load_sum = load_sum + cur
@ -146,7 +146,7 @@ return function(update_freq)
end
for conky_core_id, path in pairs(coretemp_paths) do
local temp = __math_floor(0.001 * Util.read_file(path, nil, '*n'))
local temp = __math_floor(0.001 * util.read_file(path, nil, '*n'))
common.text_ring_set(cores[conky_core_id].coretemp, temp)
end
@ -154,16 +154,16 @@ return function(update_freq)
-- general seems slow), but I also don't need to see an update every cycle,
-- hence the trigger
if trigger == 0 then
common.text_rows_set(cpu_status, 1, CPU.read_hwp(hwp_paths))
common.text_rows_set(cpu_status, 1, cpu.read_hwp(hwp_paths))
end
common.text_rows_set(cpu_status, 2, CPU.read_freq())
common.text_rows_set(cpu_status, 2, cpu.read_freq())
common.percent_plot_set(total_load, load_sum / ncpus * 100)
for r = 1, NUM_ROWS do
local pid = conky(TABLE_CONKY[r].pid, '(%d+)') -- may have leading spaces
if pid ~= '' then
texttable.set(tbl, 1, r, Util.read_file('/proc/'..pid..'/comm', '(%C+)'))
texttable.set(tbl, 1, r, util.read_file('/proc/'..pid..'/comm', '(%C+)'))
texttable.set(tbl, 2, r, pid)
texttable.set(tbl, 3, r, conky(TABLE_CONKY[r].cpu))
end

View File

@ -1,4 +1,4 @@
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
local func = require 'func'
@ -28,7 +28,7 @@ return function(update_freq)
local read_bytes = 0
local write_bytes = 0
for _, path in pairs(DEVICE_PATHS) do
local r, w = __string_match(Util.read_file(path), RW_REGEX)
local r, w = __string_match(util.read_file(path), RW_REGEX)
read_bytes = read_bytes + __tonumber(r)
write_bytes = write_bytes + __tonumber(w)
end
@ -38,8 +38,8 @@ return function(update_freq)
local init_read_bytes, init_write_bytes = read_devices()
local format_value_function = function(bps)
local unit, value = Util.convert_data_val(bps)
return Util.precision_round_to_string(value, 3)..' '..unit..'B/s'
local unit, value = util.convert_data_val(bps)
return util.precision_round_to_string(value, 3)..' '..unit..'B/s'
end
local build_plot = function(y, label, init)

View File

@ -1,4 +1,4 @@
local Util = require 'Util'
local util = require 'util'
local common = require 'common'
local geometry = require 'geometry'
@ -28,8 +28,8 @@ return function()
last_update, last_sync = __string_match(pacman_stats, "^%d+%s+([^%s]+)%s+([^%s]+).*")
end
-- TODO this doesn't need to be update every time
common.text_rows_set(rows, 1, Util.conky('$kernel'))
common.text_rows_set(rows, 2, Util.conky('$uptime'))
common.text_rows_set(rows, 1, util.conky('$kernel'))
common.text_rows_set(rows, 2, util.conky('$uptime'))
common.text_rows_set(rows, 3, last_update)
common.text_rows_set(rows, 4, last_sync)
end

View File

@ -16,7 +16,7 @@ package.path = ABS_PATH..'?.lua;'..
ABS_PATH..'core/widget/rect/?.lua;'..
ABS_PATH..'core/widget/poly/?.lua;'
local Util = require 'Util'
local util = require 'util'
local system = require 'system'
local network = require 'network'
local processor = require 'processor'
@ -31,7 +31,7 @@ local static = require 'static'
local using_ac = function()
-- for some reason it is much more efficient to test if the battery
-- is off than if the ac is on
return Util.read_file('/sys/class/power_supply/BAT0/status', nil, '*l') ~= 'Discharging'
return util.read_file('/sys/class/power_supply/BAT0/status', nil, '*l') ~= 'Discharging'
end
local draw_dynamic
@ -65,7 +65,7 @@ function conky_start(update_interval)
-- update dynamic components
local t1 = _updates % (update_freq * 10)
local pacman_stats = Util.read_file(STATS_FILE)
local pacman_stats = util.read_file(STATS_FILE)
local is_using_ac = using_ac()
sys.update(pacman_stats)