summaryrefslogtreecommitdiff
path: root/lib/resource.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-06-02 22:20:40 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2010-06-02 22:20:40 +0200
commitacb60628f53ba1fc29d1a554683acdb03f961c6f (patch)
treebe767e6d7995dee6708b7530b7dabe74d23b491e /lib/resource.h
parent4461b8979143bd13024663622c419646a1db0c85 (diff)
Implements command that shows memory usage.
Diffstat (limited to 'lib/resource.h')
-rw-r--r--lib/resource.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/resource.h b/lib/resource.h
index 8dd441f0..5cb5e274 100644
--- a/lib/resource.h
+++ b/lib/resource.h
@@ -26,8 +26,12 @@ struct resclass {
void (*free)(resource *); /* Freeing function */
void (*dump)(resource *); /* Dump to debug output */
resource *(*lookup)(resource *, unsigned long); /* Look up address (only for debugging) */
+ size_t (*memsize)(resource *); /* Return size of memory used by the resource, may be NULL */
};
+/* Estimate of system allocator overhead per item, for memory consumtion stats */
+#define ALLOC_OVERHEAD 8
+
/* Generic resource manipulation */
typedef struct pool pool;
@@ -36,6 +40,7 @@ void resource_init(void);
pool *rp_new(pool *, char *); /* Create new pool */
void rfree(void *); /* Free single resource */
void rdump(void *); /* Dump to debug output */
+size_t rmemsize(void *res); /* Return size of memory used by the resource */
void rlookup(unsigned long); /* Look up address (only for debugging) */
void rmove(void *, pool *); /* Move to a different pool */