model_analyzer/monitor/remote_monitor.py
def _collect_records(self):
        """
        This function will organize the metrics responses
        and creat Records out of them
        """

        records = []

        for response in self._metrics_responses:
            metrics = text_string_to_metric_families(response)
            processed_gpu_used_memory = False
            calculate_free_memory_after_pass = False
            gpu_memory_used_bytes = None
            for metric in metrics:
                if metric.name in self.gpu_metrics and self.gpu_metrics[
                        metric.name] in self._metrics:
                    for sample in metric.samples:
                        if sample.name == 'nv_gpu_memory_used_bytes':
                            processed_gpu_used_memory = True
                            gpu_memory_used_bytes = sample.value
                            self._create_and_add_record(
                                records, sample, gpu_memory_used_bytes // 1.0e6)
                        elif sample.name == 'nv_gpu_memory_total_bytes':
                            if processed_gpu_used_memory:
                                self._create_and_add_record(
                                    records, sample,
                                    (sample.value - gpu_memory_used_bytes) //
                                    1.0e6)
                            else:
                                total_memory_metric = metric
                                calculate_free_memory_after_pass = True
                        elif sample.name == 'nv_gpu_utilization':
                            self._create_and_add_record(records, sample,
                                                        sample.value * 100)
                        else:
                            self._create_and_add_record(records, sample,
                                                        sample.value)
            if calculate_free_memory_after_pass:
                for sample in total_memory_metric.samples:
                    self._create_and_add_record(
                        records, sample,
                        (sample.value - gpu_memory_used_bytes) // 1.0e6)

        return records

        This function will organize the metrics responses
        and creat Records out of them
        
This function will organize the metrics responses
and creat Records out of them
This function will organize the metrics responses and creat Records out of them
def _collect_records(self):
        records = []
        for response in self._metrics_responses:
            metrics = text_string_to_metric_families(response)
            processed_gpu_used_memory = False
            calculate_free_memory_after_pass = False
            gpu_memory_used_bytes = None
            for metric in metrics:
                if metric.name in self.gpu_metrics and self.gpu_metrics[
                        metric.name] in self._metrics:
                    for sample in metric.samples:
                        if sample.name == 'nv_gpu_memory_used_bytes':
                            processed_gpu_used_memory = True
                            gpu_memory_used_bytes = sample.value
                            self._create_and_add_record(
                                records, sample, gpu_memory_used_bytes // 1.0e6)
                        elif sample.name == 'nv_gpu_memory_total_bytes':
                            if processed_gpu_used_memory:
                                self._create_and_add_record(
                                    records, sample,
                                    (sample.value - gpu_memory_used_bytes) //
                                    1.0e6)
                            else:
                                total_memory_metric = metric
                                calculate_free_memory_after_pass = True
                        elif sample.name == 'nv_gpu_utilization':
                            self._create_and_add_record(records, sample,
                                                        sample.value * 100)
                        else:
                            self._create_and_add_record(records, sample,
                                                        sample.value)
            if calculate_free_memory_after_pass:
                for sample in total_memory_metric.samples:
                    self._create_and_add_record(
                        records, sample,
                        (sample.value - gpu_memory_used_bytes) // 1.0e6)
        return records
def _collect_records ( self ) : records = [ ] for response in self . _metrics_responses : metrics = text_string_to_metric_families ( response ) processed_gpu_used_memory = False calculate_free_memory_after_pass = False gpu_memory_used_bytes = None for metric in metrics : if metric . name in self . gpu_metrics and self . gpu_metrics [ metric . name ] in self . _metrics : for sample in metric . samples : if sample . name == 'nv_gpu_memory_used_bytes' : processed_gpu_used_memory = True gpu_memory_used_bytes = sample . value self . _create_and_add_record ( records , sample , gpu_memory_used_bytes // 1.0e6 ) elif sample . name == 'nv_gpu_memory_total_bytes' : if processed_gpu_used_memory : self . _create_and_add_record ( records , sample , ( sample . value - gpu_memory_used_bytes ) // 1.0e6 ) else : total_memory_metric = metric calculate_free_memory_after_pass = True elif sample . name == 'nv_gpu_utilization' : self . _create_and_add_record ( records , sample , sample . value * 100 ) else : self . _create_and_add_record ( records , sample , sample . value ) if calculate_free_memory_after_pass : for sample in total_memory_metric . samples : self . _create_and_add_record ( records , sample , ( sample . value - gpu_memory_used_bytes ) // 1.0e6 ) return records
This function will organize the metrics responses
and creat Records out of them
This function will organize the metrics responses and creat Records out of them
"""
        This function will organize the metrics responses
        and creat Records out of them
        """
self