mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 15:10:53 +00:00
sysprof: attempt to highlight to root of flamegraph
This commit is contained in:
@ -114,6 +114,7 @@ find_node_at_coord (SysprofFlameGraph *self,
|
|||||||
double y)
|
double y)
|
||||||
{
|
{
|
||||||
FlameSearch search;
|
FlameSearch search;
|
||||||
|
FlameRectangle *ret;
|
||||||
|
|
||||||
if (self->nodes == NULL)
|
if (self->nodes == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -122,7 +123,17 @@ find_node_at_coord (SysprofFlameGraph *self,
|
|||||||
search.point.y = y;
|
search.point.y = y;
|
||||||
search.width = gtk_widget_get_width (GTK_WIDGET (self));
|
search.width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||||
|
|
||||||
return bsearch (&search, self->nodes->data, self->nodes->len, sizeof (FlameRectangle), search_compare);
|
ret = bsearch (&search, self->nodes->data, self->nodes->len, sizeof (FlameRectangle), search_compare);
|
||||||
|
|
||||||
|
if (ret == NULL)
|
||||||
|
{
|
||||||
|
/* Try to recover from pointer inbetween rows */
|
||||||
|
search.point.y -= 1;
|
||||||
|
|
||||||
|
ret = bsearch (&search, self->nodes->data, self->nodes->len, sizeof (FlameRectangle), search_compare);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -266,24 +277,29 @@ sysprof_flame_graph_snapshot (GtkWidget *widget,
|
|||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->motion_x || self->motion_y)
|
|
||||||
{
|
|
||||||
if (highlight == NULL)
|
|
||||||
highlight = find_node_at_coord (self, self->motion_x, self->motion_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_snapshot_append_node (snapshot, self->rendered);
|
gtk_snapshot_append_node (snapshot, self->rendered);
|
||||||
|
|
||||||
if (highlight)
|
if (self->motion_x || self->motion_y)
|
||||||
{
|
{
|
||||||
graphene_rect_t area;
|
double y = self->motion_y;
|
||||||
|
|
||||||
area = GRAPHENE_RECT_INIT (highlight->x / (double)G_MAXUINT16 * width,
|
if (highlight == NULL)
|
||||||
highlight->y,
|
highlight = find_node_at_coord (self, self->motion_x, y);
|
||||||
highlight->w / (double)G_MAXUINT16 * width,
|
|
||||||
highlight->h);
|
|
||||||
|
|
||||||
gtk_snapshot_append_color (snapshot, &(GdkRGBA) {1,1,1,.25}, &area);
|
while (highlight)
|
||||||
|
{
|
||||||
|
graphene_rect_t area;
|
||||||
|
|
||||||
|
area = GRAPHENE_RECT_INIT (highlight->x / (double)G_MAXUINT16 * width,
|
||||||
|
highlight->y,
|
||||||
|
highlight->w / (double)G_MAXUINT16 * width,
|
||||||
|
highlight->h);
|
||||||
|
|
||||||
|
gtk_snapshot_append_color (snapshot, &(GdkRGBA) {1,1,1,.25}, &area);
|
||||||
|
|
||||||
|
y += ROW_HEIGHT + 1;
|
||||||
|
highlight = find_node_at_coord (self, self->motion_x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user