コード例 #1
0
ファイル: execute.py プロジェクト: rjl493456442/detector
    def slave(self, shareQueue, count, sharedLst, services, lock):
        logger.info(current_process())
        # obtain all request infomation
        while True:
            item = shareQueue.get()
            count.value = count.value + 1
            if item == 'Done':
                break
            else:
                # handle item
                tree = Tree(item['serviceId'], item['total_time'],
                            item['datetime'], item['thread_name'])
                method_lst = item['method_lst']
                for method in method_lst:
                    tree.insert(Node(method))
                # the invalid means there exists some node its children execution time larger than the total time
                # discard the invalid tree
                if tree.check_validation() is False:
                    continue
                tree.calcu_statistic()
                # tree hash
                tree.root.getHash()
                if item['serviceId'] in self.services.keys():
                    treeLst = self.services[item['serviceId']]
                    treeLst.append(tree)
                    self.services[item['serviceId']] = treeLst
                else:
                    treeLst = [tree]
                    self.services[item['serviceId']] = treeLst
            # create sub process to merge call tree
        self.startUpMerge()
        self.clearUp()
        # return to main process
        while self.finalTreeCollection.empty() is False:
            sharedLst.append(self.finalTreeCollection.get())

        logger.info("%s-%s" % (current_process(), "Done"))
コード例 #2
0
ファイル: execute.py プロジェクト: rjl493456442/detector
    def slave(self, shareQueue, count, sharedLst, services, lock):
        logger.info(current_process())
        # obtain all request infomation
        while True:
            item = shareQueue.get()
            count.value = count.value + 1
            if item == 'Done':
                break
            else:
                # handle item
                tree = Tree(item['serviceId'], item['total_time'], item['datetime'], item['thread_name'])
                method_lst = item['method_lst']
                for method in method_lst:
                   tree.insert(Node(method))
                # the invalid means there exists some node its children execution time larger than the total time
                # discard the invalid tree
                if tree.check_validation() is False:
                    continue
                tree.calcu_statistic()
                # tree hash
                tree.root.getHash()
                if item['serviceId'] in self.services.keys():
                    treeLst = self.services[item['serviceId']]
                    treeLst.append(tree)
                    self.services[item['serviceId']] = treeLst
                else:
                    treeLst = [tree]
                    self.services[item['serviceId']] = treeLst
            # create sub process to merge call tree
        self.startUpMerge()
        self.clearUp()
        # return to main process
        while self.finalTreeCollection.empty() is False:
            sharedLst.append(self.finalTreeCollection.get())

        logger.info("%s-%s" % (current_process(), "Done") )