Merge branch 'tmp'

This commit is contained in:
Nathan Dwarshuis 2020-01-28 20:11:22 -05:00
commit 17ca811255
2 changed files with 52 additions and 21 deletions

2
core

@ -1 +1 @@
Subproject commit 6a6996e3c02f8491132e91fe59d0e9dc5148358c Subproject commit 7962fea2442ec51c1e1b30b2822b11959bbbf7d6

View File

@ -18,6 +18,13 @@ local NUM_THREADS_PER_CORE = 2
local NUM_ROWS = 5 local NUM_ROWS = 5
local HWP_PATHS = {}
for i = 1, NUM_ROWS do
HWP_PATHS[i] = '/sys/devices/system/cpu/cpu' .. i ..
'/cpufreq/energy_performance_preference'
end
local TABLE_CONKY = {} local TABLE_CONKY = {}
for r = 1, NUM_ROWS do for r = 1, NUM_ROWS do
@ -103,24 +110,29 @@ end
local _RIGHT_X_ = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH local _RIGHT_X_ = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH
local _PROCESS_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 process = { local hwp = {
label = _G_Widget_.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _PROCESS_Y_, y = _HWP_Y_,
text = 'R | S | D | T | Z' text = 'HWP Preference'
}, },
value = _G_Widget_.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _PROCESS_Y_, y = _HWP_Y_,
x_align = 'right', x_align = 'right',
<<<<<<< HEAD
text_color = _G_Patterns_.PURPLE, text_color = _G_Patterns_.PURPLE,
text = '<R> | <S> | <D> | <T> | <Z>' text = '<R> | <S> | <D> | <T> | <Z>'
=======
text_color = _G_Patterns_.BLUE,
text = '<hwp_pref>'
>>>>>>> tmp
} }
} }
local _FREQ_Y_ = _PROCESS_Y_ + _TEXT_SPACING_ local _FREQ_Y_ = _HWP_Y_ + _TEXT_SPACING_
local ave_freq = { local ave_freq = {
label = _G_Widget_.Text{ label = _G_Widget_.Text{
@ -202,20 +214,39 @@ local update = function(cr)
freq_sum = freq_sum + Util.conky_numeric(conky_freqs[t]) freq_sum = freq_sum + Util.conky_numeric(conky_freqs[t])
end end
CriticalText.set(core.coretemp_text, cr, Util.round_to_string(0.001 * Util.read_file(core.coretemp_path, nil, '*n'))) CriticalText.set(
core.coretemp_text, cr,
Util.round_to_string(
0.001 * Util.read_file(core.coretemp_path, nil, '*n')))
end end
-- trimming the string actually helps performance -- read HWP of first cpu, then test all others to see if they match
local process_glob = Util.execute_cmd('ps -A -o s h | tr -d "I\n"') local hwp_pref = Util.read_file(HWP_PATHS[1], nil, "*l")
local mixed = nil
local i = 2
-- subtract one from running b/c ps will always be "running" while not mixed and i <= #HWP_PATHS do
Text.set(process.value, cr, if hwp_pref ~= Util.read_file(HWP_PATHS[i], nil, '*l') then
__string_format('%s | %s | %s | %s | %s', mixed = 0
(char_count(process_glob, 'R') - 1), end
char_count(process_glob, 'S'), i = i + 1
char_count(process_glob, 'D'), end
char_count(process_glob, 'T'),
char_count(process_glob, 'Z'))) if mixed then
Text.set(hwp.value, cr, "Mixed")
elseif hwp_pref == "power" then
Text.set(hwp.value, cr, "Power")
elseif hwp_pref == "balance_power" then
Text.set(hwp.value, cr, "Bal. Power")
elseif hwp_pref == "balance_performance" then
Text.set(hwp.value, cr, "Bal. Performance")
elseif hwp_pref == "performance" then
Text.set(hwp.value, cr, "Performance")
elseif hwp_pref == "default" then
Text.set(hwp.value, cr, "Default")
else
Text.set(hwp.value, cr, "Unknown")
end
Text.set(ave_freq.value, cr, Util.round_to_string(freq_sum / NUM_PHYSICAL_CORES / NUM_THREADS_PER_CORE) .. ' MHz') Text.set(ave_freq.value, cr, Util.round_to_string(freq_sum / NUM_PHYSICAL_CORES / NUM_THREADS_PER_CORE) .. ' MHz')
@ -253,7 +284,7 @@ _FREQ_Y_ = nil
_LOAD_Y_ = nil _LOAD_Y_ = nil
_RIGHT_X_ = nil _RIGHT_X_ = nil
_SEP_Y_ = nil _SEP_Y_ = nil
_PROCESS_Y_ = nil _HWP_Y_ = nil
_PLOT_Y_ = nil _PLOT_Y_ = nil
local draw_static = function(cr) local draw_static = function(cr)
@ -266,7 +297,7 @@ local draw_static = function(cr)
CompoundDial.draw_static(this_core.dials, cr) CompoundDial.draw_static(this_core.dials, cr)
end end
Text.draw(process.label, cr) Text.draw(hwp.label, cr)
Text.draw(ave_freq.label, cr) Text.draw(ave_freq.label, cr)
Line.draw(separator, cr) Line.draw(separator, cr)
@ -285,7 +316,7 @@ local draw_dynamic = function(cr)
CriticalText.draw(this_core.coretemp_text, cr) CriticalText.draw(this_core.coretemp_text, cr)
end end
Text.draw(process.value, cr) Text.draw(hwp.value, cr)
Text.draw(ave_freq.value, cr) Text.draw(ave_freq.value, cr)
CriticalText.draw(total_load.value, cr) CriticalText.draw(total_load.value, cr)