[PATCH v2 lkp-tests] /stats add proc-vmstat.rb

[Why] convert stats/proc-vmstat to proc_vmstat() of proc-vmstat.rb Signed-off-by: Lu Weitao <luweitaobe@163.com> --- stats/proc-vmstat.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 stats/proc-vmstat.rb diff --git a/stats/proc-vmstat.rb b/stats/proc-vmstat.rb new file mode 100644 index 000000000..cd252faf1 --- /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(/:?\s+/) + result[key] << value.to_i + end + + result +end -- 2.23.0

On Fri, Mar 05, 2021 at 11:45:54AM +0800, Lu Weitao wrote:
[Why] convert stats/proc-vmstat to proc_vmstat() of proc-vmstat.rb
Signed-off-by: Lu Weitao <luweitaobe@163.com> --- stats/proc-vmstat.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 stats/proc-vmstat.rb
diff --git a/stats/proc-vmstat.rb b/stats/proc-vmstat.rb new file mode 100644 index 000000000..cd252faf1 --- /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|
Show the logs what you want in there. Thanks, Xueliang
+ key, value = line.split(/:?\s+/) + result[key] << value.to_i + end + + result +end -- 2.23.0

On Mon, Mar 08, 2021 at 09:15:14AM +0800, Cao Xueliang wrote:
On Fri, Mar 05, 2021 at 11:45:54AM +0800, Lu Weitao wrote:
[Why] convert stats/proc-vmstat to proc_vmstat() of proc-vmstat.rb
Signed-off-by: Lu Weitao <luweitaobe@163.com> --- stats/proc-vmstat.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 stats/proc-vmstat.rb
diff --git a/stats/proc-vmstat.rb b/stats/proc-vmstat.rb new file mode 100644 index 000000000..cd252faf1 --- /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|
Show the logs what you want in there.
OK Thanks, Weitao
Thanks, Xueliang
+ key, value = line.split(/:?\s+/) + result[key] << value.to_i + end + + result +end -- 2.23.0
participants (2)
-
Cao Xueliang
-
Lu Weitao