def _print_dma_transfer_matrics(self, term, lock, start_x, start_y): XBUtil.print_section_heading(term, lock, "DMA Transfer Matrics", start_y) table_offset = 1 if self._df == None: print_warning(term, lock, start_y + table_offset, "Data unavailable. Acceleration image not loaded") return table_offset + 1 try: dma_metrics = self._df['board']['direct_memory_accesses']['metrics'] except: XBUtil.print_warning(term, lock, start_y + table_offset, "Data unavailable. Acceleration image not loaded") return table_offset + 1 header = [ "", "Channel", "Host-to-Card", "Card-to-Host"] format = ["right", "right", "right", "right"] data = [] dma_metrics = self._df['board']['direct_memory_accesses']['metrics'] for i in range(len(dma_metrics)): line = [] line.append(str(i)) line.append(dma_metrics[i]['channel_id']) line.append(XBUtil.convert_size(int(dma_metrics[i]['host_to_card_bytes'], 16))) line.append(XBUtil.convert_size(int(dma_metrics[i]['card_to_host_bytes'], 16))) data.append(line) table = XBUtil.Table(header, data, format) ascii_table = table.create_table() XBUtil.indented_print(term, lock, ascii_table, 3, start_y + table_offset) table_offset += len(ascii_table) return table_offset
def _print_dma_transfer_metrics(self, term, lock, start_x, start_y, page): XBUtil.print_section_heading(term, lock, "DMA Transfer Metrics", start_y) offset = 1 if self._df == None: print_warning(term, lock, start_y + offset, "Data unavailable. Acceleration image not loaded") return offset + 1 header = ["", "Channel", "Host-to-Card", "Card-to-Host"] format = ["right", "right", "right", "right"] data = [] dma_metrics = [] try: dma_metrics = self._df['board']['direct_memory_accesses'][ 'metrics'] except: XBUtil.print_warning( term, lock, start_y + offset, "Data unavailable. Acceleration image not loaded") return offset + 1 for i in range(self.report_length): line = [] # The current element to be parsed depends on what page has been requested index = i + (page * self.report_length) # Ensure that our index does not exceed the input data size. This may happen on the last page if (index < len(dma_metrics)): dma_metric = dma_metrics[index] line.append(str(i)) line.append(dma_metric['channel_id']) line.append( XBUtil.convert_size( int(dma_metric['host_to_card_bytes'], self.hexadecimal_converion))) line.append( XBUtil.convert_size( int(dma_metric['card_to_host_bytes'], self.hexadecimal_converion))) data.append(line) # If the index exceeds the input data size leave the for loop as everything is populated on the # last page else: break if (not data): XBUtil.print_warning(term, lock, start_y + offset, "Data unavailable") return offset + 1 table = XBUtil.Table(header, data, format) ascii_table = table.create_table() XBUtil.indented_print(term, lock, ascii_table, 3, start_y + offset) offset += len(ascii_table) return offset
def _print_mem_topology(self, term, lock, start_x, start_y): XBUtil.print_section_heading(term, lock, "Memory Topology", start_y) table_offset = 1 if self._df == None: print_warning(term, lock, start_y + table_offset, "Data unavailable. Acceleration image not loaded") return table_offset + 1 try: memories = self._df['board']['memory']['memories'] except: XBUtil.print_warning(term, lock, start_y + table_offset, "Data unavailable. Acceleration image not loaded") return table_offset + 1 header = [ "", "Tag", "Type", "Temp (C)", "Size", "Mem Usage", "BO Count"] format = ["right", "left", "left", "right", "right", "right", "right"] data = [] memories = self._df['board']['memory']['memories'] for i in range(len(memories)): line = [] line.append(str(i)) line.append(memories[i]['tag']) line.append(memories[i]['type']) line.append(memories[i]['extended_info']['temperature_C'] if 'temperature_C' in memories[i]['extended_info'] else "--") line.append(XBUtil.convert_size(int(memories[i]['range_bytes'],16))) line.append(XBUtil.convert_size(int(memories[i]['extended_info']['usage']['buffer_objects_count'],0))) line.append(memories[i]['extended_info']['usage']['buffer_objects_count']) data.append(line) table = XBUtil.Table(header, data, format) ascii_table = table.create_table() XBUtil.indented_print(term, lock, ascii_table, 3, start_y + table_offset) table_offset += len(ascii_table) return table_offset
def _print_mem_topology(self, term, lock, start_x, start_y, page): XBUtil.print_section_heading(term, lock, "Memory Topology", start_y) offset = 1 if self._df == None: print_warning(term, lock, start_y + offset, "Data unavailable. Acceleration image not loaded") return offset + 1 header = [ "", "Tag", "Type", "Temp (C)", "Size", "Mem Usage", "Utilization", "BO Count" ] format = [ "right", "left", "left", "right", "right", "right", "right", "right" ] data = [] memories = [] try: memories = self._df['board']['memory']['memories'] except: XBUtil.print_warning( term, lock, start_y + offset, "Data unavailable. Acceleration image not loaded") return offset + 1 for i in range(self.report_length): line = [] # The current data element to be parsed depends on what page has been requested index = i + (page * self.report_length) # Ensure that our index does not exceed the data size. This may happen on the last page if (index < len(memories)): line.append(str(index)) memory = memories[index] line.append(memory['tag']) line.append(memory['type']) line.append(memory['extended_info']['temperature_C'] if 'temperature_C' in memory['extended_info'] else "--") line.append( XBUtil.convert_size( int(memory['range_bytes'], self.hexadecimal_converion))) line.append( XBUtil.convert_size( int( memory['extended_info']['usage'] ['buffer_objects_count'], 0))) size = int(memory['range_bytes'], self.hexadecimal_converion) if size == 0 or memory['enabled'] == "false": line.append("-- ") else: usage = int( memory['extended_info']['usage']['allocated_bytes'], 0) line.append(XBUtil.get_percentage(usage, size)) line.append( memory['extended_info']['usage']['buffer_objects_count']) data.append(line) # If the index exceeds the input data size leave the for loop as everything is populated on the # last page else: break if (not data): XBUtil.print_warning(term, lock, start_y + offset, "Data unavailable") return offset + 1 table = XBUtil.Table(header, data, format) ascii_table = table.create_table() XBUtil.indented_print(term, lock, ascii_table, 3, start_y + offset) offset += len(ascii_table) return offset