/* reset a node to its original state */ static void reset_stat_node(stat_node *node) { stat_node *child; burst_bucket *bucket; node->counter = 0; node->total = 0; node->minvalue = G_MAXINT; node->maxvalue = G_MININT; node->st_flags = 0; while (node->bh) { bucket = node->bh; node->bh = bucket->next; g_free(bucket); } node->bh = (burst_bucket*)g_malloc0(sizeof(burst_bucket)); node->bt = node->bh; node->bcount = 0; node->max_burst = 0; node->burst_time = -1.0; if (node->children) { for (child = node->children; child; child = child->next ) reset_stat_node(child); } if(node->st->cfg->reset_node) { node->st->cfg->reset_node(node); } }
/* reset the whole stats_tree */ extern void stats_tree_reset(void *p) { stats_tree *st = (stats_tree *)p; st->start = -1.0; st->elapsed = 0.0; reset_stat_node(&st->root); if (st->cfg->reset_tree) { st->cfg->reset_tree(st); } }
/* reset a node to its original state */ static void reset_stat_node(stat_node *node) { stat_node *child; if (node->children) { for (child = node->children; child; child = child->next ) reset_stat_node(child); } node->counter = 0; if(node->st->cfg->reset_node) { node->st->cfg->reset_node(node); } }