コード例 #1
0
ファイル: mongo.py プロジェクト: janhybs/FlowRunner
    def insert_process(self, dirname, env):
        profilers = io.browse(dirname)
        profilers = lists.filter(profilers,
                                 lambda x: str(x).lower().find('info-') != -1)

        for profiler in profilers:
            json_data = read_json(profiler)
            context = self._extract_process_context(json_data)
            metrics = self._extract_process_metrics(json_data)

            context.update(dict(env=env, process=True))

            # metrics_id = self.insert_metrics(metrics.copy()).inserted_id
            # context_id = self.insert_context(context.copy()).inserted_id

            self._insert_pts_simple(',', metrics, context)

            child_context = context.copy()
            child_context.update(dict(process=False))
            if 'children' in json_data:
                whole_program = json_data['children'][0]
                self.insert_time_frame(whole_program, [],
                                       context=child_context)

        return context, metrics
コード例 #2
0
ファイル: mongo.py プロジェクト: x3mSpeedy/FlowRunner
 def _extract_environment(self, filename):
     """
     Method will process given json filename. Method will also remove entries
         having no information (like missing binaries)
     :param filename:
     :return:
     """
     json_data = read_json(filename)
     JsonPreprocessor.filter(json_data['bins'], 'missing', lambda x: bool(x))
     JsonPreprocessor.delete_props(json_data, ['bins'])
     return json_data
コード例 #3
0
ファイル: mongo.py プロジェクト: janhybs/FlowRunner
 def _extract_environment(self, filename):
     """
     Method will process given json filename. Method will also remove entries
         having no information (like missing binaries)
     :param filename:
     :return:
     """
     json_data = read_json(filename)
     JsonPreprocessor.filter(json_data['bins'], 'missing',
                             lambda x: bool(x))
     JsonPreprocessor.delete_props(json_data, ['bins'])
     return json_data
コード例 #4
0
ファイル: mongo.py プロジェクト: x3mSpeedy/FlowRunner
 def _extract_calibration(self, filename):
     """
     Method will process given json filename.
         Processing json is done by analyzing measured values in json file. Only 3 values
          (cpu, memory, combination) will be stored in db
     :rtype : dict
     :type filename: str
     """
     json_data = read_json(filename)
     return {
         'cpu': math.avg(rpluck(json_data, 'tests.for-loop.effectiveness')),
         'memory': math.avg(rpluck(json_data, 'tests.string-concat.effectiveness')),
         'complex': math.avg(rpluck(json_data, 'tests.matrix-solve.effectiveness'))
     }
コード例 #5
0
ファイル: mongo.py プロジェクト: janhybs/FlowRunner
 def _extract_calibration(self, filename):
     """
     Method will process given json filename.
         Processing json is done by analyzing measured values in json file. Only 3 values
          (cpu, memory, combination) will be stored in db
     :rtype : dict
     :type filename: str
     """
     json_data = read_json(filename)
     return {
         'cpu':
         math.avg(rpluck(json_data, 'tests.for-loop.effectiveness')),
         'memory':
         math.avg(rpluck(json_data, 'tests.string-concat.effectiveness')),
         'complex':
         math.avg(rpluck(json_data, 'tests.matrix-solve.effectiveness'))
     }
コード例 #6
0
ファイル: mongo.py プロジェクト: x3mSpeedy/FlowRunner
    def insert_process(self, dirname, env):
        profilers = io.browse(dirname)
        profilers = lists.filter(profilers, lambda x: str(x).lower().find('info-') != -1)

        for profiler in profilers:
            json_data = read_json(profiler)
            context = self._extract_process_context(json_data)
            metrics = self._extract_process_metrics(json_data)

            context.update(dict(env=env, process=True))

            # metrics_id = self.insert_metrics(metrics.copy()).inserted_id
            # context_id = self.insert_context(context.copy()).inserted_id

            self._insert_pts_simple(',', metrics, context)

            child_context = context.copy()
            child_context.update(dict(process=False))
            if 'children' in json_data:
                whole_program = json_data['children'][0]
                self.insert_time_frame(whole_program, [], context=child_context)

        return context, metrics