From f538bf60c15e9d03899d6e0e30c8a11c499cc6b7 Mon Sep 17 00:00:00 2001 From: Fengguang Wu Date: Sat, 21 Apr 2012 14:12:04 +0800 Subject: [PATCH] compare: fix nasty fall through error when some stats file does not exist --- compare | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/compare b/compare index 5e6e74b..356cc74 100755 --- a/compare +++ b/compare @@ -281,20 +281,25 @@ def add_dd(path) if $evaluate == "write_bw" bw = write_bw(path) # puts path, bw - return if bw == 0 - elsif $evaluate.index("nfs_") == 0 and nfs_stats(path) + valid = (bw != 0) + elsif $evaluate.index("nfs_") == 0 + valid = nfs_stats(path) eval "bw = $#{$evaluate}" - elsif $evaluate.index("cpu_") == 0 and iostat_cpu(path) + elsif $evaluate.index("cpu_") == 0 + valid = iostat_cpu(path) eval "bw = $#{$evaluate}" - elsif $evaluate.index("io_") == 0 and iostat_disk(path) + elsif $evaluate.index("io_") == 0 + valid = iostat_disk(path) eval "bw = $#{$evaluate}" - elsif is_perf_event($evaluate) and perf_stats(path) + elsif is_perf_event($evaluate) + valid = perf_stats(path) bw = $perf_event[$evaluate] - elsif vmstat(path) - eval "bw = $#{$evaluate}" else - return + valid = vmstat(path) + eval "bw = $#{$evaluate}" end + return if not valid + prefix = "" if path =~ /(.*\/)(.*)/ prefix = $1