Exemplo n.º 1
0
Arquivo: blobs.py Projeto: AMDmi3/gem5
    def render(self, cr, view, event, select, time):
        cr.save()
        cr.scale(*view.pitch.to_pair())
        cr.translate(*self.topLeft.to_pair())
        # cr.translate(*(self.size - Point(1,1)).scale(0.5).to_pair())
        half_width = self.size.x / 2.0
        cr.translate(*(self.size - Point(1.0 + half_width,1.0)).scale(0.5).
            to_pair())

        num_colours = len(self.colours)
        cr.set_line_width(view.midLineWidth / view.pitch.x)

        blob_size = (Point(half_width,0.0) +
            (self.size * Point(0.0,1.0 / num_colours)))
        blob_step = Point(0.0,1.0) * blob_size
        first_blob_centre = (Point(0.0,0.0) -
            blob_step.scale((num_colours / 2.0) - 0.5))

        cr.set_source_color(self.colour)
        cr.set_line_width(view.thinLineWidth / view.pitch.x)

        blob_proportion = 0.8

        real_blob_size = blob_size.scale(blob_proportion)

        cr.set_font_size(0.8 * blob_size.y * blob_proportion)
        cr.select_font_face('Helvetica', cairo.FONT_SLANT_NORMAL,
            cairo.FONT_WEIGHT_BOLD)

        for i in xrange(0, num_colours):
            centre = first_blob_centre + blob_step.scale(i)
            box(cr, centre, real_blob_size)

            colour_char = self.colours[i]
            if colour_char.isdigit():
                cr.set_source_color(colours.number_to_colour(
                    int(colour_char)))
                label = '...' + colour_char
            else:
                cr.set_source_color(model.special_state_colours[colour_char])
                label = model.special_state_names[colour_char]

            cr.fill_preserve()
            cr.set_source_color(self.colour)
            cr.stroke()

            xb, yb, width, height, dx, dy = cr.text_extents(label)

            text_left = (centre + (Point(0.5,0.0) * blob_size) +
                Point(0.0, height / 2.0))

            cr.move_to(*text_left.to_pair())
            cr.show_text(label)
Exemplo n.º 2
0
    def to_striped_block(self, select):
        ret = []

        if self.isFault:
            ret.append(colours.faultColour)

        if 'T' in select.ids:
            ret.append(colours.number_to_colour(self.threadId))
        if 'S' in select.ids:
            ret.append(colours.number_to_colour(self.streamSeqNum))
        if 'P' in select.ids:
            ret.append(colours.number_to_colour(self.predictionSeqNum))
        if 'L' in select.ids:
            ret.append(colours.number_to_colour(self.lineSeqNum))
        if self.fetchSeqNum != 0 and 'F' in select.ids:
            ret.append(colours.number_to_colour(self.fetchSeqNum))
        if self.execSeqNum != 0 and 'E' in select.ids:
            ret.append(colours.number_to_colour(self.execSeqNum))

        if len(ret) == 0:
            ret = [colours.unknownColour]

        if self.isFault:
            ret.append(colours.faultColour)

        return ret
Exemplo n.º 3
0
    def render(self, cr, view, event, select, time):
        cr.save()
        cr.scale(*view.pitch.to_pair())
        cr.translate(*self.topLeft.to_pair())
        # cr.translate(*(self.size - Point(1,1)).scale(0.5).to_pair())
        half_width = self.size.x / 2.0
        cr.translate(*(self.size -
                       Point(1.0 + half_width, 1.0)).scale(0.5).to_pair())

        num_colours = len(self.colours)
        cr.set_line_width(view.midLineWidth / view.pitch.x)

        blob_size = (Point(half_width, 0.0) +
                     (self.size * Point(0.0, 1.0 / num_colours)))
        blob_step = Point(0.0, 1.0) * blob_size
        first_blob_centre = (Point(0.0, 0.0) -
                             blob_step.scale((num_colours / 2.0) - 0.5))

        cr.set_source_color(self.colour)
        cr.set_line_width(view.thinLineWidth / view.pitch.x)

        blob_proportion = 0.8

        real_blob_size = blob_size.scale(blob_proportion)

        cr.set_font_size(0.8 * blob_size.y * blob_proportion)
        cr.select_font_face('Helvetica', cairo.FONT_SLANT_NORMAL,
                            cairo.FONT_WEIGHT_BOLD)

        for i in xrange(0, num_colours):
            centre = first_blob_centre + blob_step.scale(i)
            box(cr, centre, real_blob_size)

            colour_char = self.colours[i]
            if colour_char.isdigit():
                cr.set_source_color(colours.number_to_colour(int(colour_char)))
                label = '...' + colour_char
            else:
                cr.set_source_color(model.special_state_colours[colour_char])
                label = model.special_state_names[colour_char]

            cr.fill_preserve()
            cr.set_source_color(self.colour)
            cr.stroke()

            xb, yb, width, height, dx, dy = cr.text_extents(label)

            text_left = (centre + (Point(0.5, 0.0) * blob_size) +
                         Point(0.0, height / 2.0))

            cr.move_to(*text_left.to_pair())
            cr.show_text(label)
Exemplo n.º 4
0
 def to_striped_block(self, select):
     return [colours.number_to_colour(self.newStreamSeqNum),
         colours.number_to_colour(self.newPredictionSeqNum),
         colours.number_to_colour(self.newPC)]