
5 Mar
2021
5 Mar
'21
10:11 a.m.
On Thu, Mar 04, 2021 at 09:34:05AM +0800, Luan Shengde wrote:
index 000000000..d49002801 --- /dev/null +++ b/stats/proc-vmstat.rb @@ -0,0 +1,10 @@ + +def proc_vmstat(log_lines) + result = Hash.new { |hash, key| hash[key] = [] } + log_lines.each do |line| + key, value = line.split + result[key.chomp(':')] << value.to_i
key, value = line.split(/:\s*/)
original log like: time: 1231231231 nr_free_page 88213 so, this line should be: key, value = line.split(/:?\s+/) Thanks, Weitao
result[key] << value.to_i
Thanks, Luan Shengde
+ end + + result +end -- 2.23.0