def _get_cgroup_measurements(self, cgroups, ru_child, result):
        """
        This method calculates the exact results for time and memory measurements.
        It is not important to call this method as soon as possible after the run.
        """
        logging.debug("Getting cgroup measurements.")

        cputime_wait = ru_child.ru_utime + ru_child.ru_stime if ru_child else 0
        cputime_cgroups = None
        if cgroups in CPUACCT:
            # We want to read the value from the cgroup.
            # The documentation warns about outdated values.
            # So we read twice with 0.1s time difference,
            # and continue reading as long as the values differ.
            # This has never happened except when interrupting the script with Ctrl+C,
            # but just try to be on the safe side here.
            tmp = cgroups.read_cputime()
            tmp2 = None
            while tmp != tmp2:
                time.sleep(0.1)
                tmp2 = tmp
                tmp = cgroups.read_cputime()
            cputime_cgroups = tmp

            # Usually cputime_cgroups seems to be 0.01s greater than cputime_wait.
            # Furthermore, cputime_wait might miss some subprocesses,
            # therefore we expect cputime_cgroups to be always greater (and more correct).
            # However, sometimes cputime_wait is a little bit bigger than cputime2.
            # For small values, this is probably because cputime_wait counts since fork,
            # whereas cputime_cgroups counts only after cgroups.add_task()
            # (so overhead from runexecutor is correctly excluded in cputime_cgroups).
            # For large values, a difference may also indicate a problem with cgroups,
            # for example another process moving our benchmarked process between cgroups,
            # thus we warn if the difference is substantial and take the larger cputime_wait value.
            if cputime_wait > 0.5 and (cputime_wait * 0.95) > cputime_cgroups:
                logging.warning(
                    'Cputime measured by wait was %s, cputime measured by cgroup was only %s, '
                    'perhaps measurement is flawed.',
                    cputime_wait, cputime_cgroups)
                result['cputime'] = cputime_wait
            else:
                result['cputime'] = cputime_cgroups

            for (core, coretime) in enumerate(cgroups.get_value(CPUACCT, 'usage_percpu').split(" ")):
                try:
                    coretime = int(coretime)
                    if coretime != 0:
                        result['cputime-cpu'+str(core)] = coretime/1000000000 # nano-seconds to seconds
                except (OSError, ValueError) as e:
                    logging.debug("Could not read CPU time for core %s from kernel: %s", core, e)

        if MEMORY in cgroups:
            # This measurement reads the maximum number of bytes of RAM+Swap the process used.
            # For more details, c.f. the kernel documentation:
            # https://www.kernel.org/doc/Documentation/cgroups/memory.txt
            memUsageFile = 'memsw.max_usage_in_bytes'
            if not cgroups.has_value(MEMORY, memUsageFile):
                memUsageFile = 'max_usage_in_bytes'
            if not cgroups.has_value(MEMORY, memUsageFile):
                logging.warning('Memory-usage is not available due to missing files.')
            else:
                try:
                    result['memory'] = int(cgroups.get_value(MEMORY, memUsageFile))
                except IOError as e:
                    if e.errno == errno.ENOTSUP: # kernel responds with operation unsupported if this is disabled
                        logging.critical(
                            "Kernel does not track swap memory usage, cannot measure memory usage."
                            " Please set swapaccount=1 on your kernel command line.")
                    else:
                        raise e

        logging.debug(
            'Resource usage of run: walltime=%s, cputime=%s, cgroup-cputime=%s, memory=%s',
            result['walltime'], cputime_wait, cputime_cgroups, result.get('memory', None))


    # --- other public functions ---
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/runexecutor.py/RunExecutor._get_cgroup_measurements/swapped operands of `in`