ENH modularize module geometries
This commit is contained in:
parent
99ce64bbb6
commit
fb79ea899d
|
@ -6,9 +6,45 @@ let Margin = Vector2 Natural
|
||||||
|
|
||||||
let FSPath = { name : Text, path : Text }
|
let FSPath = { name : Text, path : Text }
|
||||||
|
|
||||||
|
let TextGeo = { Type = { text_spacing : Natural }, default.text_spacing = 20 }
|
||||||
|
|
||||||
|
let SepGeo = { Type = { sep_spacing : Natural }, default.sep_spacing = 20 }
|
||||||
|
|
||||||
|
let PlotGeo_ =
|
||||||
|
{ Type = { sec_break : Natural, height : Natural }
|
||||||
|
, default = { sec_break = 20, height = 56 }
|
||||||
|
}
|
||||||
|
|
||||||
|
let PlotGeo = { Type = { plot : PlotGeo_.Type }, default.plot = PlotGeo_::{=} }
|
||||||
|
|
||||||
|
let TableGeo_ = { Type = { sec_break : Natural }, default.sec_break = 20 }
|
||||||
|
|
||||||
|
let TableGeo =
|
||||||
|
{ Type = { table : TableGeo_.Type }, default.table = TableGeo_::{=} }
|
||||||
|
|
||||||
let FSGeo =
|
let FSGeo =
|
||||||
{ Type = { spacing : Natural, bar_pad : Natural, sep_spacing : Natural }
|
{ Type = { bar_spacing : Natural, bar_pad : Natural } //\\ SepGeo.Type
|
||||||
, default = { spacing = 20, bar_pad = 100, sep_spacing = 20 }
|
, default = { bar_spacing = 20, bar_pad = 100 } /\ SepGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let GfxGeo =
|
||||||
|
{ Type = SepGeo.Type //\\ PlotGeo.Type //\\ TextGeo.Type
|
||||||
|
, default = SepGeo::{=} /\ PlotGeo::{=} /\ TextGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let MemGeo =
|
||||||
|
{ Type = TextGeo.Type //\\ PlotGeo.Type //\\ TableGeo.Type
|
||||||
|
, default = TextGeo::{=} /\ PlotGeo::{=} /\ TableGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let ProcGeo =
|
||||||
|
{ Type = GfxGeo.Type //\\ TableGeo.Type
|
||||||
|
, default = GfxGeo::{=} /\ TableGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let PwrGeo =
|
||||||
|
{ Type = TextGeo.Type //\\ PlotGeo.Type
|
||||||
|
, default = TextGeo::{=} /\ PlotGeo::{=}
|
||||||
}
|
}
|
||||||
|
|
||||||
let FileSystem =
|
let FileSystem =
|
||||||
|
@ -17,17 +53,6 @@ let FileSystem =
|
||||||
, default.geometry = FSGeo::{=}
|
, default.geometry = FSGeo::{=}
|
||||||
}
|
}
|
||||||
|
|
||||||
let PlotGeo =
|
|
||||||
{ Type = { sec_break : Natural, height : Natural }
|
|
||||||
, default = { sec_break = 20, height = 56 }
|
|
||||||
}
|
|
||||||
|
|
||||||
let GfxGeo =
|
|
||||||
{ Type =
|
|
||||||
{ sep_spacing : Natural, text_spacing : Natural, plot : PlotGeo.Type }
|
|
||||||
, default = { sep_spacing = 20, text_spacing = 20, plot = PlotGeo::{=} }
|
|
||||||
}
|
|
||||||
|
|
||||||
let Graphics =
|
let Graphics =
|
||||||
{ Type =
|
{ Type =
|
||||||
{ dev_power : Text
|
{ dev_power : Text
|
||||||
|
@ -41,11 +66,6 @@ let Graphics =
|
||||||
, default.geometry = GfxGeo::{=}
|
, default.geometry = GfxGeo::{=}
|
||||||
}
|
}
|
||||||
|
|
||||||
let MemGeo =
|
|
||||||
{ Type = { text_spacing : Natural, plot : PlotGeo.Type }
|
|
||||||
, default = { plot = PlotGeo::{=}, text_spacing = 20 }
|
|
||||||
}
|
|
||||||
|
|
||||||
let Memory =
|
let Memory =
|
||||||
{ Type =
|
{ Type =
|
||||||
{ show_stats : Bool
|
{ show_stats : Bool
|
||||||
|
@ -58,11 +78,7 @@ let Memory =
|
||||||
}
|
}
|
||||||
|
|
||||||
let Network =
|
let Network =
|
||||||
{ Type = { geometry : { plot : PlotGeo.Type } }
|
{ Type = { geometry : PlotGeo.Type }, default.geometry = PlotGeo::{=} }
|
||||||
, default.geometry.plot = PlotGeo::{=}
|
|
||||||
}
|
|
||||||
|
|
||||||
let ProcGeo = { Type = { plot : PlotGeo.Type }, default.plot = PlotGeo::{=} }
|
|
||||||
|
|
||||||
let Processor =
|
let Processor =
|
||||||
{ Type =
|
{ Type =
|
||||||
|
@ -78,15 +94,8 @@ let Processor =
|
||||||
|
|
||||||
let RaplSpec = { name : Text, address : Text }
|
let RaplSpec = { name : Text, address : Text }
|
||||||
|
|
||||||
let PwrGeo =
|
|
||||||
{ Type = { text_spacing : Natural, plot : PlotGeo.Type }
|
|
||||||
, default = { text_spacing = 20, plot = PlotGeo::{=} }
|
|
||||||
}
|
|
||||||
|
|
||||||
let Pacman =
|
let Pacman =
|
||||||
{ Type = { geometry : { text_spacing : Natural } }
|
{ Type = { geometry : TextGeo.Type }, default.geometry = TextGeo::{=} }
|
||||||
, default.geometry.text_spacing = 20
|
|
||||||
}
|
|
||||||
|
|
||||||
let Power =
|
let Power =
|
||||||
{ Type =
|
{ Type =
|
||||||
|
@ -94,11 +103,9 @@ let Power =
|
||||||
, default.geometry = PwrGeo::{=}
|
, default.geometry = PwrGeo::{=}
|
||||||
}
|
}
|
||||||
|
|
||||||
let RWGeo = { Type = { plot : PlotGeo.Type }, default.plot = PlotGeo::{=} }
|
|
||||||
|
|
||||||
let ReadWrite =
|
let ReadWrite =
|
||||||
{ Type = { devices : List Text, geometry : RWGeo.Type }
|
{ Type = { devices : List Text, geometry : PlotGeo.Type }
|
||||||
, default.geometry = RWGeo::{=}
|
, default.geometry = PlotGeo::{=}
|
||||||
}
|
}
|
||||||
|
|
||||||
let System = Pacman
|
let System = Pacman
|
||||||
|
|
|
@ -4,8 +4,7 @@ local impure = require 'impure'
|
||||||
|
|
||||||
return function(main_state, config, common, width, point)
|
return function(main_state, config, common, width, point)
|
||||||
local geo = config.geometry
|
local geo = config.geometry
|
||||||
local SPACING = geo.spacing
|
local SPACING = geo.bar_spacing
|
||||||
local BAR_PAD = geo.bar_pad
|
|
||||||
local SEPARATOR_SPACING = geo.sep_spacing
|
local SEPARATOR_SPACING = geo.sep_spacing
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -47,7 +46,9 @@ return function(main_state, config, common, width, point)
|
||||||
point.x,
|
point.x,
|
||||||
y,
|
y,
|
||||||
width,
|
width,
|
||||||
BAR_PAD,
|
-- TODO this isn't actually padding, it would be padding if it was
|
||||||
|
-- relative to the right edge of the text column
|
||||||
|
geo.bar_pad,
|
||||||
names,
|
names,
|
||||||
SPACING,
|
SPACING,
|
||||||
12,
|
12,
|
||||||
|
|
|
@ -11,10 +11,9 @@ return function(update_freq, config, common, width, point)
|
||||||
local DIAL_X_SPACING = 40
|
local DIAL_X_SPACING = 40
|
||||||
local CACHE_Y_OFFSET = 7
|
local CACHE_Y_OFFSET = 7
|
||||||
local CACHE_X_OFFSET = 50
|
local CACHE_X_OFFSET = 50
|
||||||
local TEXT_SPACING = geo.text_spacing
|
|
||||||
local PLOT_SECTION_BREAK = geo.plot.sec_break
|
local PLOT_SECTION_BREAK = geo.plot.sec_break
|
||||||
local PLOT_HEIGHT = geo.plot.height
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
local TABLE_SECTION_BREAK = 20
|
local TABLE_SECTION_BREAK = geo.table.sec_break
|
||||||
|
|
||||||
local __math_floor = math.floor
|
local __math_floor = math.floor
|
||||||
local __string_format = string.format
|
local __string_format = string.format
|
||||||
|
@ -77,7 +76,7 @@ return function(update_freq, config, common, width, point)
|
||||||
CACHE_X,
|
CACHE_X,
|
||||||
y + CACHE_Y_OFFSET,
|
y + CACHE_Y_OFFSET,
|
||||||
CACHE_WIDTH,
|
CACHE_WIDTH,
|
||||||
TEXT_SPACING,
|
geo.text_spacing,
|
||||||
{'Page Cache', 'Buffers', 'Shared', 'Kernel Slab'},
|
{'Page Cache', 'Buffers', 'Shared', 'Kernel Slab'},
|
||||||
'%.1f%%'
|
'%.1f%%'
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,6 @@ local sys = require 'sys'
|
||||||
|
|
||||||
return function(update_freq, config, common, width, point)
|
return function(update_freq, config, common, width, point)
|
||||||
local geo = config.geometry
|
local geo = config.geometry
|
||||||
local TEXT_SPACING = geo.text_spacing
|
|
||||||
local PLOT_SEC_BREAK = geo.plot.sec_break
|
local PLOT_SEC_BREAK = geo.plot.sec_break
|
||||||
local PLOT_HEIGHT = geo.plot.height
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ return function(update_freq, config, common, width, point)
|
||||||
|
|
||||||
local mk_rate_blockspec = function(spec)
|
local mk_rate_blockspec = function(spec)
|
||||||
local f = pure.partial(mk_rate_plot, spec.name, spec.address)
|
local f = pure.partial(mk_rate_plot, spec.name, spec.address)
|
||||||
return {f, true, TEXT_SPACING}
|
return {f, true, geo.text_spacing}
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -7,15 +7,16 @@ local pure = require 'pure'
|
||||||
local __math_floor = math.floor
|
local __math_floor = math.floor
|
||||||
|
|
||||||
return function(update_freq, main_state, config, common, width, point)
|
return function(update_freq, main_state, config, common, width, point)
|
||||||
|
local geo = config.geometry
|
||||||
local DIAL_INNER_RADIUS = 30
|
local DIAL_INNER_RADIUS = 30
|
||||||
local DIAL_OUTER_RADIUS = 42
|
local DIAL_OUTER_RADIUS = 42
|
||||||
local DIAL_THICKNESS = 5.5
|
local DIAL_THICKNESS = 5.5
|
||||||
local DIAL_SPACING = 20
|
local DIAL_Y_SPACING = 20
|
||||||
local SEPARATOR_SPACING = 20
|
local SEPARATOR_SPACING = geo.sep_spacing
|
||||||
local TEXT_SPACING = 22
|
local TEXT_SPACING = geo.text_spacing
|
||||||
local PLOT_SECTION_BREAK = 23
|
local PLOT_SECTION_BREAK = geo.plot.sec_break
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
local TABLE_SECTION_BREAK = 20
|
local TABLE_SECTION_BREAK = geo.table.sec_break
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- processor state
|
-- processor state
|
||||||
|
@ -55,7 +56,7 @@ return function(update_freq, main_state, config, common, width, point)
|
||||||
(width - 2 * (DIAL_OUTER_RADIUS + config.core_padding))
|
(width - 2 * (DIAL_OUTER_RADIUS + config.core_padding))
|
||||||
* math.fmod(c - 1, core_cols) / (core_cols - 1)))
|
* math.fmod(c - 1, core_cols) / (core_cols - 1)))
|
||||||
local dial_y = y + DIAL_OUTER_RADIUS +
|
local dial_y = y + DIAL_OUTER_RADIUS +
|
||||||
(2 * DIAL_OUTER_RADIUS + DIAL_SPACING)
|
(2 * DIAL_OUTER_RADIUS + DIAL_Y_SPACING)
|
||||||
* math.floor((c - 1) / core_cols)
|
* math.floor((c - 1) / core_cols)
|
||||||
return {
|
return {
|
||||||
loads = common.make_compound_dial(
|
loads = common.make_compound_dial(
|
||||||
|
@ -115,8 +116,8 @@ return function(update_freq, main_state, config, common, width, point)
|
||||||
end
|
end
|
||||||
return common.mk_acc(
|
return common.mk_acc(
|
||||||
width,
|
width,
|
||||||
(DIAL_OUTER_RADIUS * 2 + DIAL_SPACING) * config.core_rows
|
(DIAL_OUTER_RADIUS * 2 + DIAL_Y_SPACING) * config.core_rows
|
||||||
- DIAL_SPACING,
|
- DIAL_Y_SPACING,
|
||||||
update,
|
update,
|
||||||
static,
|
static,
|
||||||
dynamic
|
dynamic
|
||||||
|
|
Loading…
Reference in New Issue