remove igpu and cache from power
This commit is contained in:
parent
8829303a92
commit
a6c2b72dc6
|
@ -9,8 +9,8 @@ local Util = require 'Util'
|
|||
local __string_match = string.match
|
||||
|
||||
local _FS_PATHS_ = {'/', '/boot', '/var', '/home', '/mnt/data', '/mnt/dcache', '/usr/local/opt'}
|
||||
local _MODULE_Y_ = 165
|
||||
local _SPACING_ = 20
|
||||
local _MODULE_Y_ = 170
|
||||
local _SPACING_ = 22
|
||||
local _BAR_PAD_ = 100
|
||||
|
||||
local FS_NUM = #_FS_PATHS_
|
||||
|
|
|
@ -7,8 +7,7 @@ local Line = require 'Line'
|
|||
local ScalePlot = require 'ScalePlot'
|
||||
local Util = require 'Util'
|
||||
|
||||
local _MODULE_Y_ = 348
|
||||
-- local _SEPARATOR_SPACING_ = 20
|
||||
local _MODULE_Y_ = 373
|
||||
local _TEXT_SPACING_ = 20
|
||||
local _PLOT_SEC_BREAK_ = 20
|
||||
local _PLOT_HEIGHT_ = 56
|
||||
|
@ -32,40 +31,13 @@ local header = _G_Widget_.Header{
|
|||
|
||||
local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
|
||||
|
||||
-- local dram_igpu = {
|
||||
-- label = _G_Widget_.Text{
|
||||
-- x = _G_INIT_DATA_.RIGHT_X,
|
||||
-- y = header.bottom_y,
|
||||
-- text = 'DRAM | iGPU'
|
||||
-- },
|
||||
-- value = _G_Widget_.Text{
|
||||
-- x = _RIGHT_X_,
|
||||
-- y = header.bottom_y,
|
||||
-- x_align = 'right',
|
||||
-- text_color = _G_Patterns_.BLUE,
|
||||
-- append_end = ' W',
|
||||
-- text = '<dram_igpu>'
|
||||
-- }
|
||||
-- }
|
||||
|
||||
-- local _SEP_Y_ = header.bottom_y + _SEPARATOR_SPACING_
|
||||
|
||||
-- local separator = _G_Widget_.Line{
|
||||
-- p1 = {x = _G_INIT_DATA_.RIGHT_X, y = _SEP_Y_},
|
||||
-- p2 = {x = _RIGHT_X_, y = _SEP_Y_}
|
||||
-- }
|
||||
|
||||
-- local _PKG0_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
|
||||
|
||||
local pkg0 = {
|
||||
labels = _G_Widget_.TextColumn{
|
||||
x = _G_INIT_DATA_.RIGHT_X,
|
||||
y = header.bottom_y,
|
||||
'Cores',
|
||||
'LLC+MC',
|
||||
'iGPU'
|
||||
label = _G_Widget_.Text{
|
||||
x = _G_INIT_DATA_.RIGHT_X,
|
||||
y = header.bottom_y,
|
||||
text = 'PKG0',
|
||||
},
|
||||
core_value = _G_Widget_.Text{
|
||||
value = _G_Widget_.Text{
|
||||
x = _RIGHT_X_,
|
||||
y = header.bottom_y,
|
||||
x_align = 'right',
|
||||
|
@ -73,36 +45,16 @@ local pkg0 = {
|
|||
text = '<core>',
|
||||
append_end = ' W',
|
||||
},
|
||||
llcmc_value = _G_Widget_.Text{
|
||||
x = _RIGHT_X_,
|
||||
y = header.bottom_y + _TEXT_SPACING_,
|
||||
x_align = 'right',
|
||||
text_color = _G_Patterns_.PURPLE,
|
||||
text = '<llcmc>',
|
||||
append_end = ' W'
|
||||
plot = _G_Widget_.ScalePlot{
|
||||
x = _G_INIT_DATA_.RIGHT_X,
|
||||
y = header.bottom_y + _PLOT_SEC_BREAK_,
|
||||
width = _G_INIT_DATA_.SECTION_WIDTH,
|
||||
height = _PLOT_HEIGHT_,
|
||||
y_label_func = power_label_function,
|
||||
},
|
||||
|
||||
igpu_value = _G_Widget_.Text{
|
||||
x = _RIGHT_X_,
|
||||
y = header.bottom_y + _TEXT_SPACING_ * 2,
|
||||
x_align = 'right',
|
||||
text_color = Patterns.YELLOW,
|
||||
text = '<igpu>',
|
||||
append_end = ' W',
|
||||
},
|
||||
plot = _G_Widget_.ScalePlot{
|
||||
x = _G_INIT_DATA_.RIGHT_X,
|
||||
y = header.bottom_y + _TEXT_SPACING_ * 2 + _PLOT_SEC_BREAK_,
|
||||
width = _G_INIT_DATA_.SECTION_WIDTH,
|
||||
height = _PLOT_HEIGHT_,
|
||||
y_label_func = power_label_function,
|
||||
{Patterns.PLOT_LINE_YELLOW, Patterns.PLOT_FILL_YELLOW},
|
||||
{Patterns.PLOT_LINE_PURPLE, Patterns.PLOT_FILL_PURPLE},
|
||||
{Patterns.PLOT_LINE_BLUE, Patterns.PLOT_FILL_BLUE}
|
||||
}
|
||||
}
|
||||
|
||||
local _CORE_Y_ = header.bottom_y + _TEXT_SPACING_ * 2 + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_
|
||||
local _CORE_Y_ = header.bottom_y + _TEXT_SPACING_ + _PLOT_SEC_BREAK_ + _PLOT_HEIGHT_
|
||||
|
||||
local dram = {
|
||||
label = _G_Widget_.Text{
|
||||
|
@ -151,30 +103,20 @@ local battery_draw = {
|
|||
}
|
||||
|
||||
local PKG0_PATH = '/sys/class/powercap/intel-rapl:0/energy_uj'
|
||||
local CORE_PATH = '/sys/class/powercap/intel-rapl:0:0/energy_uj'
|
||||
local IGPU_PATH = '/sys/class/powercap/intel-rapl:0:1/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_core_uj_cnt = Util.read_file(CORE_PATH, nil, '*n')
|
||||
local prev_igpu_uj_cnt = Util.read_file(IGPU_PATH, nil, '*n')
|
||||
local prev_dram_uj_cnt = Util.read_file(DRAM_PATH, nil, '*n')
|
||||
|
||||
local update = function(cr, update_frequency, is_using_ac)
|
||||
local pkg0_uj_cnt = Util.read_file(PKG0_PATH, nil, '*n')
|
||||
local core_uj_cnt = Util.read_file(CORE_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 pkg0_power = calculate_power(cr, prev_pkg0_uj_cnt, pkg0_uj_cnt, update_frequency)
|
||||
local core_power = calculate_power(cr, prev_core_uj_cnt, core_uj_cnt, update_frequency)
|
||||
local igpu_power = calculate_power(cr, prev_igpu_uj_cnt, igpu_uj_cnt, update_frequency)
|
||||
|
||||
Text.set(pkg0.core_value, cr, Util.precision_round_to_string(core_power, 3))
|
||||
Text.set(pkg0.igpu_value, cr, Util.precision_round_to_string(igpu_power, 3))
|
||||
Text.set(pkg0.llcmc_value, cr, Util.precision_round_to_string(pkg0_power - core_power - igpu_power, 3))
|
||||
Text.set(pkg0.value, cr, Util.precision_round_to_string(pkg0_power, 3))
|
||||
|
||||
ScalePlot.update(pkg0.plot, cr, igpu_power, pkg0_power - core_power, pkg0_power)
|
||||
ScalePlot.update(pkg0.plot, cr, pkg0_power)
|
||||
|
||||
local dram_power = calculate_power(cr, prev_dram_uj_cnt, dram_uj_cnt, update_frequency)
|
||||
|
||||
|
@ -182,8 +124,6 @@ local update = function(cr, update_frequency, is_using_ac)
|
|||
ScalePlot.update(dram.plot, cr, dram_power)
|
||||
|
||||
prev_pkg0_uj_cnt = pkg0_uj_cnt
|
||||
prev_core_uj_cnt = core_uj_cnt
|
||||
prev_igpu_uj_cnt = igpu_uj_cnt
|
||||
prev_dram_uj_cnt = dram_uj_cnt
|
||||
|
||||
if is_using_ac then
|
||||
|
@ -201,13 +141,10 @@ end
|
|||
|
||||
Patterns = nil
|
||||
_MODULE_Y_ = nil
|
||||
-- _SEPARATOR_SPACING_ = nil
|
||||
_TEXT_SPACING_ = nil
|
||||
_PLOT_SEC_BREAK_ = nil
|
||||
_PLOT_HEIGHT_ = nil
|
||||
_RIGHT_X_ = nil
|
||||
-- _SEP_Y_ = nil
|
||||
-- _PKG0_Y_ = nil
|
||||
_CORE_Y_ = nil
|
||||
_BATTERY_DRAW_Y_ = nil
|
||||
|
||||
|
@ -215,7 +152,7 @@ local draw_static = function(cr)
|
|||
Text.draw(header.text, cr)
|
||||
Line.draw(header.underline, cr)
|
||||
|
||||
TextColumn.draw(pkg0.labels, cr)
|
||||
Text.draw(pkg0.label, cr)
|
||||
|
||||
Text.draw(dram.label, cr)
|
||||
Text.draw(battery_draw.label, cr)
|
||||
|
@ -224,10 +161,7 @@ end
|
|||
local draw_dynamic = function(cr, update_frequency, is_using_ac)
|
||||
update(cr, update_frequency, is_using_ac)
|
||||
|
||||
|
||||
Text.draw(pkg0.llcmc_value, cr)
|
||||
Text.draw(pkg0.core_value, cr)
|
||||
Text.draw(pkg0.igpu_value, cr)
|
||||
Text.draw(pkg0.value, cr)
|
||||
ScalePlot.draw_dynamic(pkg0.plot, cr)
|
||||
|
||||
Text.draw(dram.value, cr)
|
||||
|
|
Loading…
Reference in New Issue