}
/*
- * Pre-Allocate 5MB of pool memory for rapid startup
+ * Pre-Allocate 2MB of pool memory for rapid startup
+ * This is about what's reported for all current dictionary
+ * attributes in the monolithic dictionary, and will go
+ * down once the dictionaries are split.
*/
- dict->pool = talloc_pool(dict, (1024 * 1024 * 5));
+ dict->pool = talloc_pool(dict, (1024 * 1024 * 2));
if (!dict->pool) goto error;
/*
unsigned int i;
size_t len;
fr_dict_attr_t const *p;
+ char flags[256];
- printf("%p - %s (%u) %s\n", da, da->name, da->attr, fr_int2str(dict_attr_types, da->type, "<INVALID>"));
+ fr_dict_snprint_flags(flags, sizeof(flags), &da->flags);
+
+ printf("[%02i] 0x%016" PRIxPTR "%*s %s(%u) %s %s\n", lvl, (unsigned long)da, lvl * 2, " ",
+ da->name, da->attr, fr_int2str(dict_attr_types, da->type, "<INVALID>"), flags);
len = talloc_array_length(da->children);
for (i = 0; i < len; i++) {
_fr_dict_dump(p, lvl + 1);
}
}
-
}
void fr_dict_dump(fr_dict_t *dict)
fr_int2str(dict_attr_types, da->type, "?Unknown?"), flags);
}
+static void _fr_dict_export(uint64_t *count, fr_dict_attr_t const *da, unsigned int lvl)
+{
+ unsigned int i;
+ size_t len;
+ fr_dict_attr_t const *p;
+ char flags[256];
+
+ fr_dict_snprint_flags(flags, sizeof(flags), &da->flags);
+
+ if (!da->flags.is_root) da_print_info_td(fr_dict_by_da(da), da);
+ (*count)++;
+
+ len = talloc_array_length(da->children);
+ for (i = 0; i < len; i++) {
+ for (p = da->children[i]; p; p = p->next) {
+ _fr_dict_export(count, p, lvl + 1);
+ }
+ }
+}
+
+static uint64_t fr_dict_export(fr_dict_t *dict)
+{
+ uint64_t count = 0;
+
+ _fr_dict_export(&count, fr_dict_root(dict), 0);
+
+ return count;
+}
+
int main(int argc, char *argv[])
{
char const *dict_dir = DICTDIR;
fr_dict_t **dict_p = dicts;
do {
- fr_dict_dump(*dict_p);
+ uint64_t count;
+
+ count = fr_dict_export(*dict_p);
+ DEBUG2("Total attr %" PRIu64, count);
+ DEBUG2("Total size %zu (bytes)", talloc_total_size(*dict_p));
} while (++dict_p < dict_end);
}