/** Statistics about the tree. * \param player player to notify with header. * \param root pointer to root of string tree. * \param name name of string tree, for row header. */ void st_stats(dbref player, StrTree *root, const char *name) { unsigned long bytes; int maxdepth = 0, mindepth = 0, avgdepth = 0, leaves = 0; if (!root) return; bytes = (sizeof(StrNode) - BUFFER_LEN) * root->count + root->mem; st_traverse_stats(root->root, &maxdepth, &mindepth, &avgdepth, &leaves); notify_format(player, "%-10s %7d %7d %6d %4d %4d %7lu", name, (int) root->count, leaves, mindepth, maxdepth, avgdepth, bytes); }
/** Statistics about the tree. * \param player player to notify with header. * \param root pointer to root of string tree. * \param name name of string tree, for row header. */ void st_stats(dbref player, StrTree *root, const char *name) { unsigned long bytes; int maxdepth = 0, mindepth = 0, avgdepth = 0, leaves = 0; unsigned long perms = 0, nperms = 0; bytes = (sizeof(StrNode) - BUFFER_LEN) * root->count + root->mem; st_traverse_stats(root->root, &maxdepth, &mindepth, &avgdepth, &leaves, &perms, &nperms); notify_format(player, "%-10s %7d %7d %6d %4d %4d %9lu %11.3f %7lu", name, (int) root->count, leaves, mindepth, maxdepth, avgdepth, perms, ((double) nperms / (double) (root->count - perms)), bytes); }