def update(self) -> None:
        """
        Update the running CPU usage.

        For more info on how to set the starting moment see the class
        description.

        :return: None.
        """
        if self._first_update:
            self._process_handle = Process(os.getpid())

        assert self._process_handle is not None

        last_time = getattr(self._process_handle, "_last_sys_cpu_times", None)
        utilization = self._process_handle.cpu_percent()
        current_time = getattr(self._process_handle, "_last_sys_cpu_times", None)

        if self._first_update:
            self._first_update = False
        else:
            if current_time is None or last_time is None:
                warnings.warn(
                    "CPUUsage can't detect the elapsed time. It is "
                    "recommended to update avalanche to the latest "
                    "version."
                )
                # Fallback, shouldn't happen
                current_time = 1.0
                last_time = 0.0
            self._mean_usage.update(utilization, current_time - last_time)

        Update the running CPU usage.

        For more info on how to set the starting moment see the class
        description.

        :return: None.
        
avalanche/evaluation/metrics/cpu_usage.py