REF get rid of global vars passed to modules

This commit is contained in:
Nathan Dwarshuis 2021-07-17 16:43:00 -04:00
parent 5875eeff98
commit 36c23df114
8 changed files with 397 additions and 386 deletions

View File

@ -137,10 +137,10 @@ M.percent_label_style = Startup.label_style(
function(z) return Util.round_to_string(z * 100)..'%' end function(z) return Util.round_to_string(z * 100)..'%' end
) )
M.initThemedLabelPlot = function(x, y, w, h, label_style) M.initThemedLabelPlot = function(x, y, w, h, label_style, update_freq)
return Startup.LabelPlot( return Startup.LabelPlot(
Startup.make_box(x, y, w, h), Startup.make_box(x, y, w, h),
1 / _G_INIT_DATA_.UPDATE_INTERVAL, update_freq,
M.default_plot_style, M.default_plot_style,
label_style label_style
) )
@ -149,7 +149,7 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- percent plot (label plot with percent signs and some indicator data above it) -- percent plot (label plot with percent signs and some indicator data above it)
M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, format) M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, update_freq, format)
return { return {
label = _left_text(Startup.make_point(x, y), label), label = _left_text(Startup.make_point(x, y), label),
value = Startup.formattedThresholdText( value = Startup.formattedThresholdText(
@ -164,13 +164,14 @@ M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, format)
y + spacing, y + spacing,
w, w,
h, h,
M.percent_label_style M.percent_label_style,
update_freq
), ),
} }
end end
M.initPercentPlot = function(x, y, w, h, spacing, label) M.initPercentPlot = function(x, y, w, h, spacing, label, update_freq)
return M.initPercentPlot_formatted(x, y, w, h, spacing, label, '%s%%') return M.initPercentPlot_formatted(x, y, w, h, spacing, label, update_freq, '%s%%')
end end
M.percent_plot_draw_static = function(pp, cr) M.percent_plot_draw_static = function(pp, cr)
@ -203,10 +204,10 @@ M.base_2_scale_data = function(m)
return Startup.scale_data(2, m, 0.9) return Startup.scale_data(2, m, 0.9)
end end
M.initThemedScalePlot = function(x, y, w, h, f, min_domain) M.initThemedScalePlot = function(x, y, w, h, f, min_domain, update_freq)
return Startup.ScalePlot( return Startup.ScalePlot(
Startup.make_box(x, y, w, h), Startup.make_box(x, y, w, h),
1 / _G_INIT_DATA_.UPDATE_INTERVAL, update_freq,
M.default_plot_style, M.default_plot_style,
Startup.label_style( Startup.label_style(
Theme.INACTIVE_TEXT_FG, Theme.INACTIVE_TEXT_FG,
@ -221,7 +222,7 @@ end
-- scaled plot (with textual data above it) -- scaled plot (with textual data above it)
M.initLabeledScalePlot = function(x, y, w, h, format_fun, label_fun, spacing, M.initLabeledScalePlot = function(x, y, w, h, format_fun, label_fun, spacing,
label, min_domain) label, min_domain, update_freq)
return { return {
label = _left_text(Startup.make_point(x, y), label), label = _left_text(Startup.make_point(x, y), label),
value = Startup.formatted_text( value = Startup.formatted_text(
@ -230,7 +231,7 @@ M.initLabeledScalePlot = function(x, y, w, h, format_fun, label_fun, spacing,
M.right_text_style, M.right_text_style,
format_fun format_fun
), ),
plot = M.initThemedScalePlot(x, y + spacing, w, h, label_fun, min_domain), plot = M.initThemedScalePlot(x, y + spacing, w, h, label_fun, min_domain, update_freq),
} }
end end

View File

@ -79,39 +79,13 @@ local separator3 = Common.initSeparator(
local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_ local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_
local gpu_util = Common.initPercentPlot_formatted(
Geometry.LEFT_X,
_GPU_UTIL_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SEC_BREAK_,
'GPU Utilization',
na_percent_format
)
local _MEM_UTIL_Y_ = _GPU_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2 local _MEM_UTIL_Y_ = _GPU_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
local mem_util = Common.initPercentPlot_formatted(
Geometry.LEFT_X,
_MEM_UTIL_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SEC_BREAK_,
'Memory Utilization',
na_percent_format
)
local _VID_UTIL_Y_ = _MEM_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2 local _VID_UTIL_Y_ = _MEM_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
local vid_util = Common.initPercentPlot_formatted(
Geometry.LEFT_X,
_VID_UTIL_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SEC_BREAK_,
'Video Utilization',
na_percent_format
)
--[[ --[[
vars to process the nv settings glob vars to process the nv settings glob
@ -136,18 +110,66 @@ local NV_REGEX = '(%d+)\n'..
'(%d+),(%d+)\n'.. '(%d+),(%d+)\n'..
'graphics=(%d+), memory=%d+, video=(%d+), PCIe=%d+\n' 'graphics=(%d+), memory=%d+, video=(%d+), PCIe=%d+\n'
local gpu_bus_ctrl = '/sys/bus/pci/devices/0000:01:00.0/power/control'
-- _MODULE_Y_ = nil
-- _SEPARATOR_SPACING_ = nil
-- _TEXT_SPACING_ = nil
-- _PLOT_SEC_BREAK_ = nil
-- _PLOT_HEIGHT_ = nil
-- _SEP_Y_1_ = nil
-- _SEP_Y_2_ = nil
-- _SEP_Y_3_ = nil
-- _INTERNAL_TEMP_Y_ = nil
-- _CLOCK_SPEED_Y_ = nil
-- _GPU_UTIL_Y_ = nil
-- _MEM_UTIL_Y_ = nil
-- _VID_UTIL_Y_ = nil
return function(update_freq)
local gpu_util = Common.initPercentPlot_formatted(
Geometry.LEFT_X,
_GPU_UTIL_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SEC_BREAK_,
'GPU Utilization',
update_freq,
na_percent_format
)
local mem_util = Common.initPercentPlot_formatted(
Geometry.LEFT_X,
_MEM_UTIL_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SEC_BREAK_,
'Memory Utilization',
update_freq,
na_percent_format
)
local vid_util = Common.initPercentPlot_formatted(
Geometry.LEFT_X,
_VID_UTIL_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SEC_BREAK_,
'Video Utilization',
update_freq,
na_percent_format
)
local nvidia_off = function(cr) local nvidia_off = function(cr)
Common.text_row_crit_set(internal_temp, cr, -1) Common.text_row_crit_set(internal_temp, cr, -1)
Common.text_rows_set(clock_speed, cr, 1, NA) Common.text_rows_set(clock_speed, cr, 1, NA)
Common.text_rows_set(clock_speed, cr, 2, NA) Common.text_rows_set(clock_speed, cr, 2, NA)
Common.percent_plot_set(gpu_util, cr, nil) Common.percent_plot_set(gpu_util, cr, nil)
Common.percent_plot_set(vid_util, cr, nil) Common.percent_plot_set(vid_util, cr, nil)
Common.percent_plot_set(mem_util, cr, nil) Common.percent_plot_set(mem_util, cr, nil)
end end
local gpu_bus_ctrl = '/sys/bus/pci/devices/0000:01:00.0/power/control'
local update = function(cr) local update = function(cr)
if Util.read_file(gpu_bus_ctrl, nil, '*l') == 'on' then if Util.read_file(gpu_bus_ctrl, nil, '*l') == 'on' then
local nvidia_settings_glob = Util.execute_cmd(NV_QUERY) local nvidia_settings_glob = Util.execute_cmd(NV_QUERY)
@ -175,20 +197,6 @@ local update = function(cr)
end end
end end
_MODULE_Y_ = nil
_SEPARATOR_SPACING_ = nil
_TEXT_SPACING_ = nil
_PLOT_SEC_BREAK_ = nil
_PLOT_HEIGHT_ = nil
_SEP_Y_1_ = nil
_SEP_Y_2_ = nil
_SEP_Y_3_ = nil
_INTERNAL_TEMP_Y_ = nil
_CLOCK_SPEED_Y_ = nil
_GPU_UTIL_Y_ = nil
_MEM_UTIL_Y_ = nil
_VID_UTIL_Y_ = nil
local draw_static = function(cr) local draw_static = function(cr)
Common.drawHeader(cr, header) Common.drawHeader(cr, header)
@ -217,6 +225,5 @@ local draw_dynamic = function(cr)
Common.percent_plot_draw_dynamic(vid_util, cr) Common.percent_plot_draw_dynamic(vid_util, cr)
end end
return function()
return {static = draw_static, dynamic = draw_dynamic} return {static = draw_static, dynamic = draw_dynamic}
end end

View File

@ -96,13 +96,6 @@ local cache = Common.initTextRows_color(
local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2 local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2
local plot = Common.initThemedLabelPlot(
Geometry.RIGHT_X,
_PLOT_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
Common.percent_label_style
)
local tbl = Common.initTable( local tbl = Common.initTable(
Geometry.RIGHT_X, Geometry.RIGHT_X,
@ -113,6 +106,33 @@ local tbl = Common.initTable(
{'Name', 'PID', 'Mem (%)'} {'Name', 'PID', 'Mem (%)'}
) )
-- _MODULE_Y_ = nil
-- _DIAL_THICKNESS_ = nil
-- _DIAL_SPACING_ = nil
-- _TEXT_Y_OFFSET_ = nil
-- _TEXT_LEFT_X_OFFSET_ = nil
-- _TEXT_SPACING_ = nil
-- _PLOT_SECTION_BREAK_ = nil
-- _PLOT_HEIGHT_ = nil
-- _TABLE_SECTION_BREAK_ = nil
-- _TABLE_HEIGHT_ = nil
-- _LINE_1_Y_ = nil
-- _TEXT_LEFT_X_ = nil
-- _RIGHT_X_ = nil
-- _PLOT_Y_ = nil
return function(update_freq)
local plot = Common.initThemedLabelPlot(
Geometry.RIGHT_X,
_PLOT_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
Common.percent_label_style,
update_freq
)
local update = function(cr) local update = function(cr)
local conky = Util.conky local conky = Util.conky
-- see source for the 'free' command (sysinfo.c) for formulas -- see source for the 'free' command (sysinfo.c) for formulas
@ -155,21 +175,6 @@ local update = function(cr)
end end
end end
_MODULE_Y_ = nil
_DIAL_THICKNESS_ = nil
_DIAL_SPACING_ = nil
_TEXT_Y_OFFSET_ = nil
_TEXT_LEFT_X_OFFSET_ = nil
_TEXT_SPACING_ = nil
_PLOT_SECTION_BREAK_ = nil
_PLOT_HEIGHT_ = nil
_TABLE_SECTION_BREAK_ = nil
_TABLE_HEIGHT_ = nil
_LINE_1_Y_ = nil
_TEXT_LEFT_X_ = nil
_RIGHT_X_ = nil
_PLOT_Y_ = nil
local draw_static = function(cr) local draw_static = function(cr)
Common.drawHeader(cr, header) Common.drawHeader(cr, header)
@ -198,6 +203,5 @@ local draw_dynamic = function(cr)
Table.draw_dynamic(tbl, cr) Table.draw_dynamic(tbl, cr)
end end
return function(update_freq)
return {dynamic = draw_dynamic, static = draw_static} return {dynamic = draw_dynamic, static = draw_static}
end end

View File

@ -18,6 +18,18 @@ local value_format_function = function(bits)
return Util.precision_round_to_string(value, 3)..' '..unit..'b/s' return Util.precision_round_to_string(value, 3)..' '..unit..'b/s'
end end
local interface_counters_tbl = {}
local get_bits = function(path)
return Util.read_file(path, nil, '*n') * 8
end
-- _PLOT_SEC_BREAK_ = nil
-- _PLOT_HEIGHT_ = nil
return function(update_freq)
local header = Common.Header( local header = Common.Header(
Geometry.CENTER_RIGHT_X, Geometry.CENTER_RIGHT_X,
Geometry.TOP_Y, Geometry.TOP_Y,
@ -34,7 +46,8 @@ local dnload = Common.initLabeledScalePlot(
network_label_function, network_label_function,
_PLOT_SEC_BREAK_, _PLOT_SEC_BREAK_,
'Download', 'Download',
2 2,
update_freq
) )
local upload = Common.initLabeledScalePlot( local upload = Common.initLabeledScalePlot(
@ -46,25 +59,10 @@ local upload = Common.initLabeledScalePlot(
network_label_function, network_label_function,
_PLOT_SEC_BREAK_, _PLOT_SEC_BREAK_,
'Upload', 'Upload',
2 2,
update_freq
) )
local interface_counters_tbl = {}
local get_bits = function(path)
return Util.read_file(path, nil, '*n') * 8
end
_PLOT_SEC_BREAK_ = nil
_PLOT_HEIGHT_ = nil
local draw_static = function(cr)
Common.drawHeader(cr, header)
Common.annotated_scale_plot_draw_static(dnload, cr)
Common.annotated_scale_plot_draw_static(upload, cr)
end
return function(update_freq)
local _update = function(cr) local _update = function(cr)
local dspeed, uspeed = 0, 0 local dspeed, uspeed = 0, 0
@ -108,6 +106,12 @@ return function(update_freq)
Common.annotated_scale_plot_set(upload, cr, uspeed) Common.annotated_scale_plot_set(upload, cr, uspeed)
end end
local draw_static = function(cr)
Common.drawHeader(cr, header)
Common.annotated_scale_plot_draw_static(dnload, cr)
Common.annotated_scale_plot_draw_static(upload, cr)
end
local draw_dynamic = function(cr) local draw_dynamic = function(cr)
_update(cr) _update(cr)
Common.annotated_scale_plot_draw_dynamic(dnload, cr) Common.annotated_scale_plot_draw_dynamic(dnload, cr)

View File

@ -36,6 +36,23 @@ local header = Common.Header(
'POWER' 'POWER'
) )
local _CORE_Y_ = header.bottom_y + _TEXT_SPACING_ + _PLOT_SEC_BREAK_ + _PLOT_HEIGHT_
local PKG0_PATH = '/sys/class/powercap/intel-rapl:0/energy_uj'
local DRAM_PATH = '/sys/class/powercap/intel-rapl:0:2/energy_uj'
local prev_pkg0_uj_cnt = Util.read_file(PKG0_PATH, nil, '*n')
local prev_dram_uj_cnt = Util.read_file(DRAM_PATH, nil, '*n')
-- _MODULE_Y_ = nil
-- _TEXT_SPACING_ = nil
-- _PLOT_SEC_BREAK_ = nil
-- _PLOT_HEIGHT_ = nil
-- _CORE_Y_ = nil
return function(update_freq)
local pkg0 = Common.initLabeledScalePlot( local pkg0 = Common.initLabeledScalePlot(
Geometry.RIGHT_X, Geometry.RIGHT_X,
header.bottom_y, header.bottom_y,
@ -45,11 +62,10 @@ local pkg0 = Common.initLabeledScalePlot(
power_label_function, power_label_function,
_PLOT_SEC_BREAK_, _PLOT_SEC_BREAK_,
'PKG0', 'PKG0',
0 0,
update_freq
) )
local _CORE_Y_ = header.bottom_y + _TEXT_SPACING_ + _PLOT_SEC_BREAK_ + _PLOT_HEIGHT_
local dram = Common.initLabeledScalePlot( local dram = Common.initLabeledScalePlot(
Geometry.RIGHT_X, Geometry.RIGHT_X,
_CORE_Y_, _CORE_Y_,
@ -59,9 +75,9 @@ local dram = Common.initLabeledScalePlot(
power_label_function, power_label_function,
_PLOT_SEC_BREAK_, _PLOT_SEC_BREAK_,
'DRAM', 'DRAM',
0 0,
update_freq
) )
dram.value.append_end = ' W'
local battery_draw = Common.initLabeledScalePlot( local battery_draw = Common.initLabeledScalePlot(
Geometry.RIGHT_X, Geometry.RIGHT_X,
@ -72,31 +88,10 @@ local battery_draw = Common.initLabeledScalePlot(
power_label_function, power_label_function,
_PLOT_SEC_BREAK_, _PLOT_SEC_BREAK_,
'Battery Draw', 'Battery Draw',
0 0,
update_freq
) )
local PKG0_PATH = '/sys/class/powercap/intel-rapl:0/energy_uj'
local DRAM_PATH = '/sys/class/powercap/intel-rapl:0:2/energy_uj'
local prev_pkg0_uj_cnt = Util.read_file(PKG0_PATH, nil, '*n')
local prev_dram_uj_cnt = Util.read_file(DRAM_PATH, nil, '*n')
_MODULE_Y_ = nil
_TEXT_SPACING_ = nil
_PLOT_SEC_BREAK_ = nil
_PLOT_HEIGHT_ = nil
_CORE_Y_ = nil
local draw_static = function(cr)
Common.drawHeader(cr, header)
Common.annotated_scale_plot_draw_static(pkg0, cr)
Common.annotated_scale_plot_draw_static(dram, cr)
Common.annotated_scale_plot_draw_static(battery_draw, cr)
end
return function(update_freq)
local _update = function(cr, is_using_ac) local _update = function(cr, is_using_ac)
local pkg0_uj_cnt = Util.read_file(PKG0_PATH, nil, '*n') local pkg0_uj_cnt = Util.read_file(PKG0_PATH, nil, '*n')
local dram_uj_cnt = Util.read_file(DRAM_PATH, nil, '*n') local dram_uj_cnt = Util.read_file(DRAM_PATH, nil, '*n')
@ -122,6 +117,13 @@ return function(update_freq)
end end
end end
local draw_static = function(cr)
Common.drawHeader(cr, header)
Common.annotated_scale_plot_draw_static(pkg0, cr)
Common.annotated_scale_plot_draw_static(dram, cr)
Common.annotated_scale_plot_draw_static(battery_draw, cr)
end
local draw_dynamic = function(cr, is_using_ac) local draw_dynamic = function(cr, is_using_ac)
_update(cr, is_using_ac) _update(cr, is_using_ac)
Common.annotated_scale_plot_draw_dynamic(pkg0, cr) Common.annotated_scale_plot_draw_dynamic(pkg0, cr)

View File

@ -113,14 +113,6 @@ local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
local _PLOT_Y_ = _LOAD_Y_ + _PLOT_SECTION_BREAK_ local _PLOT_Y_ = _LOAD_Y_ + _PLOT_SECTION_BREAK_
local total_load = Common.initPercentPlot(
Geometry.LEFT_X,
_LOAD_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SECTION_BREAK_,
"Total Load"
)
local tbl = Common.initTable( local tbl = Common.initTable(
Geometry.LEFT_X, Geometry.LEFT_X,
@ -197,6 +189,38 @@ local _read_hwp = function()
end end
end end
-- _MODULE_Y_ = nil
-- _DIAL_INNER_RADIUS_ = nil
-- _DIAL_OUTER_RADIUS_ = nil
-- _DIAL_THICKNESS_ = nil
-- _TEXT_Y_OFFSET_ = nil
-- _SEPARATOR_SPACING_ = nil
-- _TEXT_SPACING_ = nil
-- _PLOT_SECTION_BREAK_ = nil
-- _PLOT_HEIGHT_ = nil
-- _TABLE_SECTION_BREAK_ = nil
-- _TABLE_HEIGHT_ = nil
-- _create_core_ = nil
-- _FREQ_Y_ = nil
-- _LOAD_Y_ = nil
-- _SEP_Y_ = nil
-- _HWP_Y_ = nil
-- _PLOT_Y_ = nil
return function(update_freq)
local total_load = Common.initPercentPlot(
Geometry.LEFT_X,
_LOAD_Y_,
Geometry.SECTION_WIDTH,
_PLOT_HEIGHT_,
_PLOT_SECTION_BREAK_,
"Total Load",
update_freq
)
local update = function(cr, trigger) local update = function(cr, trigger)
local conky = Util.conky local conky = Util.conky
local load_sum = 0 local load_sum = 0
@ -248,24 +272,6 @@ local update = function(cr, trigger)
end end
end end
_MODULE_Y_ = nil
_DIAL_INNER_RADIUS_ = nil
_DIAL_OUTER_RADIUS_ = nil
_DIAL_THICKNESS_ = nil
_TEXT_Y_OFFSET_ = nil
_SEPARATOR_SPACING_ = nil
_TEXT_SPACING_ = nil
_PLOT_SECTION_BREAK_ = nil
_PLOT_HEIGHT_ = nil
_TABLE_SECTION_BREAK_ = nil
_TABLE_HEIGHT_ = nil
_create_core_ = nil
_FREQ_Y_ = nil
_LOAD_Y_ = nil
_SEP_Y_ = nil
_HWP_Y_ = nil
_PLOT_Y_ = nil
local draw_static = function(cr) local draw_static = function(cr)
Common.drawHeader(cr, header) Common.drawHeader(cr, header)
@ -298,6 +304,5 @@ local draw_dynamic = function(cr, trigger)
Table.draw_dynamic(tbl, cr) Table.draw_dynamic(tbl, cr)
end end
return function()
return {static = draw_static, dynamic = draw_dynamic} return {static = draw_static, dynamic = draw_dynamic}
end end

View File

@ -30,6 +30,7 @@ local format_value_function = function(bps)
return Util.precision_round_to_string(value, 3)..' '..unit..'B/s' return Util.precision_round_to_string(value, 3)..' '..unit..'B/s'
end end
return function(update_freq)
local header = Common.Header( local header = Common.Header(
Geometry.CENTER_LEFT_X, Geometry.CENTER_LEFT_X,
Geometry.TOP_Y, Geometry.TOP_Y,
@ -46,8 +47,8 @@ local reads = Common.initLabeledScalePlot(
io_label_function, io_label_function,
_PLOT_SEC_BREAK_, _PLOT_SEC_BREAK_,
'Reads', 'Reads',
2 2,
update_freq
) )
local writes = Common.initLabeledScalePlot( local writes = Common.initLabeledScalePlot(
@ -59,24 +60,14 @@ local writes = Common.initLabeledScalePlot(
io_label_function, io_label_function,
_PLOT_SEC_BREAK_, _PLOT_SEC_BREAK_,
'Writes', 'Writes',
2 2,
update_freq
) )
_PLOT_SEC_BREAK_ = nil
_PLOT_HEIGHT_ = nil
reads.byte_cnt = 0 reads.byte_cnt = 0
writes.byte_cnt = 0 writes.byte_cnt = 0
reads.prev_byte_cnt, writes.prev_byte_cnt = read_stat_file() reads.prev_byte_cnt, writes.prev_byte_cnt = read_stat_file()
local draw_static = function(cr)
Common.drawHeader(cr, header)
Common.annotated_scale_plot_draw_static(reads, cr)
Common.annotated_scale_plot_draw_static(writes, cr)
end
return function(update_freq)
local update_stat = function(cr, stat, byte_cnt) local update_stat = function(cr, stat, byte_cnt)
local delta_bytes = byte_cnt - stat.prev_byte_cnt local delta_bytes = byte_cnt - stat.prev_byte_cnt
stat.prev_byte_cnt = byte_cnt stat.prev_byte_cnt = byte_cnt
@ -95,6 +86,12 @@ return function(update_freq)
update_stat(cr, writes, write_byte_cnt) update_stat(cr, writes, write_byte_cnt)
end end
local draw_static = function(cr)
Common.drawHeader(cr, header)
Common.annotated_scale_plot_draw_static(reads, cr)
Common.annotated_scale_plot_draw_static(writes, cr)
end
local draw_dynamic = function(cr) local draw_dynamic = function(cr)
update(cr) update(cr)
Common.annotated_scale_plot_draw_dynamic(reads, cr) Common.annotated_scale_plot_draw_dynamic(reads, cr)

View File

@ -1,12 +1,3 @@
--
-- initialialize global geometric data
--
local UPDATE_FREQUENCY = 1 --Hz
_G_INIT_DATA_ = {
UPDATE_INTERVAL = 1 / UPDATE_FREQUENCY,
}
-- --
-- init cairo -- init cairo
-- --
@ -102,8 +93,8 @@ function conky_start(update_interval)
local pwr = Power(update_freq) local pwr = Power(update_freq)
local fs = FileSystem() local fs = FileSystem()
local sys = System() local sys = System()
local gfx = Graphics() local gfx = Graphics(update_freq)
local proc = Processor() local proc = Processor(update_freq)
local pcm = Pacman() local pcm = Pacman()
local cs_left = _make_static_surface( local cs_left = _make_static_surface(