add dcache fs

This commit is contained in:
petrucci4prez 2018-02-10 13:41:10 -05:00
parent 851840d03b
commit 72e6e9b367
3 changed files with 32 additions and 34 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "core"] [submodule "core"]
path = core path = core
url = ssh://gitlab@gitlab-host/conky/core.git url = gitolite:conky/core.git

View File

@ -6,7 +6,7 @@ local Util = require 'Util'
local __string_match = string.match local __string_match = string.match
local _FS_PATHS_ = {'/', '/boot', '/var', '/home', '/mnt/data', '/usr/local/opt'} local _FS_PATHS_ = {'/', '/boot', '/var', '/home', '/mnt/data', '/mnt/dcache', '/usr/local/opt'}
local _MODULE_Y_ = 165 local _MODULE_Y_ = 165
local _SPACING_ = 20 local _SPACING_ = 20
local _BAR_PAD_ = 100 local _BAR_PAD_ = 100
@ -29,6 +29,7 @@ local labels = _G_Widget_.TextColumn{
'var', 'var',
'home', 'home',
'data', 'data',
'dcache',
'lopt' 'lopt'
} }

View File

@ -1,10 +1,9 @@
local Text = require 'Text' local Text = require 'Text'
local TextColumn = require 'TextColumn'
local Line = require 'Line' local Line = require 'Line'
local ScalePlot = require 'ScalePlot' local ScalePlot = require 'ScalePlot'
local Util = require 'Util' local Util = require 'Util'
local _MODULE_Y_ = 328 local _MODULE_Y_ = 348
local _SEPARATOR_SPACING_ = 20 local _SEPARATOR_SPACING_ = 20
local _TEXT_SPACING_ = 20 local _TEXT_SPACING_ = 20
local _PLOT_SEC_BREAK_ = 20 local _PLOT_SEC_BREAK_ = 20
@ -29,26 +28,23 @@ local header = _G_Widget_.Header{
local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
local pp01 = { local dram_igpu = {
labels = _G_Widget_.TextColumn{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_, text = 'DRAM | iGPU'
'Core',
'iGPU'
}, },
values = _G_Widget_.TextColumn{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_,
x_align = 'right', x_align = 'right',
text_color = _G_Patterns_.BLUE, text_color = _G_Patterns_.BLUE,
append_end = ' W', append_end = ' W',
num_rows = 2 text = '<dram_igpu>'
} }
} }
local _SEP_Y_ = header.bottom_y + _TEXT_SPACING_ + _SEPARATOR_SPACING_ local _SEP_Y_ = header.bottom_y + _SEPARATOR_SPACING_
local separator = _G_Widget_.Line{ local separator = _G_Widget_.Line{
p1 = {x = _G_INIT_DATA_.RIGHT_X, y = _SEP_Y_}, p1 = {x = _G_INIT_DATA_.RIGHT_X, y = _SEP_Y_},
@ -80,17 +76,17 @@ local pkg0 = {
} }
} }
local _DRAM_Y_ = _PKG0_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_ local _CORE_Y_ = _PKG0_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_
local dram = { local pp01 = {
label = _G_Widget_.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _DRAM_Y_, y = _CORE_Y_,
text = 'DRAM' text = 'DRAM'
}, },
value = _G_Widget_.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _DRAM_Y_, y = _CORE_Y_,
x_align = 'right', x_align = 'right',
text_color = _G_Patterns_.BLUE, text_color = _G_Patterns_.BLUE,
text = '<dram>', text = '<dram>',
@ -98,14 +94,14 @@ local dram = {
}, },
plot = _G_Widget_.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _DRAM_Y_ + _PLOT_SEC_BREAK_, y = _CORE_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = power_label_function, y_label_func = power_label_function,
} }
} }
local _BATTERY_DRAW_Y_ = _DRAM_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_ local _BATTERY_DRAW_Y_ = _CORE_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_
local battery_draw = { local battery_draw = {
label = _G_Widget_.Text{ label = _G_Widget_.Text{
@ -144,20 +140,21 @@ local update = function(cr, update_frequency, is_using_ac)
local igpu_uj_cnt = Util.read_file(IGPU_PATH, nil, '*n') local igpu_uj_cnt = Util.read_file(IGPU_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')
TextColumn.set(pp01.values, cr, 1, Util.precision_round_to_string( Text.set(dram_igpu.value, cr,
calculate_power(cr, prev_core_uj_cnt, core_uj_cnt, update_frequency), 3)) Util.precision_round_to_string(
calculate_power(cr, prev_dram_uj_cnt, dram_uj_cnt, update_frequency), 3)
TextColumn.set(pp01.values, cr, 2, Util.precision_round_to_string( ..' | '..
Util.precision_round_to_string(
calculate_power(cr, prev_igpu_uj_cnt, igpu_uj_cnt, update_frequency), 3)) calculate_power(cr, prev_igpu_uj_cnt, igpu_uj_cnt, update_frequency), 3))
local pkg0_power = calculate_power(cr, prev_pkg0_uj_cnt, pkg0_uj_cnt, update_frequency) local pkg0_power = calculate_power(cr, prev_pkg0_uj_cnt, pkg0_uj_cnt, update_frequency)
local dram_power = calculate_power(cr, prev_dram_uj_cnt, dram_uj_cnt, update_frequency) local core_power = calculate_power(cr, prev_core_uj_cnt, core_uj_cnt, update_frequency)
Text.set(pkg0.value, cr, Util.precision_round_to_string(pkg0_power, 3)) Text.set(pkg0.value, cr, Util.precision_round_to_string(pkg0_power, 3))
ScalePlot.update(pkg0.plot, cr, pkg0_power) ScalePlot.update(pkg0.plot, cr, pkg0_power)
Text.set(dram.value, cr, Util.precision_round_to_string(dram_power, 3)) Text.set(pp01.value, cr, Util.precision_round_to_string(core_power, 3))
ScalePlot.update(dram.plot, cr, dram_power) ScalePlot.update(pp01.plot, cr, core_power)
prev_pkg0_uj_cnt = pkg0_uj_cnt prev_pkg0_uj_cnt = pkg0_uj_cnt
prev_core_uj_cnt = core_uj_cnt prev_core_uj_cnt = core_uj_cnt
@ -185,7 +182,7 @@ _PLOT_HEIGHT_ = nil
_RIGHT_X_ = nil _RIGHT_X_ = nil
_SEP_Y_ = nil _SEP_Y_ = nil
_PKG0_Y_ = nil _PKG0_Y_ = nil
_DRAM_Y_ = nil _CORE_Y_ = nil
_BATTERY_DRAW_Y_ = nil _BATTERY_DRAW_Y_ = nil
local draw = function(cr, current_interface, update_frequency, is_using_ac) local draw = function(cr, current_interface, update_frequency, is_using_ac)
@ -195,8 +192,8 @@ local draw = function(cr, current_interface, update_frequency, is_using_ac)
Text.draw(header.text, cr) Text.draw(header.text, cr)
Line.draw(header.underline, cr) Line.draw(header.underline, cr)
TextColumn.draw(pp01.labels, cr) Text.draw(dram_igpu.label, cr)
TextColumn.draw(pp01.values, cr) Text.draw(dram_igpu.value, cr)
Line.draw(separator, cr) Line.draw(separator, cr)
@ -204,9 +201,9 @@ local draw = function(cr, current_interface, update_frequency, is_using_ac)
Text.draw(pkg0.value, cr) Text.draw(pkg0.value, cr)
ScalePlot.draw(pkg0.plot, cr) ScalePlot.draw(pkg0.plot, cr)
Text.draw(dram.label, cr) Text.draw(pp01.label, cr)
Text.draw(dram.value, cr) Text.draw(pp01.value, cr)
ScalePlot.draw(dram.plot, cr) ScalePlot.draw(pp01.plot, cr)
Text.draw(battery_draw.label, cr) Text.draw(battery_draw.label, cr)
Text.draw(battery_draw.value, cr) Text.draw(battery_draw.value, cr)