コード例 #1
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])
コード例 #2
0
    def create_result(self):
        '''Create Results 
        '''

        for parallel in self.parallels:
            sum_dic = {}
            for iter in range(self.times):
                iozone_parallel_list = []
                iozone_temp_file = os.path.join(
                    self.tmp_dir,
                    "iozone_%s_%d_%d.out" % (self.testmode, parallel,
                                             (iter + 1)))
                iozone_dic = self.__match_index(iozone_temp_file)
                if not sum_dic:
                    sum_dic = iozone_dic.copy()
                else:
                    sum_dic = method.append_sum_dict(sum_dic, iozone_dic)
                iozone_attrib = self.create_result_node_attrib(
                    iter + 1, self.times, parallel, self.parallels)
                self.result_list.append([iozone_attrib, iozone_dic])
            if sum_dic:
                parallel_average_dic = method.append_average_dict(
                    sum_dic, self.times)
                self.result_list.append([
                    self.create_result_node_attrib("Average", self.times,
                                                   parallel, self.parallels),
                    parallel_average_dic
                ])
コード例 #3
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
                ])
コード例 #4
0
ファイル: iozone.py プロジェクト: Scemoon/lpts
 def create_result(self):
     '''Create Results 
     '''
     
     for parallel in self.parallels: 
         sum_dic = {}
         for iter in range(self.times):
             iozone_parallel_list = []
             iozone_temp_file = os.path.join(self.tmp_dir, "iozone_%s_%d_%d.out" % (self.testmode, parallel, (iter+1)))
             iozone_dic = self.__match_index(iozone_temp_file)
             if not sum_dic:
                 sum_dic = iozone_dic.copy()
             else:
                 sum_dic = method.append_sum_dict(sum_dic, iozone_dic)
             iozone_attrib = self.create_result_node_attrib(iter+1, self.times, parallel, self.parallels)
             self.result_list.append([iozone_attrib, iozone_dic])
         if sum_dic:
             parallel_average_dic = method.append_average_dict(sum_dic, self.times)
             self.result_list.append([self.create_result_node_attrib("Average", self.times, parallel, self.parallels), parallel_average_dic])
コード例 #5
0
ファイル: stream.py プロジェクト: zhyh329/lpts
 def create_result(self):
     #method.check_none(self.parallels, self.times)
     labels = ("Copy", 'Scale', 'Add', 'Triad')
             
     for parallel in self.parallels:
         sum_dic = {}
         for iter in range(self.times):
             iter_dic = {}
             tmp_result_file = os.path.join(self.tmp_dir, "stream_%d_%d.out" %(parallel, iter+1))
             if not os.path.isfile(tmp_result_file):
                 continue
             
             result_tuple = self.__search_result(tmp_result_file)
             for key, value in zip(labels, result_tuple):
                 iter_dic[key] = "%.4f" %value
             if sum_dic:
                 sum_dic = method.append_sum_dict(sum_dic, iter_dic)
             else:
                 sum_dic = iter_dic.copy()
             self.result_list.append([self.create_result_node_attrib(iter+1, self.times, parallel, self.parallels), iter_dic])
         if  sum_dic:
             average_dic = method.append_average_dict(sum_dic, self.times)
             self.result_list.append([self.create_result_node_attrib("Average", self.times, parallel, self.parallels), average_dic])
コード例 #6
0
ファイル: dbench_fio.py プロジェクト: Scemoon/lpts
 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])