diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2005-02-27 16:55:24 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2005-02-27 16:55:24 +0000 |
commit | 93c46dde912e0f393989fd2a3e50dc0349be9631 (patch) | |
tree | 10e8a934441d70617b5b64fd760887800706176f /tap-stats_tree.c | |
parent | f2375c312737476024e659fa6d965a4c0580ed50 (diff) |
Several fixes to the stats_tree
- Avoid creating a copy of every branch at reinitialization
this used to cause some GTK warnings and a leakage of tree nodes
- propperly check the optarg to avoid getting junk in the filter text
this caused a crash
svn path=/trunk/; revision=13534
Diffstat (limited to 'tap-stats_tree.c')
-rw-r--r-- | tap-stats_tree.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tap-stats_tree.c b/tap-stats_tree.c index a09bf637b1..2c85abcd92 100644 --- a/tap-stats_tree.c +++ b/tap-stats_tree.c @@ -45,15 +45,17 @@ struct _tree_pres { static void draw_stats_tree(void *psp) { stats_tree *st = psp; GString* s; + gchar* fmt; stat_node* child; s = g_string_new("\n===================================================================\n"); - - g_string_sprintfa(s,"Statistics for %s\n===================================================================\n", - st->name); + fmt = g_strdup_printf(" %%s%%-%us%%12s\t%%12s\t%%12s\n",stats_branch_max_name_len(&st->root,0)); + g_string_sprintfa(s,fmt,"",st->name,"value","rate","percent"); + g_free(fmt); + g_string_sprintfa(s,"-------------------------------------------------------------------\n"); for (child = st->root.children; child; child = child->next ) { - stat_branch_to_str(child,s,1); + stat_branch_to_str(child,s,0); } s = g_string_append(s,"\n===================================================================\n"); |