mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-08 06:00:54 +00:00
sysprof: fix category and weights for drawings
This commit is contained in:
@ -46,13 +46,13 @@ static GParamSpec *properties [N_PROPS];
|
|||||||
static void
|
static void
|
||||||
sysprof_flame_graph_snapshot_node (GtkSnapshot *snapshot,
|
sysprof_flame_graph_snapshot_node (GtkSnapshot *snapshot,
|
||||||
SysprofCallgraphNode *node,
|
SysprofCallgraphNode *node,
|
||||||
guint64 weight,
|
|
||||||
const graphene_rect_t *area,
|
const graphene_rect_t *area,
|
||||||
double row_height,
|
double row_height,
|
||||||
double min_width,
|
double min_width,
|
||||||
const GdkRGBA *default_color,
|
const GdkRGBA *default_color,
|
||||||
int depth)
|
int depth)
|
||||||
{
|
{
|
||||||
|
SysprofCallgraphCategory category;
|
||||||
const GdkRGBA *color;
|
const GdkRGBA *color;
|
||||||
GdkRGBA fallback;
|
GdkRGBA fallback;
|
||||||
|
|
||||||
@ -60,7 +60,9 @@ sysprof_flame_graph_snapshot_node (GtkSnapshot *snapshot,
|
|||||||
g_assert (node != NULL);
|
g_assert (node != NULL);
|
||||||
g_assert (area != NULL);
|
g_assert (area != NULL);
|
||||||
|
|
||||||
if (!(color = sysprof_callgraph_category_get_color (node->category)) || color->alpha == 0)
|
category = SYSPROF_CALLGRAPH_CATEGORY_UNMASK (node->category);
|
||||||
|
|
||||||
|
if (!(color = sysprof_callgraph_category_get_color (category)) || color->alpha == 0)
|
||||||
{
|
{
|
||||||
fallback = *default_color;
|
fallback = *default_color;
|
||||||
fallback.alpha -= depth * .005,
|
fallback.alpha -= depth * .005,
|
||||||
@ -77,11 +79,15 @@ sysprof_flame_graph_snapshot_node (GtkSnapshot *snapshot,
|
|||||||
if (node->children != NULL)
|
if (node->children != NULL)
|
||||||
{
|
{
|
||||||
graphene_rect_t child_area;
|
graphene_rect_t child_area;
|
||||||
|
guint64 weight = 0;
|
||||||
|
|
||||||
child_area.origin.x = area->origin.x;
|
child_area.origin.x = area->origin.x;
|
||||||
child_area.origin.y = area->origin.y;
|
child_area.origin.y = area->origin.y;
|
||||||
child_area.size.height = area->size.height - row_height;
|
child_area.size.height = area->size.height - row_height;
|
||||||
|
|
||||||
|
for (SysprofCallgraphNode *child = node->children; child; child = child->next)
|
||||||
|
weight += child->count;
|
||||||
|
|
||||||
for (SysprofCallgraphNode *child = node->children; child; child = child->next)
|
for (SysprofCallgraphNode *child = node->children; child; child = child->next)
|
||||||
{
|
{
|
||||||
double ratio = child->count / (double)weight;
|
double ratio = child->count / (double)weight;
|
||||||
@ -94,11 +100,8 @@ sysprof_flame_graph_snapshot_node (GtkSnapshot *snapshot,
|
|||||||
else
|
else
|
||||||
child_area.size.width = width;
|
child_area.size.width = width;
|
||||||
|
|
||||||
child_area.size.width = area->origin.x + area->size.width - child_area.origin.x;
|
|
||||||
|
|
||||||
sysprof_flame_graph_snapshot_node (snapshot,
|
sysprof_flame_graph_snapshot_node (snapshot,
|
||||||
child,
|
child,
|
||||||
weight,
|
|
||||||
&child_area,
|
&child_area,
|
||||||
row_height,
|
row_height,
|
||||||
min_width,
|
min_width,
|
||||||
@ -116,7 +119,6 @@ sysprof_flame_graph_snapshot (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
SysprofFlameGraph *self = (SysprofFlameGraph *)widget;
|
SysprofFlameGraph *self = (SysprofFlameGraph *)widget;
|
||||||
SysprofColorIter iter;
|
SysprofColorIter iter;
|
||||||
guint64 weight = 0;
|
|
||||||
double row_height;
|
double row_height;
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_FLAME_GRAPH (self));
|
g_assert (SYSPROF_IS_FLAME_GRAPH (self));
|
||||||
@ -128,12 +130,8 @@ sysprof_flame_graph_snapshot (GtkWidget *widget,
|
|||||||
sysprof_color_iter_init (&iter);
|
sysprof_color_iter_init (&iter);
|
||||||
row_height = gtk_widget_get_height (widget) / (double)self->callgraph->height;
|
row_height = gtk_widget_get_height (widget) / (double)self->callgraph->height;
|
||||||
|
|
||||||
for (SysprofCallgraphNode *child = self->callgraph->root.children; child; child = child->next)
|
|
||||||
weight += child->count;
|
|
||||||
|
|
||||||
sysprof_flame_graph_snapshot_node (snapshot,
|
sysprof_flame_graph_snapshot_node (snapshot,
|
||||||
&self->callgraph->root,
|
&self->callgraph->root,
|
||||||
weight,
|
|
||||||
&GRAPHENE_RECT_INIT (0, 0,
|
&GRAPHENE_RECT_INIT (0, 0,
|
||||||
gtk_widget_get_width (widget),
|
gtk_widget_get_width (widget),
|
||||||
gtk_widget_get_height (widget)),
|
gtk_widget_get_height (widget)),
|
||||||
|
|||||||
Reference in New Issue
Block a user