ENH dynamically space module blocks
This commit is contained in:
parent
3046cad9bc
commit
f1438af7ce
|
@ -656,10 +656,11 @@ end
|
|||
|
||||
local _combine_blocks = function(acc, new)
|
||||
if new.active == true then
|
||||
local n = new.f(acc.y + new.offset)
|
||||
local n = new.f(acc.next_y)
|
||||
table.insert(acc.objs, n.obj)
|
||||
acc.w = math.max(acc.w, n.w)
|
||||
acc.y = acc.y + n.h + new.offset
|
||||
acc.final_y = acc.next_y + n.h
|
||||
acc.next_y = acc.final_y + new.offset
|
||||
end
|
||||
return acc
|
||||
end
|
||||
|
@ -679,13 +680,13 @@ M.reduce_blocks_inner = function(f, header, point, width, blocks)
|
|||
end
|
||||
local r = pure.reduce(
|
||||
_combine_blocks,
|
||||
{w = 0, y = point.y, objs = {}},
|
||||
{w = 0, next_y = point.y, final_y = point.y, objs = {}},
|
||||
{M.mk_block(mk_header, true, 0), table.unpack(blocks)}
|
||||
)
|
||||
local us, ss, ds = table.unpack(pure.unzip(r.objs))
|
||||
return {
|
||||
next_x = point.x + r.w,
|
||||
next_y = r.y,
|
||||
next_y = r.final_y,
|
||||
update = f(table.unpack(non_false(pure.reverse(us)))),
|
||||
static = pure.sequence(table.unpack(ss)),
|
||||
dynamic = pure.sequence(table.unpack(non_false(ds)))
|
||||
|
|
|
@ -84,9 +84,9 @@ return function(pathspecs, main_state, point)
|
|||
point,
|
||||
geometry.SECTION_WIDTH,
|
||||
{
|
||||
common.mk_block(mk_smart, true, 0),
|
||||
common.mk_block(mk_smart, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_sep, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_bars, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_bars, true, 0),
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
|
@ -222,15 +222,15 @@ return function(update_freq, point)
|
|||
point,
|
||||
geometry.SECTION_WIDTH,
|
||||
{
|
||||
common.mk_block(mk_status, true, 0),
|
||||
common.mk_block(mk_sep, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_temp, true, TEXT_SPACING),
|
||||
common.mk_block(mk_status, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_sep, true, TEXT_SPACING),
|
||||
common.mk_block(mk_temp, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_sep, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_clock, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_sep, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_sep, true, PLOT_SEC_BREAK),
|
||||
common.mk_block(mk_gpu_util, true, PLOT_SEC_BREAK),
|
||||
common.mk_block(mk_mem_util, true, PLOT_SEC_BREAK),
|
||||
common.mk_block(mk_vid_util, true, PLOT_SEC_BREAK)
|
||||
common.mk_block(mk_vid_util, true, 0)
|
||||
}
|
||||
)
|
||||
return pure.map_at("update", function(f) return function(_) f(update_state()) end end, rbs)
|
||||
|
|
|
@ -185,9 +185,9 @@ return function(update_freq, point)
|
|||
point,
|
||||
geometry.SECTION_WIDTH,
|
||||
{
|
||||
common.mk_block(mk_stats, true, 0),
|
||||
common.mk_block(mk_plot, true, PLOT_SECTION_BREAK),
|
||||
common.mk_block(mk_tbl, true, TABLE_SECTION_BREAK),
|
||||
common.mk_block(mk_stats, true, PLOT_SECTION_BREAK),
|
||||
common.mk_block(mk_plot, true, TABLE_SECTION_BREAK),
|
||||
common.mk_block(mk_tbl, true, 0),
|
||||
}
|
||||
)
|
||||
return pure.map_at("update", function(f) return function(_) f(read_state()) end end, rbs)
|
||||
|
|
|
@ -117,9 +117,9 @@ return function(update_freq, battery, main_state, point)
|
|||
point,
|
||||
geometry.SECTION_WIDTH,
|
||||
{
|
||||
common.mk_block(mk_pkg0, true, 0),
|
||||
common.mk_block(mk_pkg0, true, TEXT_SPACING),
|
||||
common.mk_block(mk_dram, true, TEXT_SPACING),
|
||||
common.mk_block(mk_bat, true, TEXT_SPACING),
|
||||
common.mk_block(mk_bat, true, 0),
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
|
@ -231,11 +231,11 @@ return function(update_freq, main_state, point)
|
|||
point,
|
||||
geometry.SECTION_WIDTH,
|
||||
{
|
||||
common.mk_block(mk_cores, true, 0),
|
||||
common.mk_block(mk_hwp_freq, true, TEXT_SPACING),
|
||||
common.mk_block(mk_cores, true, TEXT_SPACING),
|
||||
common.mk_block(mk_hwp_freq, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_sep, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_load_plot, true, SEPARATOR_SPACING),
|
||||
common.mk_block(mk_tbl, true, TABLE_SECTION_BREAK)
|
||||
common.mk_block(mk_load_plot, true, TABLE_SECTION_BREAK),
|
||||
common.mk_block(mk_tbl, true, 0)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ return function(update_freq, devices, point)
|
|||
point,
|
||||
geometry.SECTION_WIDTH,
|
||||
{
|
||||
common.mk_block(mk_reads, true, 0),
|
||||
common.mk_block(mk_writes, true, PLOT_SEC_BREAK),
|
||||
common.mk_block(mk_reads, true, PLOT_SEC_BREAK),
|
||||
common.mk_block(mk_writes, true, 0),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue