summaryrefslogtreecommitdiff
path: root/lib/resource.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/resource.h')
-rw-r--r--lib/resource.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/resource.h b/lib/resource.h
index 76e3745f..9ec41ed8 100644
--- a/lib/resource.h
+++ b/lib/resource.h
@@ -2,6 +2,7 @@
* BIRD Resource Manager
*
* (c) 1998--1999 Martin Mares <mj@ucw.cz>
+ * (c) 2021 Maria Matejka <mq@jmq.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
@@ -11,6 +12,11 @@
#include "lib/lists.h"
+struct resmem {
+ size_t effective; /* Memory actually used for data storage */
+ size_t overhead; /* Overhead memory imposed by allocator strategies */
+};
+
/* Resource */
typedef struct resource {
@@ -26,11 +32,11 @@ 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 */
+ struct resmem (*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
+#define ALLOC_OVERHEAD 16
/* Generic resource manipulation */
@@ -40,7 +46,7 @@ void resource_init(void);
pool *rp_new(pool *, const 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 */
+struct resmem 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 */