Commit e69c949f authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Rename a bunch of symbols to toku_symbols. Addresses #8.

git-svn-id: file:///svn/tokudb@827 c7de825b-a66e-492c-adef-691d508d4ae1
parent 075438b9
......@@ -169,7 +169,7 @@ int main (int argc, char *argv[]) {
gettimeofday(&t3,0);
printf("Shutdown %9.6fs\n", tdiff(&t3, &t2));
printf("Total time %9.6fs for %lld insertions = %8.0f/s\n", tdiff(&t3, &t1), 2*total_n_items, 2*total_n_items/tdiff(&t3, &t1));
malloc_report();
toku_malloc_report();
toku_malloc_cleanup();
return 0;
}
......
......@@ -549,7 +549,7 @@ int toku_deserialize_brtheader_from (int fd, DISKOFF off, struct brt_header **br
h->roots[i] = rbuf_diskoff(&rc);
rbuf_bytes(&rc, &nameptr, &len);
assert(strlen(nameptr)+1==len);
h->names[i] = memdup(nameptr,len);
h->names[i] = toku_memdup(nameptr,len);
}
h->unnamed_root = -1;
} else {
......
......@@ -13,7 +13,7 @@ int toku_memory_check=0;
#define WHEN_MEM_DEBUG(x) ({if (toku_memory_check) ({x});})
long long n_items_malloced=0;
static long long n_items_malloced=0;
/* Memory checking */
enum { items_limit = 1000 };
......@@ -141,9 +141,9 @@ void *toku_calloc(long nmemb, long size) {
static void *freelist[FREELIST_LIMIT];
#define MALLOC_SIZE_COUNTING_LIMIT 512
int malloc_counts[MALLOC_SIZE_COUNTING_LIMIT]; // We rely on static variables being initialized to 0.
int fresh_malloc_counts[MALLOC_SIZE_COUNTING_LIMIT]; // We rely on static variables being initialized to 0.
int other_malloc_count=0, fresh_other_malloc_count=0;
static int malloc_counts[MALLOC_SIZE_COUNTING_LIMIT]; // We rely on static variables being initialized to 0.
static int fresh_malloc_counts[MALLOC_SIZE_COUNTING_LIMIT]; // We rely on static variables being initialized to 0.
static int other_malloc_count=0, fresh_other_malloc_count=0;
void *toku_malloc(unsigned long size) {
void * r;
errno=0;
......@@ -202,13 +202,13 @@ void toku_free_n(void* p, unsigned long size) {
}
}
void *memdup (const void *v, unsigned int len) {
void *toku_memdup (const void *v, unsigned int len) {
void *r=toku_malloc(len);
memcpy(r,v,len);
return r;
}
char *toku_strdup (const char *s) {
return memdup(s, strlen(s)+1);
return toku_memdup(s, strlen(s)+1);
}
void toku_memory_check_all_free (void) {
......@@ -220,7 +220,7 @@ void toku_memory_check_all_free (void) {
assert(n_items_malloced==0);
}
int get_n_items_malloced (void) { return n_items_malloced; }
int toku_get_n_items_malloced (void) { return n_items_malloced; }
void toku_print_malloced_items (void) {
int i;
for (i=0; i<n_items_malloced; i++) {
......@@ -228,7 +228,7 @@ void toku_print_malloced_items (void) {
}
}
void malloc_report (void) {
void toku_malloc_report (void) {
int i;
printf("malloc report:\n");
for (i=0; i<MALLOC_SIZE_COUNTING_LIMIT; i++) {
......
......@@ -54,7 +54,7 @@ void *toku_realloc(void *, long size);
#define TAGMALLOC(t,v) t v = toku_tagmalloc(sizeof(*v), TYP_ ## t);
/* Copy memory. Analogous to strdup() */
void *memdup (const void *v, unsigned int len);
void *toku_memdup (const void *v, unsigned int len);
/* Toku-version of strdup. Use this so that it calls toku_malloc() */
char *toku_strdup (const char *s);
......@@ -63,12 +63,12 @@ void toku_malloc_cleanup (void); /* Before exiting, call this function to free u
/* Check to see if everything malloc'd was free. Might be a no-op depending on how memory.c is configured. */
void toku_memory_check_all_free (void);
/* Check to see if memory is "sane". Might be a no-op. Probably better to simply use valgrind. */
void do_memory_check(void);
void toku_do_memory_check(void);
extern int toku_memory_check; // Set to nonzero to get a (much) slower version of malloc that does (much) more checking.
int get_n_items_malloced(void); /* How many items are malloc'd but not free'd. May return 0 depending on the configuration of memory.c */
int toku_get_n_items_malloced(void); /* How many items are malloc'd but not free'd. May return 0 depending on the configuration of memory.c */
void toku_print_malloced_items(void); /* Try to print some malloced-but-not-freed items. May be a noop. */
void malloc_report (void); /* report on statistics about number of mallocs. Maybe a no-op. */
void toku_malloc_report (void); /* report on statistics about number of mallocs. Maybe a no-op. */
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment