示例#1
0
    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
示例#2
0
    def _print_memory_usage(self, term, lock, start_x, start_y):
        XBUtil.print_section_heading(term, lock, "Device Memory Usage", start_y)
        table_offset = 1

        if self._df == None:
            XBUtil.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

        mem_usage = []
        for memory in memories:
            size = int(memory['range_bytes'], 16)
            if size == 0 or memory['enabled'] == "false":
                continue
            name = memory['tag']
            usage = int(memory['extended_info']['usage']['allocated_bytes'], 0)
            mem_usage.append("%-16s %s" % (name, XBUtil.progress_bar(usage * 100 / size)))

        XBUtil.indented_print(term, lock, mem_usage, 3, start_y + table_offset)
        table_offset += len(mem_usage)
        return table_offset
示例#3
0
    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
示例#4
0
    def _print_cu_info(self, term, lock, start_x, start_y, page):
        XBUtil.print_section_heading(term, lock, "Compute Usage", start_y)
        table_offset = 1
        if self._df is None:
            XBUtil.print_warning(term, lock, start_y + table_offset, "Data unavailable. Acceleration image not loaded")
            return table_offset + 1

        with lock:
            term.location(3, start_y+table_offset)
            print("Xclbin UUID: %s" % self._df['dynamic_regions'][0]['xclbin_uuid'])
            table_offset += 2

        header = [     "", "Name", "Base Address", "Usage", "Status", "Type"]
        format = ["right", "left",        "right", "right", "center", "center"]
        data = []

        cus = []
        try:
            cus = self._df['dynamic_regions'][0]['compute_units']
        except:
            XBUtil.print_warning(term, lock, start_y + table_offset, "Data unavailable. Acceleration image not loaded")
            return table_offset + 1

        # Each page should display however many items a report page can hold
        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(cus)):
                line.append(str(index))
                cus_element = cus[index]
                line.append(cus_element['name'])
                line.append(cus_element['base_address'])
                line.append(cus_element['usage'])
                line.append(cus_element['status']['bit_mask'])
                line.append(cus_element['type'])
                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 len(data) != 0:
            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
示例#5
0
    def _print_memory_usage(self, term, lock, start_x, start_y, page):
        XBUtil.print_section_heading(term, lock, "Device Memory Usage",
                                     start_y)
        offset = 1

        if self._df == None:
            XBUtil.print_warning(
                term, lock, start_y + offset,
                "Data unavailable. Acceleration image not loaded")
            return offset + 1

        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):
            # 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(memories)):
                memory = memories[index]
                size = int(memory['range_bytes'], self.hexadecimal_converion)
                if size == 0 or memory['enabled'] == "false":
                    continue
                name = memory['tag']
                usage = int(
                    memory['extended_info']['usage']['allocated_bytes'], 0)
                data.append("%-16s %s" %
                            (name, XBUtil.progress_bar(usage * 100 / size)))
            # 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

        XBUtil.indented_print(term, lock, data, 3, start_y + offset)
        offset += len(data)
        return offset
示例#6
0
    def _print_cu_info(self, term, lock, start_x, start_y):
        XBUtil.print_section_heading(term, lock, "Compute Usage", start_y)
        table_offset = 1
        if self._df is None:
            XBUtil.print_warning(
                term, lock, start_y + table_offset,
                "Data unavailable. Acceleration image not loaded")
            return table_offset + 1

        try:
            cus = self._df['dynamic_regions'][0]['compute_units']
        except:
            XBUtil.print_warning(
                term, lock, start_y + table_offset,
                "Data unavailable. Acceleration image not loaded")
            return table_offset + 1

        with lock:
            term.location(3, start_y + table_offset)
            print("Xclbin UUID: %s" %
                  self._df['dynamic_regions'][0]['xclbin_uuid'])
            table_offset += 2

        header = ["", "Name", "Base Address", "Usage", "Status", "Type"]
        format = ["right", "left", "right", "right", "center", "center"]
        data = []

        cus = self._df['dynamic_regions'][0]['compute_units']
        for i in range(len(cus)):
            line = []
            line.append(str(i))
            line.append(cus[i]['name'])
            line.append(cus[i]['base_address'])
            line.append(cus[i]['usage'])
            line.append(cus[i]['status']['bit_mask'])
            line.append(cus[i]['type'])

            data.append(line)

        if len(data) != 0:
            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
示例#7
0
    def print_report(self, term, lock, start_x, start_y):
        XBUtil.print_section_heading(term, lock, self.report_name(), start_y)
        offset = 1

        if len(self._df) == 0:
            print_warning(term, lock, start_y + offset,
                          "Data unavailable. Acceleration image not loaded")
            return offset

        power_buf = [
            'Power     : %s Watts' % self._df['Power'],
            'Max Power : %s Watts' % self._df['Max Power'],
            'Warning   : %s' % self._df['Warning']
        ]

        XBUtil.indented_print(term, lock, power_buf, 3, start_y + offset)
        offset += len(power_buf)
        return offset
示例#8
0
    def print_report(self, term, lock, start_x, start_y, page):
        XBUtil.print_section_heading(term, lock, self.report_name(), start_y)
        offset = 1

        if len(self._df) == 0:
            print_warning(term, lock, start_y + offset,
                          "Data unavailable. Acceleration image not loaded")
            return offset + 1

        if (self.page_count == 0):
            XBUtil.print_warning(
                term, lock, start_y + offset,
                "Data unavailable. Acceleration image not loaded")
            return offset + 1

        # Create the complete power buffer
        all_data = [
            'Power     : %s Watts' % self._df['Power'],
            'Max Power : %s Watts' % self._df['Max Power'],
            'Warning   : %s' % self._df['Warning']
        ]

        # Extract the data elements to be displayed on the requested page
        page_offset = page * self.report_length
        # The upper offset is bounded by the size of the full power buffer
        upper_page_offset = min(self.report_length + page_offset,
                                len(all_data))
        data = all_data[page_offset:upper_page_offset]

        if (not data):
            XBUtil.print_warning(term, lock, start_y + offset,
                                 "Data unavailable")
            return offset + 1

        XBUtil.indented_print(term, lock, data, 3, start_y + offset)
        offset += len(data)
        return offset
示例#9
0
    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
示例#10
0
    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