Created
June 26, 2017 01:56
-
-
Save zhouyuan/38fa7dd5b9db35a218654163c69c68e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/analyzer/analyzer.py b/analyzer/analyzer.py | |
index 52b601f..7b0ab4b 100644 | |
--- a/analyzer/analyzer.py | |
+++ b/analyzer/analyzer.py | |
@@ -39,6 +39,7 @@ class Analyzer: | |
self.cluster["head"] = self.all_conf_data.get("head") | |
self.cluster["diskformat"] = self.all_conf_data.get("disk_format", dotry=True) | |
self.cluster["client"] = self.all_conf_data.get_list("list_client") | |
+ self.cluster["client_disk"] = self.all_conf_data.get_list("client_disk") | |
self.cluster["osds"] = self.all_conf_data.get_list("list_server") | |
self.cluster["mons"] = self.all_conf_data.get_list("list_mon") | |
self.cluster["rgw"] = self.all_conf_data.get_list("rgw_server") | |
@@ -240,7 +241,7 @@ class Analyzer: | |
''' | |
result = { | |
tab1: { | |
- table1: { | |
+ table1: { | |
row1: { | |
column1: [value], column2: [value] , ... | |
} | |
@@ -270,7 +271,7 @@ class Analyzer: | |
def format_result_for_visualizer(self, data): | |
output_sort = OrderedDict() | |
- monitor_interval = int(self.cluster["monitor_interval"]) | |
+ monitor_interval = int(self.cluster["monitor_interval"]) | |
output_sort["summary"] = OrderedDict() | |
res = re.search('^(\d+)-(\w+)-(\w+)-(\w+)-(\w+)-(\w+)-(\w+)-(\d+)-(\d+)-(\w+)$',data["session_name"]) | |
if not res: | |
@@ -280,7 +281,7 @@ class Analyzer: | |
diskformat = common.parse_disk_format( self.cluster['diskformat'] ) | |
phase_name_map_for_disk = {} | |
for typename in diskformat: | |
- phase_name_map_for_disk[typename] = "iostat" | |
+ phase_name_map_for_disk[typename] = "iostat" | |
phase_name_map = {"cpu": "sar", "memory": "sar", "nic": "sar", "vdisk": "iostat" } | |
phase_name_map.update( phase_name_map_for_disk ) | |
@@ -781,7 +782,7 @@ class Analyzer: | |
output_list = common.parse_disk_format( self.cluster['diskformat'] ) | |
for i in range(len(output_list)): | |
disk_list=[] | |
- for osd_journal in common.get_list(self.all_conf_data.get_list(node)): | |
+ for osd_journal in common.get_list(self.all_conf_data.get_list(node)): | |
tmp_dev_name = osd_journal[i].split('/')[2] | |
if 'nvme' in tmp_dev_name: | |
tmp_dev_name = common.parse_nvme( tmp_dev_name ) | |
@@ -793,15 +794,26 @@ class Analyzer: | |
for disk in self.cluster["vclient_disk"]: | |
vdisk_list.append( disk.split('/')[2] ) | |
output_list = ["vdisk"] | |
+ elif node in self.cluster["client"]: | |
+ print "AAAAA", node | |
+ cdisk_list = [] | |
+ for disk in self.cluster["client_disk"]: | |
+ print "BBB", disk | |
+ cdisk_list.append( disk.split('/')[2] ) | |
+ output_list = ["cdisk"] | |
+ | |
# get total second | |
runtime = common.bash("grep 'Device' "+path+" | wc -l ").strip() | |
for output in output_list: | |
- if output != "vdisk": | |
- disk_list = " ".join(dict_diskformat[output]) | |
- disk_num = len(list(set(dict_diskformat[output]))) | |
- else: | |
+ if output == "cdisk": | |
+ disk_list = " ".join(cdisk_list) | |
+ disk_num = len(cdisk_list) | |
+ elif output == "vdisk": | |
disk_list = " ".join(vdisk_list) | |
disk_num = len(vdisk_list) | |
+ else: #osds | |
+ disk_list = " ".join(dict_diskformat[output]) | |
+ disk_num = len(list(set(dict_diskformat[output]))) | |
stdout = common.bash( "grep 'Device' -m 1 "+path+" | awk -F\"Device:\" '{print $2}'; cat "+path+" | awk -v dev=\""+disk_list+"\" -v line="+runtime+" 'BEGIN{split(dev,dev_arr,\" \");dev_count=0;for(k in dev_arr){count[k]=0;dev_count+=1};for(i=1;i<=line;i++)for(j=1;j<=NF;j++){res_arr[i,j]=0}}{for(k in dev_arr)if(dev_arr[k]==$1){cur_line=count[k];for(j=2;j<=NF;j++){res_arr[cur_line,j]+=$j;}count[k]+=1;col=NF}}END{for(i=1;i<=line;i++){for(j=2;j<=col;j++)printf (res_arr[i,j]/dev_count)\"\"FS; print \"\"}}'") | |
result[output] = common.convert_table_to_2Dlist(stdout) | |
result[output]["disk_num"] = disk_num | |
@@ -919,7 +931,7 @@ class Analyzer: | |
output_fio_data['%s_runtime' % io_pattern] /= list_len | |
result[dirname] = {} | |
result[dirname]["fio"] = output_fio_data | |
- | |
+ | |
self.workpool.enqueue_data( ["process_fio_data", result] ) | |
return result | |
@@ -1030,7 +1042,7 @@ class WorkPool: | |
def wait_all(self): | |
running_proc = self.running_process | |
self.common.printout("LOG","Waiting %d Processes to be done" % len(running_proc)) | |
- | |
+ | |
for proc in running_proc: | |
proc.join() | |
self.running_process.remove(proc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment