def calculate_total_active(self):
        all_cores = set(xrange(self.cores))
        self.total = [[] for _ in all_cores]
        self.active = [[] for _ in all_cores]
        with open(self.infile, "r") as fh:
            # parsing logic:
            # - keep spinning through lines until see the cpu summary line
            #   (taken to indicate start of new record).
            # - extract values for individual cores after the summary line,
            #   keeping  track of seen cores until no more lines match 'cpu\d+'
            #   pattern.
            # - For every core not seen in this record, pad zeros.
            # - Loop
            try:
                while True:
                    line = fh.next()
                    if not line.startswith('cpu '):
                        continue

                    seen_cores = set([])
                    line = fh.next()
                    match = self.cpuid_regex.match(line)
                    while match:
                        cpu_id = int(match.group(1))
                        seen_cores.add(cpu_id)
                        times = map(int, line.split()[1:])  # first column is the cpu_id
                        self.total[cpu_id].append(sum(times))
                        self.active[cpu_id].append(sum(times) - times[self.idle_time_index])
                        line = fh.next()
                        match = self.cpuid_regex.match(line)

                    for unseen_core in all_cores - seen_cores:
                        self.total[unseen_core].append(0)
                        self.active[unseen_core].append(0)
            except StopIteration:  # EOF
                pass
Return a formula representation of an DIV instruction.
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/instrumentation/coreutil/__init__.py/Calculator.calculate_total_active--crossover with--dataset/ETHPy150Open programa-stic/barf-project/barf/barf/core/smt/smttranslator.py/SmtTranslator._translate_div