mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Don't compute the total field.
Sat Nov 5 12:39:33 2005 Soeren Sandmann <sandmann@redhat.com> * profile.c (add_trace_to_tree): Don't compute the total field. * profile.h (struct ProfileDescendant): Remove 'total' field. * sysprof.c: Delete DESCENDANTS_TOTAL column and everything related to it. * profile.c: Remove commented out code * sfile.c (handle_text): Don't copy the text
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
cf761a2a70
commit
1f5b6ff38c
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
Sat Nov 5 12:39:33 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* profile.c (add_trace_to_tree): Don't compute the total field.
|
||||
|
||||
* profile.h (struct ProfileDescendant): Remove 'total' field.
|
||||
|
||||
* sysprof.c: Delete DESCENDANTS_TOTAL column and everything
|
||||
related to it.
|
||||
|
||||
* profile.c: Remove commented out code
|
||||
|
||||
* sfile.c (handle_text): Don't copy the text
|
||||
|
||||
2005-11-04 Soren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* collector.[ch]: Add copyright statement.
|
||||
|
||||
56
profile.c
56
profile.c
@ -165,25 +165,6 @@ profile_save (Profile *profile,
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
make_hash_table (Node *node, GHashTable *table)
|
||||
{
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
g_assert (node->object);
|
||||
|
||||
node->next = g_hash_table_lookup (table, node->object);
|
||||
g_hash_table_insert (table, node->object, node);
|
||||
|
||||
g_assert (node->siblings != (void *)0x11);
|
||||
|
||||
make_hash_table (node->siblings, table);
|
||||
make_hash_table (node->children, table);
|
||||
}
|
||||
#endif
|
||||
|
||||
Profile *
|
||||
profile_load (const char *filename, GError **err)
|
||||
{
|
||||
@ -266,12 +247,9 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||
{
|
||||
GList *list;
|
||||
GPtrArray *nodes_to_unmark = g_ptr_array_new ();
|
||||
GPtrArray *nodes_to_unmark_recursive = g_ptr_array_new ();
|
||||
ProfileDescendant *parent = NULL;
|
||||
int i, len;
|
||||
|
||||
GPtrArray *seen_objects = g_ptr_array_new ();
|
||||
|
||||
for (list = trace; list != NULL; list = list->next)
|
||||
{
|
||||
StackNode *node = list->data;
|
||||
@ -288,12 +266,12 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||
if (!match)
|
||||
{
|
||||
ProfileDescendant *seen_tree_node;
|
||||
ProfileDescendant *n;
|
||||
|
||||
/* Have we seen this object further up the tree? */
|
||||
seen_tree_node = NULL;
|
||||
for (i = 0; i < seen_objects->len; ++i)
|
||||
for (n = parent; n != NULL; n = n->parent)
|
||||
{
|
||||
ProfileDescendant *n = seen_objects->pdata[i];
|
||||
if (n->name == node->address)
|
||||
seen_tree_node = n;
|
||||
}
|
||||
@ -303,7 +281,7 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||
ProfileDescendant *node;
|
||||
|
||||
g_assert (parent);
|
||||
|
||||
|
||||
for (node = parent; node != seen_tree_node->parent; node = node->parent)
|
||||
{
|
||||
node->non_recursion -= size;
|
||||
@ -311,10 +289,6 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||
}
|
||||
|
||||
match = seen_tree_node;
|
||||
|
||||
g_ptr_array_remove_range (seen_objects, 0, seen_objects->len);
|
||||
for (node = match; node != NULL; node = node->parent)
|
||||
g_ptr_array_add (seen_objects, node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,13 +298,10 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||
|
||||
match->name = node->address;
|
||||
match->non_recursion = 0;
|
||||
match->total = 0;
|
||||
match->self = 0;
|
||||
match->children = NULL;
|
||||
match->marked_non_recursive = 0;
|
||||
match->marked_total = FALSE;
|
||||
match->parent = parent;
|
||||
|
||||
match->siblings = *tree;
|
||||
*tree = match;
|
||||
}
|
||||
@ -342,25 +313,13 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||
++match->marked_non_recursive;
|
||||
}
|
||||
|
||||
if (!match->marked_total)
|
||||
{
|
||||
g_ptr_array_add (nodes_to_unmark_recursive, match);
|
||||
|
||||
match->total += size;
|
||||
match->marked_total = TRUE;
|
||||
}
|
||||
|
||||
if (!list->next)
|
||||
match->self += size;
|
||||
|
||||
g_ptr_array_add (seen_objects, match);
|
||||
|
||||
tree = &(match->children);
|
||||
parent = match;
|
||||
}
|
||||
|
||||
g_ptr_array_free (seen_objects, TRUE);
|
||||
|
||||
len = nodes_to_unmark->len;
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
@ -369,16 +328,7 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||
tree_node->marked_non_recursive = 0;
|
||||
}
|
||||
|
||||
len = nodes_to_unmark_recursive->len;
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
ProfileDescendant *tree_node = nodes_to_unmark_recursive->pdata[i];
|
||||
|
||||
tree_node->marked_total = FALSE;
|
||||
}
|
||||
|
||||
g_ptr_array_free (nodes_to_unmark, TRUE);
|
||||
g_ptr_array_free (nodes_to_unmark_recursive, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -40,14 +40,12 @@ struct ProfileDescendant
|
||||
{
|
||||
char * name;
|
||||
guint self;
|
||||
guint total;
|
||||
guint non_recursion;
|
||||
ProfileDescendant * parent;
|
||||
ProfileDescendant * siblings;
|
||||
ProfileDescendant * children;
|
||||
|
||||
int marked_non_recursive;
|
||||
int marked_total;
|
||||
};
|
||||
|
||||
struct ProfileCaller
|
||||
|
||||
59
sfile.c
59
sfile.c
@ -569,10 +569,6 @@ state_transition_text (const State *state, SType *type, SType *target_type)
|
||||
*/
|
||||
return transition->to;
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
g_print ("transition: %d (%s)\n", transition->kind, transition->element);
|
||||
#endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -633,24 +629,29 @@ struct BuildContext
|
||||
GArray *instructions;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
is_all_blank (const char *text)
|
||||
{
|
||||
while (g_ascii_isspace (*text))
|
||||
text++;
|
||||
|
||||
return (*text == '\0');
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_number (const char *text, int *number)
|
||||
{
|
||||
char *end;
|
||||
int result;
|
||||
char *stripped;
|
||||
gboolean retval;
|
||||
|
||||
stripped = g_strstrip (g_strdup (text));
|
||||
result = strtol (stripped, &end, 10);
|
||||
|
||||
retval = (*end == '\0');
|
||||
result = strtol (text, &end, 10);
|
||||
|
||||
retval = is_all_blank (end);
|
||||
|
||||
if (retval && number)
|
||||
*number = result;
|
||||
|
||||
g_free (stripped);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -914,6 +915,15 @@ decode_text (const char *text, char **decoded)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
skip_whitespace (const char *text)
|
||||
{
|
||||
while (g_ascii_isspace (*text))
|
||||
text++;
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_text (GMarkupParseContext *context,
|
||||
const gchar *text,
|
||||
@ -923,24 +933,22 @@ handle_text (GMarkupParseContext *context,
|
||||
{
|
||||
BuildContext *build = user_data;
|
||||
Instruction instruction;
|
||||
char *free_me;
|
||||
SType target_type;
|
||||
|
||||
text = free_me = g_strstrip (g_strdup (text));
|
||||
|
||||
if (strlen (text) == 0)
|
||||
goto out;
|
||||
|
||||
if (*text == '\0')
|
||||
return;
|
||||
|
||||
text = skip_whitespace (text);
|
||||
if (*text == '\0')
|
||||
return;
|
||||
|
||||
build->state = state_transition_text (build->state, &instruction.type, &target_type);
|
||||
if (!build->state)
|
||||
{
|
||||
int line, ch;
|
||||
g_markup_parse_context_get_position (context, &line, &ch);
|
||||
#if 0
|
||||
g_print ("line: %d char: %d\n", line, ch);
|
||||
#endif
|
||||
set_invalid_content_error (err, "Unexpected text data");
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
instruction.name = NULL;
|
||||
@ -953,7 +961,7 @@ handle_text (GMarkupParseContext *context,
|
||||
if (!get_number (text, &instruction.u.pointer.target_id))
|
||||
{
|
||||
set_invalid_content_error (err, "Contents '%s' of pointer element is not a number", text);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -961,7 +969,7 @@ handle_text (GMarkupParseContext *context,
|
||||
if (!get_number (text, &instruction.u.integer.value))
|
||||
{
|
||||
set_invalid_content_error (err, "Contents '%s' of integer element not a number", text);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -969,7 +977,7 @@ handle_text (GMarkupParseContext *context,
|
||||
if (!decode_text (text, &instruction.u.string.value))
|
||||
{
|
||||
set_invalid_content_error (err, "Contents '%s' of text element is illformed", text);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -979,9 +987,6 @@ handle_text (GMarkupParseContext *context,
|
||||
}
|
||||
|
||||
g_array_append_val (build->instructions, instruction);
|
||||
|
||||
out:
|
||||
g_free (free_me);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -384,7 +384,6 @@ enum
|
||||
DESCENDANTS_NAME,
|
||||
DESCENDANTS_SELF,
|
||||
DESCENDANTS_NON_RECURSE,
|
||||
DESCENDANTS_TOTAL,
|
||||
DESCENDANTS_OBJECT
|
||||
};
|
||||
|
||||
@ -486,7 +485,6 @@ add_node (GtkTreeStore *store,
|
||||
DESCENDANTS_NAME, node->name,
|
||||
DESCENDANTS_SELF, 100 * (node->self)/(double)size,
|
||||
DESCENDANTS_NON_RECURSE, 100 * (node->non_recursion)/(double)size,
|
||||
DESCENDANTS_TOTAL, 100 * (node->total)/(double)size,
|
||||
DESCENDANTS_OBJECT, node->name,
|
||||
-1);
|
||||
|
||||
@ -509,11 +507,10 @@ fill_descendants_tree (Application *app)
|
||||
}
|
||||
|
||||
tree_store =
|
||||
gtk_tree_store_new (5,
|
||||
gtk_tree_store_new (4,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
if (app->profile)
|
||||
|
||||
Reference in New Issue
Block a user