summaryrefslogtreecommitdiff
path: root/src/talloc/hieralloc.c
diff options
context:
space:
mode:
authorDavid Li <davidxli@google.com>2011-01-24 10:55:37 -0800
committerDavid Li <davidxli@google.com>2011-01-24 10:55:37 -0800
commitb286f63e168037c1dbf9a10614dd6a1cd6b9ef69 (patch)
tree13895d1f261e28fa98c73f69547513d08806521c /src/talloc/hieralloc.c
parentd50d9a90a0df4d706421850e17c0fbd85bf710ee (diff)
Fix bug with scalar/vector expansion.
Diffstat (limited to 'src/talloc/hieralloc.c')
-rw-r--r--src/talloc/hieralloc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/talloc/hieralloc.c b/src/talloc/hieralloc.c
index 9e518b2..488c522 100644
--- a/src/talloc/hieralloc.c
+++ b/src/talloc/hieralloc.c
@@ -437,5 +437,30 @@ void hieralloc_report(const void * ptr, FILE * file)
{
if (NULL == ptr)
ptr = &global_header + 1;
+ fputs("hieralloc_report: \n", file);
_hieralloc_report(get_header(ptr), file, 0);
}
+
+static void _hieralloc_report_brief(const hieralloc_header_t * header, FILE * file, unsigned * data)
+{
+ data[0]++;
+ data[1] += header->size;
+ data[2] += header->childCount;
+ data[3] += header->refCount;
+ const hieralloc_header_t * child = header->child;
+ while (child)
+ {
+ _hieralloc_report_brief(child, file, data);
+ child = child->nextSibling;
+ }
+}
+
+void hieralloc_report_brief(const void * ptr, FILE * file)
+{
+ if (NULL == ptr)
+ ptr = &global_header + 1;
+ unsigned data [4] = {0};
+ _hieralloc_report_brief(get_header(ptr), file, data);
+ fprintf(file, "hieralloc_report total: count=%d size=%d child=%d ref=%d \n",
+ data[0], data[1], data[2], data[3]);
+}