REF change some words to make my brain hurt less

This commit is contained in:
Nathan Dwarshuis 2021-07-29 23:04:39 -04:00
parent bdd7902574
commit bb4648659c
12 changed files with 129 additions and 159 deletions

2
core

@ -1 +1 @@
Subproject commit b3c558845da08e92febc612260d710f06c2c7b9a Subproject commit 58cc006b3de5d0a0d1cb02b4f88ca26c336f5905

View File

@ -73,7 +73,7 @@ local left_text_style = _text_row_style('left', theme.INACTIVE_TEXT_FG)
local right_text_style = _text_row_style('right', theme.PRIMARY_FG) local right_text_style = _text_row_style('right', theme.PRIMARY_FG)
local _bare_text = function(pt, _text, style) local _bare_text = function(pt, _text, style)
return text.build_plain(pt, _text, style) return text.make_plain(pt, _text, style)
end end
local _left_text = function(pt, _text) local _left_text = function(pt, _text)
@ -87,11 +87,11 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- header -- header
M.Header = function(x, y, w, _text) M.make_header = function(x, y, w, _text)
local bottom_y = y + HEADER_HEIGHT local bottom_y = y + HEADER_HEIGHT
local underline_y = y + HEADER_UNDERLINE_OFFSET local underline_y = y + HEADER_UNDERLINE_OFFSET
return { return {
text = text.build_plain( text = text.make_plain(
F.make_point(x, y), F.make_point(x, y),
_text, _text,
text.style( text.style(
@ -102,7 +102,7 @@ M.Header = function(x, y, w, _text)
) )
), ),
bottom_y = bottom_y, bottom_y = bottom_y,
underline = line.build( underline = line.make(
F.make_point(x, underline_y), F.make_point(x, underline_y),
F.make_point(x + w, underline_y), F.make_point(x + w, underline_y),
line.config( line.config(
@ -114,7 +114,7 @@ M.Header = function(x, y, w, _text)
} }
end end
M.drawHeader = function(cr, header) M.draw_header = function(cr, header)
text.draw(header.text, cr) text.draw(header.text, cr)
line.draw(header.underline, cr) line.draw(header.underline, cr)
end end
@ -142,8 +142,8 @@ M.percent_label_config = timeseries.label_config(
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) M.make_label_timeseries = function(x, y, w, h, label_config, update_freq)
return timeseries.build( return timeseries.make(
F.make_box(x, y, w, h), F.make_box(x, y, w, h),
update_freq, update_freq,
default_plot_config, default_plot_config,
@ -154,17 +154,17 @@ 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, update_freq, format) M.make_percent_timeseries_formatted = function(x, y, w, h, spacing, label, update_freq, format)
return { return {
label = _left_text(F.make_point(x, y), label), label = _left_text(F.make_point(x, y), label),
value = thresholdtext.build_formatted( value = thresholdtext.make_formatted(
F.make_point(x + w, y), F.make_point(x + w, y),
nil, nil,
right_text_style, right_text_style,
format, format,
thresholdtext.style(theme.CRITICAL_FG, 80) thresholdtext.style(theme.CRITICAL_FG, 80)
), ),
plot = M.initthemedLabelPlot( plot = M.make_label_timeseries(
x, x,
y + spacing, y + spacing,
w, w,
@ -175,23 +175,23 @@ M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, update_freq,
} }
end end
M.initPercentPlot = function(x, y, w, h, spacing, label, update_freq) M.make_percent_timeseries = function(x, y, w, h, spacing, label, update_freq)
return M.initPercentPlot_formatted(x, y, w, h, spacing, label, update_freq, '%s%%') return M.make_percent_timeseries_formatted(x, y, w, h, spacing, label, update_freq, '%s%%')
end end
M.percent_plot_draw_static = function(pp, cr) M.percent_timeseries_draw_static = function(pp, cr)
text.draw(pp.label, cr) text.draw(pp.label, cr)
timeseries.draw_static(pp.plot, cr) timeseries.draw_static(pp.plot, cr)
end end
M.percent_plot_draw_dynamic = function(pp, cr) M.percent_timeseries_draw_dynamic = function(pp, cr)
thresholdtext.draw(pp.value, cr) thresholdtext.draw(pp.value, cr)
timeseries.draw_dynamic(pp.plot, cr) timeseries.draw_dynamic(pp.plot, cr)
end end
-- TODO this is pretty confusing, nil means -1 which gets fed to any text -- TODO this is pretty confusing, nil means -1 which gets fed to any text
-- formatting functions -- formatting functions
M.percent_plot_set = function(pp, value) M.percent_timeseries_set = function(pp, value)
local t = -1 local t = -1
local p = 0 local p = 0
if value ~= nil then if value ~= nil then
@ -233,38 +233,35 @@ M.converted_y_label_format_generator = function(unit)
end end
end end
M.base_2_scale_data = function(m) local base_2_scale_data = function(m)
return scaledtimeseries.scaling_parameters(2, m, 0.9) return scaledtimeseries.scaling_parameters(2, m, 0.9)
end end
M.initthemedScalePlot = function(x, y, w, h, f, min_domain, update_freq) M.make_scaled_timeseries = function(x, y, w, h, f, min_domain, update_freq)
return scaledtimeseries.build( return scaledtimeseries.make(
F.make_box(x, y, w, h), F.make_box(x, y, w, h),
update_freq, update_freq,
default_plot_config, default_plot_config,
timeseries.label_config( timeseries.label_config(theme.INACTIVE_TEXT_FG, label_font_spec, f),
theme.INACTIVE_TEXT_FG, base_2_scale_data(min_domain)
label_font_spec,
f
),
M.base_2_scale_data(min_domain)
) )
end 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.make_labeled_scaled_timeseries = function(x, y, w, h, format_fun, label_fun,
label, min_domain, update_freq) spacing, label, min_domain,
update_freq)
return { return {
label = _left_text(F.make_point(x, y), label), label = _left_text(F.make_point(x, y), label),
value = text.build_formatted( value = text.make_formatted(
F.make_point(x + w, y), F.make_point(x + w, y),
0, 0,
right_text_style, right_text_style,
format_fun format_fun
), ),
plot = M.initthemedScalePlot(x, y + spacing, w, h, label_fun, min_domain, update_freq), plot = M.make_scaled_timeseries(x, y + spacing, w, h, label_fun, min_domain, update_freq),
} }
end end
@ -285,16 +282,7 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- rate timecourse plots -- rate timecourse plots
M.compute_derivative = function(x0, x1, update_frequency) local make_differential = function(update_frequency)
-- mask overflow
if x1 > x0 then
return (x1 - x0) * update_frequency
else
return 0
end
end
local build_differential = function(update_frequency)
return function(x0, x1) return function(x0, x1)
-- mask overflow -- mask overflow
if x1 > x0 then if x1 > x0 then
@ -305,19 +293,19 @@ local build_differential = function(update_frequency)
end end
end end
M.build_rate_timeseries = function(x, y, w, h, format_fun, label_fun, spacing, M.make_rate_timeseries = function(x, y, w, h, format_fun, label_fun, spacing,
label, min_domain, update_freq, init) label, min_domain, update_freq, init)
return { return {
label = _left_text(F.make_point(x, y), label), label = _left_text(F.make_point(x, y), label),
value = text.build_formatted( value = text.make_formatted(
F.make_point(x + w, y), F.make_point(x + w, y),
0, 0,
right_text_style, right_text_style,
format_fun format_fun
), ),
plot = M.initthemedScalePlot(x, y + spacing, w, h, label_fun, min_domain, update_freq), plot = M.make_scaled_timeseries(x, y + spacing, w, h, label_fun, min_domain, update_freq),
prev_value = init, prev_value = init,
derive = build_differential(update_freq), derive = make_differential(update_freq),
} }
end end
@ -328,24 +316,11 @@ M.update_rate_timeseries = function(obj, value)
obj.prev_value = value obj.prev_value = value
end end
--------------------------------------------------------------------------------
-- arc (TODO this is just a dummy now to make everything organized
-- TODO perhaps implement this is a special case of compound dial where
-- I have multiple layers on top of each other
M.arc = function(x, y, r, thickness, pattern)
return arc.build(
F.make_semicircle(x, y, r, 90, 360),
arc.config(s.line(thickness, CAIRO_LINE_CAP_BUTT), pattern)
)
end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- ring -- ring
M.initRing = function(x, y, r) M.make_circle = function(x, y, r)
return arc.build( return arc.make(
F.make_semicircle(x, y, r, 0, 360), F.make_semicircle(x, y, r, 0, 360),
arc.config(s.line(ARC_WIDTH, CAIRO_LINE_CAP_BUTT), theme.BORDER_FG) arc.config(s.line(ARC_WIDTH, CAIRO_LINE_CAP_BUTT), theme.BORDER_FG)
) )
@ -354,18 +329,13 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- ring with text data in the center -- ring with text data in the center
M.inittextRing = function(x, y, r, fmt, limit) M.make_text_circle = function(x, y, r, fmt, limit)
return { return {
ring = M.initRing(x, y, r), ring = M.make_circle(x, y, r),
value = thresholdtext.build_formatted( value = thresholdtext.make_formatted(
F.make_point(x, y), F.make_point(x, y),
0, 0,
text.style( text.style(normal_font_spec, theme.PRIMARY_FG, 'center', 'center'),
normal_font_spec,
theme.PRIMARY_FG,
'center',
'center'
),
fmt, fmt,
thresholdtext.style(theme.CRITICAL_FG, limit) thresholdtext.style(theme.CRITICAL_FG, limit)
), ),
@ -397,12 +367,12 @@ end
M.dial = function(x, y, radius, thickness, threshold, format) M.dial = function(x, y, radius, thickness, threshold, format)
return { return {
dial = dial.build( dial = dial.make(
F.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1), F.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1),
arc.config(s.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG), arc.config(s.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG),
threshold_indicator(threshold) threshold_indicator(threshold)
), ),
text_ring = M.inittextRing(x, y, radius - thickness / 2 - 2, format, threshold), text_ring = M.make_text_circle(x, y, radius - thickness / 2 - 2, format, threshold),
} }
end end
@ -426,7 +396,7 @@ end
M.compound_dial = function(x, y, outer_radius, inner_radius, thickness, M.compound_dial = function(x, y, outer_radius, inner_radius, thickness,
threshold, num_dials) threshold, num_dials)
return compounddial.build( return compounddial.make(
F.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1), F.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1),
arc.config(s.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG), arc.config(s.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG),
threshold_indicator(threshold), threshold_indicator(threshold),
@ -440,14 +410,14 @@ end
M.compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold) M.compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold)
return { return {
labels = textcolumn.build( labels = textcolumn.make(
F.make_point(x, y), F.make_point(x, y),
labels, labels,
left_text_style, left_text_style,
nil, nil,
spacing spacing
), ),
bars = compoundbar.build( bars = compoundbar.make(
F.make_point(x + pad, y), F.make_point(x + pad, y),
w - pad, w - pad,
line.config( line.config(
@ -479,8 +449,8 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- separator (eg a horizontal line) -- separator (eg a horizontal line)
M.initSeparator = function(x, y, w) M.make_separator = function(x, y, w)
return line.build( return line.make(
F.make_point(x, y), F.make_point(x, y),
F.make_point(x + w, y), F.make_point(x + w, y),
line.config( line.config(
@ -494,7 +464,7 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- text row (label with a value, aligned as far apart as possible) -- text row (label with a value, aligned as far apart as possible)
M.inittextRow = function(x, y, w, label) M.make_text_row = function(x, y, w, label)
return { return {
label = _left_text(F.make_point(x, y), label), label = _left_text(F.make_point(x, y), label),
value = _right_text(F.make_point(x + w, y), nil), value = _right_text(F.make_point(x + w, y), nil),
@ -516,10 +486,10 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- text row with critical indicator -- text row with critical indicator
M.inittextRowCrit = function(x, y, w, label, append_end, limit) M.make_threshold_text_row = function(x, y, w, label, append_end, limit)
return{ return{
label = _left_text(F.make_point(x, y), label), label = _left_text(F.make_point(x, y), label),
value = thresholdtext.build_formatted( value = thresholdtext.make_formatted(
F.make_point(x + w, y), F.make_point(x + w, y),
nil, nil,
text.style( text.style(
@ -548,7 +518,7 @@ end
-- text column -- text column
M.text_column = function(x, y, spacing, labels, x_align, color) M.text_column = function(x, y, spacing, labels, x_align, color)
return textcolumn.build( return textcolumn.make(
F.make_point(x, y), F.make_point(x, y),
labels, labels,
_text_row_style(x_align, color), _text_row_style(x_align, color),
@ -560,16 +530,16 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- multiple text row separated by spacing -- multiple text row separated by spacing
M.inittextRows_color = function(x, y, w, spacing, labels, color, format) M.make_text_rows_color = function(x, y, w, spacing, labels, color, format)
return { return {
labels = textcolumn.build( labels = textcolumn.make(
F.make_point(x, y), F.make_point(x, y),
labels, labels,
left_text_style, left_text_style,
nil, nil,
spacing spacing
), ),
values = textcolumn.build_n( values = textcolumn.make_n(
F.make_point(x + w, y), F.make_point(x + w, y),
#labels, #labels,
_text_row_style('right', color), _text_row_style('right', color),
@ -580,8 +550,8 @@ M.inittextRows_color = function(x, y, w, spacing, labels, color, format)
} }
end end
M.inittextRows_formatted = function(x, y, w, spacing, labels, format) M.make_text_rows_formatted = function(x, y, w, spacing, labels, format)
return M.inittextRows_color( return M.make_text_rows_color(
x, x,
y, y,
w, w,
@ -592,8 +562,8 @@ M.inittextRows_formatted = function(x, y, w, spacing, labels, format)
) )
end end
M.inittextRows = function(x, y, w, spacing, labels) M.make_text_rows = function(x, y, w, spacing, labels)
return M.inittextRows_formatted( return M.make_text_rows_formatted(
x, x,
y, y,
w, w,
@ -648,8 +618,8 @@ local default_table_style = tbl.style(
) )
) )
M.inittable = function(x, y, w, h, n, labels) M.make_text_table = function(x, y, w, h, n, labels)
return tbl.build( return tbl.make(
F.make_box(x, y, w, h), F.make_box(x, y, w, h),
n, n,
labels, labels,
@ -660,8 +630,8 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- panel -- panel
M.initPanel = function(x, y, w, h, thickness) M.make_panel = function(x, y, w, h, thickness)
return fillrect.build( return fillrect.make(
F.make_box(x, y, w, h), F.make_box(x, y, w, h),
rect.config( rect.config(
s.closed_poly(thickness, CAIRO_LINE_JOIN_MITER), s.closed_poly(thickness, CAIRO_LINE_JOIN_MITER),

View File

@ -13,7 +13,7 @@ return function()
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
local header = common.Header( local header = common.make_header(
geometry.RIGHT_X, geometry.RIGHT_X,
MODULE_Y, MODULE_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -23,7 +23,7 @@ return function()
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- smartd -- smartd
local smart = common.inittextRow( local smart = common.make_text_row(
geometry.RIGHT_X, geometry.RIGHT_X,
header.bottom_y, header.bottom_y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -32,7 +32,7 @@ return function()
local SEP_Y = header.bottom_y + SEPARATOR_SPACING local SEP_Y = header.bottom_y + SEPARATOR_SPACING
local separator = common.initSeparator( local separator = common.make_separator(
geometry.RIGHT_X, geometry.RIGHT_X,
SEP_Y, SEP_Y,
geometry.SECTION_WIDTH geometry.SECTION_WIDTH
@ -76,7 +76,7 @@ return function()
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.text_row_draw_static(smart, cr) common.text_row_draw_static(smart, cr)
line.draw(separator, cr) line.draw(separator, cr)
common.compound_bar_draw_static(fs, cr) common.compound_bar_draw_static(fs, cr)

View File

@ -18,7 +18,7 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
local header = common.Header( local header = common.make_header(
geometry.LEFT_X, geometry.LEFT_X,
MODULE_Y, MODULE_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -28,7 +28,7 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- gpu status -- gpu status
local status = common.inittextRow( local status = common.make_text_row(
geometry.LEFT_X, geometry.LEFT_X,
header.bottom_y, header.bottom_y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -37,7 +37,7 @@ return function(update_freq)
local SEP_Y1 = header.bottom_y + SEPARATOR_SPACING local SEP_Y1 = header.bottom_y + SEPARATOR_SPACING
local separator1 = common.initSeparator( local separator1 = common.make_separator(
geometry.LEFT_X, geometry.LEFT_X,
SEP_Y1, SEP_Y1,
geometry.SECTION_WIDTH geometry.SECTION_WIDTH
@ -48,7 +48,7 @@ return function(update_freq)
local INTERNAL_TEMP_Y = SEP_Y1 + SEPARATOR_SPACING local INTERNAL_TEMP_Y = SEP_Y1 + SEPARATOR_SPACING
local internal_temp = common.inittextRowCrit( local internal_temp = common.make_threshold_text_row(
geometry.LEFT_X, geometry.LEFT_X,
INTERNAL_TEMP_Y, INTERNAL_TEMP_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -61,7 +61,7 @@ return function(update_freq)
local SEP_Y2 = INTERNAL_TEMP_Y + SEPARATOR_SPACING local SEP_Y2 = INTERNAL_TEMP_Y + SEPARATOR_SPACING
local separator2 = common.initSeparator( local separator2 = common.make_separator(
geometry.LEFT_X, geometry.LEFT_X,
SEP_Y2, SEP_Y2,
geometry.SECTION_WIDTH geometry.SECTION_WIDTH
@ -72,7 +72,7 @@ return function(update_freq)
local CLOCK_SPEED_Y = SEP_Y2 + SEPARATOR_SPACING local CLOCK_SPEED_Y = SEP_Y2 + SEPARATOR_SPACING
local clock_speed = common.inittextRows( local clock_speed = common.make_text_rows(
geometry.LEFT_X, geometry.LEFT_X,
CLOCK_SPEED_Y, CLOCK_SPEED_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -82,7 +82,7 @@ return function(update_freq)
local SEP_Y3 = CLOCK_SPEED_Y + TEXT_SPACING * 2 local SEP_Y3 = CLOCK_SPEED_Y + TEXT_SPACING * 2
local separator3 = common.initSeparator( local separator3 = common.make_separator(
geometry.LEFT_X, geometry.LEFT_X,
SEP_Y3, SEP_Y3,
geometry.SECTION_WIDTH geometry.SECTION_WIDTH
@ -95,8 +95,8 @@ return function(update_freq)
if x == -1 then return NA else return __string_format('%s%%', x) end if x == -1 then return NA else return __string_format('%s%%', x) end
end end
local build_plot = function(y, label) local make_plot = function(y, label)
return common.initPercentPlot_formatted( return common.make_percent_timeseries_formatted(
geometry.LEFT_X, geometry.LEFT_X,
y, y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -109,19 +109,19 @@ return function(update_freq)
end end
local GPU_UTIL_Y = SEP_Y3 + SEPARATOR_SPACING local GPU_UTIL_Y = SEP_Y3 + SEPARATOR_SPACING
local gpu_util = build_plot(GPU_UTIL_Y, 'GPU utilization') local gpu_util = make_plot(GPU_UTIL_Y, 'GPU utilization')
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- gpu memory consumption plot -- gpu memory consumption plot
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 = build_plot(MEM_UTIL_Y, 'memory utilization') local mem_util = make_plot(MEM_UTIL_Y, 'memory utilization')
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- gpu video utilization plot -- gpu video utilization plot
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 = build_plot(VID_UTIL_Y, 'Video utilization') local vid_util = make_plot(VID_UTIL_Y, 'Video utilization')
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- update function -- update function
@ -153,9 +153,9 @@ return function(update_freq)
common.text_row_crit_set(internal_temp, -1) common.text_row_crit_set(internal_temp, -1)
common.text_rows_set(clock_speed, 1, NA) common.text_rows_set(clock_speed, 1, NA)
common.text_rows_set(clock_speed, 2, NA) common.text_rows_set(clock_speed, 2, NA)
common.percent_plot_set(gpu_util, nil) common.percent_timeseries_set(gpu_util, nil)
common.percent_plot_set(vid_util, nil) common.percent_timeseries_set(vid_util, nil)
common.percent_plot_set(mem_util, nil) common.percent_timeseries_set(mem_util, nil)
end end
local update = function() local update = function()
@ -175,9 +175,9 @@ return function(update_freq)
common.text_rows_set(clock_speed, 1, gpu_frequency..' Mhz') common.text_rows_set(clock_speed, 1, gpu_frequency..' Mhz')
common.text_rows_set(clock_speed, 2, memory_frequency..' Mhz') common.text_rows_set(clock_speed, 2, memory_frequency..' Mhz')
common.percent_plot_set(gpu_util, gpu_utilization) common.percent_timeseries_set(gpu_util, gpu_utilization)
common.percent_plot_set(mem_util, used_memory / total_memory * 100) common.percent_timeseries_set(mem_util, used_memory / total_memory * 100)
common.percent_plot_set(vid_util, vid_utilization) common.percent_timeseries_set(vid_util, vid_utilization)
end end
else else
text.set(status.value, 'Off') text.set(status.value, 'Off')
@ -189,7 +189,7 @@ return function(update_freq)
-- main drawing functions -- main drawing functions
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.text_row_draw_static(status, cr) common.text_row_draw_static(status, cr)
line.draw(separator1, cr) line.draw(separator1, cr)
@ -200,18 +200,18 @@ return function(update_freq)
common.text_rows_draw_static(clock_speed, cr) common.text_rows_draw_static(clock_speed, cr)
line.draw(separator3, cr) line.draw(separator3, cr)
common.percent_plot_draw_static(gpu_util, cr) common.percent_timeseries_draw_static(gpu_util, cr)
common.percent_plot_draw_static(mem_util, cr) common.percent_timeseries_draw_static(mem_util, cr)
common.percent_plot_draw_static(vid_util, cr) common.percent_timeseries_draw_static(vid_util, cr)
end end
local draw_dynamic = function(cr) local draw_dynamic = function(cr)
common.text_row_draw_dynamic(status, cr) common.text_row_draw_dynamic(status, cr)
common.text_row_crit_draw_dynamic(internal_temp, cr) common.text_row_crit_draw_dynamic(internal_temp, cr)
common.text_rows_draw_dynamic(clock_speed, cr) common.text_rows_draw_dynamic(clock_speed, cr)
common.percent_plot_draw_dynamic(gpu_util, cr) common.percent_timeseries_draw_dynamic(gpu_util, cr)
common.percent_plot_draw_dynamic(mem_util, cr) common.percent_timeseries_draw_dynamic(mem_util, cr)
common.percent_plot_draw_dynamic(vid_util, cr) common.percent_timeseries_draw_dynamic(vid_util, cr)
end end
return {static = draw_static, dynamic = draw_dynamic, update = update} return {static = draw_static, dynamic = draw_dynamic, update = update}

View File

@ -30,7 +30,7 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
local header = common.Header( local header = common.make_header(
geometry.RIGHT_X, geometry.RIGHT_X,
MODULE_Y, MODULE_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -85,7 +85,7 @@ return function(update_freq)
local CACHE_X = SWAP_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2 local CACHE_X = SWAP_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2
local CACHE_WIDTH = geometry.RIGHT_X + geometry.SECTION_WIDTH - CACHE_X local CACHE_WIDTH = geometry.RIGHT_X + geometry.SECTION_WIDTH - CACHE_X
local cache = common.inittextRows_formatted( local cache = common.make_text_rows_formatted(
CACHE_X, CACHE_X,
CACHE_Y, CACHE_Y,
CACHE_WIDTH, CACHE_WIDTH,
@ -99,7 +99,7 @@ return function(update_freq)
local PLOT_Y = header.bottom_y + PLOT_SECTION_BREAK + DIAL_DIAMETER local PLOT_Y = header.bottom_y + PLOT_SECTION_BREAK + DIAL_DIAMETER
local plot = common.initthemedLabelPlot( local plot = common.make_label_timeseries(
geometry.RIGHT_X, geometry.RIGHT_X,
PLOT_Y, PLOT_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -122,7 +122,7 @@ return function(update_freq)
end, end,
func.seq(NUM_ROWS)) func.seq(NUM_ROWS))
local tbl = common.inittable( local tbl = common.make_text_table(
geometry.RIGHT_X, geometry.RIGHT_X,
PLOT_Y + PLOT_HEIGHT + TABLE_SECTION_BREAK, PLOT_Y + PLOT_HEIGHT + TABLE_SECTION_BREAK,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -171,7 +171,7 @@ return function(update_freq)
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.dial_draw_static(mem, cr) common.dial_draw_static(mem, cr)
common.dial_draw_static(swap, cr) common.dial_draw_static(swap, cr)
common.text_rows_draw_static(cache, cr) common.text_rows_draw_static(cache, cr)

View File

@ -48,8 +48,8 @@ return function(update_freq)
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 build_plot = function(y, label, init) local make_plot = function(y, label, init)
return common.build_rate_timeseries( return common.make_rate_timeseries(
geometry.CENTER_RIGHT_X, geometry.CENTER_RIGHT_X,
y, y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -67,7 +67,7 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
local header = common.Header( local header = common.make_header(
geometry.CENTER_RIGHT_X, geometry.CENTER_RIGHT_X,
geometry.TOP_Y, geometry.TOP_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -77,13 +77,13 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- download plot -- download plot
local rx = build_plot(header.bottom_y, 'Download', init_rx_bits) local rx = make_plot(header.bottom_y, 'Download', init_rx_bits)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- upload plot -- upload plot
local TX_Y = header.bottom_y + PLOT_HEIGHT + PLOT_SEC_BREAK * 2 local TX_Y = header.bottom_y + PLOT_HEIGHT + PLOT_SEC_BREAK * 2
local tx = build_plot(TX_Y, 'Upload', init_tx_bits) local tx = make_plot(TX_Y, 'Upload', init_tx_bits)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- main drawing functions -- main drawing functions
@ -95,7 +95,7 @@ return function(update_freq)
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.annotated_scale_plot_draw_static(rx, cr) common.annotated_scale_plot_draw_static(rx, cr)
common.annotated_scale_plot_draw_static(tx, cr) common.annotated_scale_plot_draw_static(tx, cr)
end end

View File

@ -7,14 +7,14 @@ return function()
local __string_match = string.match local __string_match = string.match
local __string_gmatch = string.gmatch local __string_gmatch = string.gmatch
local header = common.Header( local header = common.make_header(
geometry.RIGHT_X, geometry.RIGHT_X,
geometry.TOP_Y, geometry.TOP_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
'PACMAN' 'PACMAN'
) )
local rows = common.inittextRows( local rows = common.make_text_rows(
geometry.RIGHT_X, geometry.RIGHT_X,
header.bottom_y, header.bottom_y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -38,7 +38,7 @@ return function()
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.text_rows_draw_static(rows, cr) common.text_rows_draw_static(rows, cr)
end end

View File

@ -49,8 +49,8 @@ return function(update_freq)
return util.precision_round_to_string(watts, 3)..' W' return util.precision_round_to_string(watts, 3)..' W'
end end
local build_rate_plot = function(y, label, init) local make_rate_plot = function(y, label, init)
return common.build_rate_timeseries( return common.make_rate_timeseries(
geometry.RIGHT_X, geometry.RIGHT_X,
y, y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -68,7 +68,7 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
local header = common.Header( local header = common.make_header(
geometry.RIGHT_X, geometry.RIGHT_X,
MODULE_Y, MODULE_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -78,13 +78,13 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- package 0 power plot -- package 0 power plot
local pkg0 = build_rate_plot(header.bottom_y, 'PKG0', read_pkg0_joules()) local pkg0 = make_rate_plot(header.bottom_y, 'PKG0', read_pkg0_joules())
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- DRAM power plot -- DRAM power plot
local DRAM_Y = header.bottom_y + TEXT_SPACING + PLOT_SEC_BREAK + PLOT_HEIGHT local DRAM_Y = header.bottom_y + TEXT_SPACING + PLOT_SEC_BREAK + PLOT_HEIGHT
local dram = build_rate_plot(DRAM_Y, 'DRAM', read_dram_joules()) local dram = make_rate_plot(DRAM_Y, 'DRAM', read_dram_joules())
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- battery power plot -- battery power plot
@ -98,7 +98,7 @@ return function(update_freq)
end end
local BAT_Y = DRAM_Y + PLOT_SEC_BREAK * 2 + PLOT_HEIGHT local BAT_Y = DRAM_Y + PLOT_SEC_BREAK * 2 + PLOT_HEIGHT
local bat = common.initLabeledScalePlot( local bat = common.make_labeled_scaled_timeseries(
geometry.RIGHT_X, geometry.RIGHT_X,
BAT_Y, BAT_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -121,7 +121,7 @@ return function(update_freq)
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.annotated_scale_plot_draw_static(pkg0, cr) common.annotated_scale_plot_draw_static(pkg0, cr)
common.annotated_scale_plot_draw_static(dram, cr) common.annotated_scale_plot_draw_static(dram, cr)
common.annotated_scale_plot_draw_static(bat, cr) common.annotated_scale_plot_draw_static(bat, cr)

View File

@ -24,7 +24,7 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
local header = common.Header( local header = common.make_header(
geometry.LEFT_X, geometry.LEFT_X,
MODULE_Y, MODULE_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -55,7 +55,7 @@ return function(update_freq)
0.8, 0.8,
nthreads nthreads
), ),
coretemp = common.inittextRing( coretemp = common.make_text_circle(
x, x,
y, y,
DIAL_INNER_RADIUS - 2, DIAL_INNER_RADIUS - 2,
@ -77,7 +77,7 @@ return function(update_freq)
local HWP_Y = header.bottom_y + DIAL_OUTER_RADIUS * 2 + PLOT_SECTION_BREAK local HWP_Y = header.bottom_y + DIAL_OUTER_RADIUS * 2 + PLOT_SECTION_BREAK
local cpu_status = common.inittextRows( local cpu_status = common.make_text_rows(
geometry.LEFT_X, geometry.LEFT_X,
HWP_Y, HWP_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -90,7 +90,7 @@ return function(update_freq)
local SEP_Y = HWP_Y + TEXT_SPACING + SEPARATOR_SPACING local SEP_Y = HWP_Y + TEXT_SPACING + SEPARATOR_SPACING
local separator = common.initSeparator( local separator = common.make_separator(
geometry.LEFT_X, geometry.LEFT_X,
SEP_Y, SEP_Y,
geometry.SECTION_WIDTH geometry.SECTION_WIDTH
@ -101,7 +101,7 @@ return function(update_freq)
local LOAD_Y = SEP_Y + SEPARATOR_SPACING local LOAD_Y = SEP_Y + SEPARATOR_SPACING
local total_load = common.initPercentPlot( local total_load = common.make_percent_timeseries(
geometry.LEFT_X, geometry.LEFT_X,
LOAD_Y, LOAD_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -122,7 +122,7 @@ return function(update_freq)
func.seq(NUM_ROWS) func.seq(NUM_ROWS)
) )
local tbl = common.inittable( local tbl = common.make_text_table(
geometry.LEFT_X, geometry.LEFT_X,
PLOT_Y + PLOT_HEIGHT + TABLE_SECTION_BREAK, PLOT_Y + PLOT_HEIGHT + TABLE_SECTION_BREAK,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -158,7 +158,7 @@ return function(update_freq)
end 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) common.percent_timeseries_set(total_load, load_sum / ncpus * 100)
for r = 1, NUM_ROWS do for r = 1, NUM_ROWS do
local pid = conky(TABLE_CONKY[r].pid, '(%d+)') -- may have leading spaces local pid = conky(TABLE_CONKY[r].pid, '(%d+)') -- may have leading spaces
@ -171,7 +171,7 @@ return function(update_freq)
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
for i = 1, #cores do for i = 1, #cores do
common.text_ring_draw_static(cores[i].coretemp, cr) common.text_ring_draw_static(cores[i].coretemp, cr)
@ -181,7 +181,7 @@ return function(update_freq)
common.text_rows_draw_static(cpu_status, cr) common.text_rows_draw_static(cpu_status, cr)
line.draw(separator, cr) line.draw(separator, cr)
common.percent_plot_draw_static(total_load, cr) common.percent_timeseries_draw_static(total_load, cr)
texttable.draw_static(tbl, cr) texttable.draw_static(tbl, cr)
end end
@ -193,7 +193,7 @@ return function(update_freq)
end end
common.text_rows_draw_dynamic(cpu_status, cr) common.text_rows_draw_dynamic(cpu_status, cr)
common.percent_plot_draw_dynamic(total_load, cr) common.percent_timeseries_draw_dynamic(total_load, cr)
texttable.draw_dynamic(tbl, cr) texttable.draw_dynamic(tbl, cr)
end end

View File

@ -42,8 +42,8 @@ return function(update_freq)
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 build_plot = function(y, label, init) local make_plot = function(y, label, init)
return common.build_rate_timeseries( return common.make_rate_timeseries(
geometry.CENTER_LEFT_X, geometry.CENTER_LEFT_X,
y, y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -61,7 +61,7 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
local header = common.Header( local header = common.make_header(
geometry.CENTER_LEFT_X, geometry.CENTER_LEFT_X,
geometry.TOP_Y, geometry.TOP_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -71,12 +71,12 @@ return function(update_freq)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- reads -- reads
local reads = build_plot(header.bottom_y, 'Reads', init_read_bytes) local reads = make_plot(header.bottom_y, 'Reads', init_read_bytes)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- writes -- writes
local writes = build_plot( local writes = make_plot(
header.bottom_y + PLOT_HEIGHT + PLOT_SEC_BREAK * 2, header.bottom_y + PLOT_HEIGHT + PLOT_SEC_BREAK * 2,
'Writes', 'Writes',
init_write_bytes init_write_bytes
@ -92,7 +92,7 @@ return function(update_freq)
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.annotated_scale_plot_draw_static(reads, cr) common.annotated_scale_plot_draw_static(reads, cr)
common.annotated_scale_plot_draw_static(writes, cr) common.annotated_scale_plot_draw_static(writes, cr)
end end

View File

@ -15,7 +15,7 @@ return function(left_modules, center_modules, right_modules)
-- move over by half a pixel so the lines don't need to be antialiased -- move over by half a pixel so the lines don't need to be antialiased
local _x = x + 0.5 local _x = x + 0.5
local _y = y + 0.5 local _y = y + 0.5
local panel = common.initPanel(_x, _y, w, h, panel_line_thickness) local panel = common.make_panel(_x, _y, w, h, panel_line_thickness)
local cs_x = _x - panel_line_thickness * 0.5 local cs_x = _x - panel_line_thickness * 0.5
local cs_y = _y - panel_line_thickness * 0.5 local cs_y = _y - panel_line_thickness * 0.5
local cs_w = w + panel_line_thickness local cs_w = w + panel_line_thickness

View File

@ -7,14 +7,14 @@ return function()
local __string_match = string.match local __string_match = string.match
local header = common.Header( local header = common.make_header(
geometry.LEFT_X, geometry.LEFT_X,
geometry.TOP_Y, geometry.TOP_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
'SYSTEM' 'SYSTEM'
) )
local rows = common.inittextRows( local rows = common.make_text_rows(
geometry.LEFT_X, geometry.LEFT_X,
header.bottom_y, header.bottom_y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
@ -35,7 +35,7 @@ return function()
end end
local draw_static = function(cr) local draw_static = function(cr)
common.drawHeader(cr, header) common.draw_header(cr, header)
common.text_rows_draw_static(rows, cr) common.text_rows_draw_static(rows, cr)
end end