+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
#include "gmqcc.h"
/*
size_t value;
} stat_size_entry_t, **stat_size_table_t;
+typedef struct {
+ uint64_t used;
+ uint64_t type;
+ uint64_t size;
+} stat_entry_t;
+
static uint64_t stat_mem_allocated = 0;
static uint64_t stat_mem_deallocated = 0;
static uint64_t stat_mem_allocated_total = 0;
static stat_size_table_t stat_size_hashtables = NULL;
static stat_mem_block_t *stat_mem_block_root = NULL;
-
/*
* A tiny size_t key-value hashtbale for tracking vector and hashtable
* sizes. We can use it for other things too, if we need to. This is
if ((find = stat_size_get(stat_size_hashtables, size)))
find->value++;
else {
- stat_used_hashtables++;
+ stat_type_hashtables++;
stat_size_put(stat_size_hashtables, size, 1);
}
hashtable->size = size;
memset(hashtable->table, 0, sizeof(hash_node_t*) * size);
- stat_type_hashtables++;
+ stat_used_hashtables++;
return hashtable;
}
static void stat_dump_stats_table(stat_size_table_t table, const char *string, uint64_t *size) {
size_t i,j;
+ if (!table)
+ return;
+
for (i = 0, j = 0; i < ST_SIZE; i++) {
stat_size_entry_t *entry;
if (OPTS_OPTION_BOOL(OPTION_MEMCHK) ||
OPTS_OPTION_BOOL(OPTION_STATISTICS)) {
- uint64_t mem;
+ uint64_t mem = 0;
con_out("\nAdditional Statistics:\n\
Total vectors allocated: %llu\n\