ENH update to lua 5.3

This commit is contained in:
Nathan Dwarshuis 2019-09-01 15:34:10 -04:00
parent 7125292168
commit d1c31f1f38
5 changed files with 50 additions and 47 deletions

View File

@ -148,7 +148,7 @@ local update = function(cr)
local used_percent = (MEM_TOTAL_KB - memfree_kb - cached_kb - buffers_kb - slab_reclaimable_kb) / MEM_TOTAL_KB
Dial.set(dial, used_percent)
CriticalText.set(total_used, cr, Util.round(used_percent * 100))
CriticalText.set(total_used, cr, Util.round_to_string(used_percent * 100))
local cache_theta = (DIAL_THETA_0 - DIAL_THETA_1) / MEM_TOTAL_KB * memfree_kb + DIAL_THETA_1
__cairo_path_destroy(cache_arc.path)

View File

@ -9,6 +9,8 @@ local LabelPlot = require 'LabelPlot'
local Table = require 'Table'
local Util = require 'Util'
local __string_format = string.format
local CORETEMP_PATH = '/sys/devices/platform/coretemp.0/hwmon/hwmon%i/%s'
local NUM_PHYSICAL_CORES = 4
@ -28,7 +30,6 @@ local _MODULE_Y_ = 614
local _DIAL_INNER_RADIUS_ = 30
local _DIAL_OUTER_RADIUS_ = 42
local _DIAL_SPACING_ = 1
local _TEXT_Y_OFFSET_ = 15
local _SEPARATOR_SPACING_ = 20
local _TEXT_SPACING_ = 22
local _PLOT_SECTION_BREAK_ = 23
@ -201,22 +202,25 @@ local update = function(cr)
freq_sum = freq_sum + Util.conky_numeric(conky_freqs[t])
end
CriticalText.set(core.coretemp_text, cr, Util.round(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
local process_glob = Util.execute_cmd('ps -A -o s')
--subtract one from running b/c ps will always be "running"
Text.set(process.value, cr, (char_count(process_glob, 'R') - 1)..' | '..
char_count(process_glob, 'S')..' | '..
char_count(process_glob, 'D')..' | '..
char_count(process_glob, 'T')..' | '..
char_count(process_glob, 'Z'))
Text.set(process.value, cr,
__string_format('%s | %s | %s | %s | %s',
(char_count(process_glob, 'R') - 1),
char_count(process_glob, 'S'),
char_count(process_glob, 'D'),
char_count(process_glob, 'T'),
char_count(process_glob, 'Z')))
Text.set(ave_freq.value, cr, Util.round(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')
local load_percent = Util.round(load_sum / NUM_PHYSICAL_CORES / NUM_THREADS_PER_CORE, 2)
CriticalText.set(total_load.value, cr, load_percent * 100)
CriticalText.set(total_load.value, cr,
Util.round_to_string(load_percent * 100))
LabelPlot.update(plot, load_percent)

View File

@ -101,5 +101,4 @@ M.TRANSPARENT_BLACK = Color.init{hex_rgba = 0x000000, alpha = 0.7}
M = Util.set_finalizer(M, function() print('Cleaning up Patterns.lua') end)
return M