示例#1
0
    def __match_index(self, file):

        """获取unixbench屏幕输出
       """

        result_dic = {}.fromkeys(unixbench_keys, 0)
        result_lines = lutils.read_all_lines(file)
        #  flag_dic = {}
        for parallel in self.parallels:
            re_match = "\d+ CPU\S in system; running %d parallel cop\S+ of tests" % parallel
            parallel_result_dic = result_dic.copy()
            for line in result_lines:
                if re.search(re_match, line, re.I):
                    parallel_index = result_lines.index(line)
                    paralell_result_list = [
                        self.__get_value(result_lines, parallel_index + index)
                        for index in (16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29)
                    ]
                    for l, v in zip(
                        tuple(unixbench_keys), tuple([lutils.change_type(i) for i in paralell_result_list])
                    ):
                        parallel_result_dic[l] = "%.1f" % v
                    parallel_result_attrib = self.create_result_node_attrib(
                        "Average", self.times, parallel, self.parallels
                    )
                    self.result_list.append([parallel_result_attrib, parallel_result_dic])
示例#2
0
 def create_result(self):
     '''创建result_list
        '''
     key_dic = {}
     sum_dic = {}
     
     file = os.path.join(self.tmp_dir, "bonnie.out")
     lptlog.debug("读取 %s 文件" % file)
     if not os.path.isfile(file):
         raise IOError, "open %s Error" % file
     else:
         results_lines = utils.read_all_lines(file)
     
     labels = ["name","file_size","putc","putc_cpu","put_block","put_block_cpu","rewrite","rewrite_cpu",
             "getc","getc_cpu","get_block","get_block_cpu","seeks","seeks_cpu","num_files","seq_create",
             "seq_create_cpu","seq_stat","seq_stat_cpu","seq_del","seq_del_cpu","ran_create","ran_create_cpu",
             "ran_stat","ran_stat_cpu","ran_del","ran_del_cpu" ]
     keys = labels
     keys.pop(0)
     keys.pop(0)
     keys.pop(12)
     keys = tuple(keys)
     
     iter=0
     for line in results_lines:
         fields = line.split(',')
         if len(fields) != 27:
             continue
         if fields[0] == "name":
             continue
         else:
             iter += 1
             
         lptlog.debug("line.split==27: %s" %  line)
         
         #attrib_dic = {'iter':str(iter), 'times':str(self.times), 'parallel':'1', 'parallels':'1' ,
                       #"name":fields[0], "filesize":fields[1], "num_files":fields[14]}
         attrib_dic = self.create_result_node_attrib(iter, self.times, 1, [1])
         
         #remove 多余项
         
         fields.pop(0)
         fields.pop(0)
         fields.pop(12)
         fields = tuple([utils.change_type(i) for i in fields])
         
         for l, v in zip(keys, fields):
             key_dic[l] = "%d" % v 
         
         if not sum_dic:
             sum_dic = key_dic.copy()
         else:
             sum_dic = method.append_sum_dict(sum_dic, key_dic) 
         self.result_list.append([attrib_dic, key_dic])
              
     if  sum_dic:
         parallel_average_dic = method.append_average_dict(sum_dic, self.times)
         lptlog.debug("1 并行求平均值:PASS" )
         sum_attrib_dic = self.create_result_node_attrib("Average", self.times, 1, [1])
         self.result_list.append([sum_attrib_dic, parallel_average_dic])
示例#3
0
 def __match_index(self, file):
     '''获取unixbench屏幕输出
    '''
     self.parallels = [1]
     self.times = 3
     result_dic = {}.fromkeys(x11perf_keys, 0)
     result_lines = utils.read_all_lines(file)
     for parallel in self.parallels:
         re_match = "[\d]+ CPUs in system; running %d parallel copy of tests" % parallel
         parallel_result_dic = result_dic.copy()
         for line in result_lines:
             if re.search(re_match, line, re.I):
                 parallel_index = result_lines.index(line)
                 paralell_result_list = [
                     self.__get_value(result_lines, parallel_index + index)
                     for index in (10, 11, 12, 13, 14, 15)
                 ]
                 for l, v in zip(
                         tuple(x11perf_keys),
                         tuple([
                             utils.change_type(i)
                             for i in paralell_result_list
                         ])):
                     parallel_result_dic[l] = "%.1f" % v
                 parallel_result_attrib = self.create_result_node_attrib(
                     "Average", self.times, parallel, self.parallels)
                 self.result_list.append(
                     [parallel_result_attrib, parallel_result_dic])
示例#4
0
文件: unixbench.py 项目: zhyh329/lpts
    def __match_index(self, file):
        '''获取unixbench屏幕输出
       '''

        result_dic = {}.fromkeys(unixbench_keys, 0)
        result_lines = lutils.read_all_lines(file)
        #  flag_dic = {}
        for parallel in self.parallels:
            re_match = "\d+ CPU\S in system; running %d parallel cop\S+ of tests" % parallel
            parallel_result_dic = result_dic.copy()
            for line in result_lines:
                if re.search(re_match, line, re.I):
                    parallel_index = result_lines.index(line)
                    paralell_result_list = [
                        self.__get_value(result_lines, parallel_index + index)
                        for index in (16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
                                      26, 27, 29)
                    ]
                    for l, v in zip(
                            tuple(unixbench_keys),
                            tuple([
                                lutils.change_type(i)
                                for i in paralell_result_list
                            ])):
                        parallel_result_dic[l] = "%.1f" % v
                    parallel_result_attrib = self.create_result_node_attrib(
                        "Average", self.times, parallel, self.parallels)
                    self.result_list.append(
                        [parallel_result_attrib, parallel_result_dic])
