Exemplo n.º 1
0
    def set_phase(self, phase):
        assert not self.stopped
        time_t = rlscope_timer.now_us()

        if self.cur_phase is not None:
            # End the previous phase
            self._add_time(self.phase_end, self.cur_phase, time_t)
        # Start the next phase
        self._add_time(self.phase_start, phase, time_t)

        self.cur_phase = phase
Exemplo n.º 2
0
 def stop(self):
     if self.stopped:
         logger.info("> Already ran UnitTestDataDumper.stop; ignoring.")
         return
     assert not self.stopped
     # self.unwrapped_prof.stop()
     time_t = rlscope_timer.now_us()
     # self.old_stop()
     self.stop_t = time_t
     self._add_time(self.phase_end, self.cur_phase, time_t)
     self.stopped = True
Exemplo n.º 3
0
 def __init__(self, pid, epoch_time_usec=None, debug=False):
     self.pid = pid
     if epoch_time_usec is None:
         epoch_time_usec = rlscope_timer.now_us()
     self.debug = debug
     self.epoch_time_usec = epoch_time_usec
     self.process_tree = get_process_tree(pid)
     self.total_resident_memory_bytes = self._sample_cpu_total_resident_memory_bytes(
         self.process_tree)
     self.cpu_util = self._sample_cpu_util()
     self.device_name = get_cpu_brand(CPU_INFO)
Exemplo n.º 4
0
def sample_gpu_utilization(machine_gpu_info, pid, debug=False):
    """
    Report a single [0..1] value representing current GPU utilization.
    Report a separate value for EACH GPU in the system.
    """
    gpus = machine_gpu_info.gpus()
    epoch_time_usec = rlscope_timer.now_us()
    gpu_utils = []
    # if debug:
    #     logger.info(pprint_msg({'sample_gpu_bytes.gpus': gpus}))
    for gpu in gpus:
        total_resident_memory_bytes = sample_gpu_total_resident_memory_bytes(
            machine_gpu_info, gpu, pid, debug=debug)
        gpu_util = GPU_as_util(
            gpu,
            epoch_time_usec=epoch_time_usec,
            total_resident_memory_bytes=total_resident_memory_bytes)
        gpu_utils.append(gpu_util)
    return gpu_utils
Exemplo n.º 5
0
 def start(self):
     assert not self.stopped
     self.start_t = rlscope_timer.now_us()