示例#5
0
    def create_result(self):
        '''创建result_list
           '''

        #labels = ("Throughtput", "clients", "max_latency")
        labels = ("Throughtput", "max_latency")
        parallelstring = ",".join(map(str, self.parallels))

        r = re.compile(
            r"Throughput\s+(\d+.\d+)\s+MB/sec\s+(\d+)\s+clients\s+\d+\s+procs\s+max_latency=(\d+.\d+)\s",
            re.I)
        for parallel in self.parallels:
            sum_dic = {}
            for iter in range(self.times):
                tmp_result_file = os.path.join(
                    self.tmp_dir,
                    "%s_%s_%s.out" % (self.tool, parallel, iter + 1))
                if not os.path.isfile(tmp_result_file):
                    lptlog.warning("%s 不存在" % tmp_result_file)
                    continue
                result_lines = utils.read_all_lines(tmp_result_file)
                for line in result_lines:
                    key_dic = {}
                    if r.match(line):
                        m = r.match(line)
                        #result_list = [m.group(1), m.group(2), m.group(3)]
                        result_list = [m.group(1), m.group(3)]
                        result_tuple = tuple(
                            [utils.change_type(i) for i in result_list])
                        for l, v in zip(labels, result_tuple):
                            key_dic[l] = "%d" % v
                        if not sum_dic:
                            sum_dic = key_dic.copy()
                        else:
                            sum_dic = method.append_sum_dict(sum_dic, key_dic)
                        self.result_list.append([
                            self.create_result_node_attrib(
                                iter + 1, self.times, parallel,
                                self.parallels), key_dic
                        ])

            if sum_dic:
                parallel_average_dic = method.append_average_dict(
                    sum_dic, self.times)
                lptlog.debug("%d 并行求平均值:PASS" % parallel)
                self.result_list.append([
                    self.create_result_node_attrib("Average", self.times,
                                                   parallel, self.parallels),
                    parallel_average_dic
                ])
示例#6
0
文件: x11perf.py 项目: Scemoon/lpts
 def __match_index(self, file):
  
     '''获取unixbench屏幕输出
    '''
     self.parallels = [1]
     self.times = 3
     result_dic = {}.fromkeys(x11perf_keys, 0)
     result_lines = utils.read_all_lines(file)
     for parallel in self.parallels:
         re_match = "[\d]+ CPUs in system; running %d parallel copy of tests" % parallel
         parallel_result_dic = result_dic.copy()
         for line in result_lines:
             if re.search(re_match, line, re.I):
                 parallel_index = result_lines.index(line)
                 paralell_result_list = [ self.__get_value(result_lines, parallel_index+index) for index in (10, 11, 12, 13, 14, 15) ]
                 for l,v in zip(tuple(x11perf_keys), tuple([utils.change_type(i) for i in paralell_result_list])):
                     parallel_result_dic[l] = "%.1f" % v
                 parallel_result_attrib = self.create_result_node_attrib("Average", self.times, parallel, self.parallels)
                 self.result_list.append([parallel_result_attrib, parallel_result_dic])
示例#7
0
 def create_result(self):
     '''创建result_list
        '''
     
     #labels = ("Throughtput", "clients", "max_latency")
     labels = ("Throughtput",  "max_latency")
     parallelstring = ",".join(map(str, self.parallels))
     
     r = re.compile(r"Throughput\s+(\d+.\d+)\s+MB/sec\s+(\d+)\s+clients\s+\d+\s+procs\s+max_latency=(\d+.\d+)\s", re.I)
     for parallel in self.parallels:
         sum_dic = {}
         for iter in range(self.times):
             tmp_result_file = os.path.join(self.tmp_dir, "%s_%s_%s.out" % (self.tool, parallel, iter+1))
             if not os.path.isfile(tmp_result_file):
                 lptlog.warning("%s 不存在" % tmp_result_file)
                 continue
             result_lines = utils.read_all_lines(tmp_result_file)
             for line in result_lines:
                 key_dic = {}
                 if r.match(line):
                     m = r.match(line)
                     #result_list = [m.group(1), m.group(2), m.group(3)]
                     result_list = [m.group(1), m.group(3)]
                     result_tuple = tuple([utils.change_type(i)for i in result_list])
                     for l, v in zip(labels, result_tuple):
                         key_dic[l] = "%d" % v
                     if not sum_dic:
                         sum_dic = key_dic.copy()
                     else:
                         sum_dic = method.append_sum_dict(sum_dic, key_dic)
                     self.result_list.append([self.create_result_node_attrib(iter+1, self.times, parallel, self.parallels), key_dic])
                     
         if  sum_dic:
             parallel_average_dic = method.append_average_dict(sum_dic, self.times)
             lptlog.debug("%d 并行求平均值:PASS" % parallel)
             self.result_list.append([self.create_result_node_attrib("Average", self.times, parallel, self.parallels), parallel_average_dic])