Commit 53c6b17d authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1032

Port dlmalloc to windows
export.def now auto-generated
maxrss function ported

git-svn-id: file:///svn/toku/tokudb@8694 c7de825b-a66e-492c-adef-691d508d4ae1
parent c936aac3
...@@ -409,8 +409,11 @@ int main (int argc, const char *argv[]) { ...@@ -409,8 +409,11 @@ int main (int argc, const char *argv[]) {
} }
#if 0 && defined TOKUDB #if 0 && defined TOKUDB
if (verbose) { if (verbose) {
extern unsigned long toku_get_maxrss(void); extern int toku_os_get_max_rss(int64_t*);
printf("maxrss=%.2fMB\n", toku_get_maxrss()/256.0); int64_t mrss;
int r = toku_os_get_max_rss(&mrss);
assert(r==0);
printf("maxrss=%.2fMB\n", mrss/256.0);
} }
if (0) { if (0) {
extern void print_hash_histogram (void) __attribute__((__visibility__("default"))); extern void print_hash_histogram (void) __attribute__((__visibility__("default")));
......
...@@ -107,8 +107,11 @@ static void scanscan_shutdown (void) { ...@@ -107,8 +107,11 @@ static void scanscan_shutdown (void) {
#if 0 && defined TOKUDB #if 0 && defined TOKUDB
{ {
extern unsigned long toku_get_maxrss(void); extern int toku_os_get_max_rss(int64_t*);
printf("maxrss=%.2fMB\n", toku_get_maxrss()/256.0); int64_t mrss;
int r = toku_os_get_max_rss(&mrss);
assert(r==0);
printf("maxrss=%.2fMB\n", mrss/256.0);
} }
#endif #endif
} }
......
...@@ -192,7 +192,4 @@ void toku_cachetable_verify (CACHETABLE t); ...@@ -192,7 +192,4 @@ void toku_cachetable_verify (CACHETABLE t);
// Not for use in production, but useful for testing. // Not for use in production, but useful for testing.
void print_hash_histogram (void) __attribute__((__visibility__("default"))); void print_hash_histogram (void) __attribute__((__visibility__("default")));
// Useful for debugging.
unsigned long toku_get_maxrss(void) __attribute__((__visibility__("default")));
#endif #endif
...@@ -30,18 +30,11 @@ OBJS_RAW = \ ...@@ -30,18 +30,11 @@ OBJS_RAW = \
ydb_lib \ ydb_lib \
ydb \ ydb \
errors \ errors \
dlmalloc \
elocks \ elocks \
# dlmalloc \ DLMALLOC not for windows yet. Add it for linux (below)
#\end #\end
#OBJS automatically defined. #OBJS automatically defined.
#dlmalloc not for windows (yet)
ifeq ($(CYGWIN),)
OBJS_RAW += dlmalloc
else ifneq ($(CC),icc)
OBJS_RAW += dlmalloc
endif
LIBRARIES= \ LIBRARIES= \
$(LIBRARY) \ $(LIBRARY) \
$(TLIBRARY) \ $(TLIBRARY) \
...@@ -74,6 +67,11 @@ install: libs install_libs ; ...@@ -74,6 +67,11 @@ install: libs install_libs ;
.PHONY: local libs buildlocktrees .PHONY: local libs buildlocktrees
libs: $(LIBRARIES) ; libs: $(LIBRARIES) ;
$(LIBRARIES): export.def
export.def: export.map
echo "EXPORTS" > $@
cat export.map |sed -n "s/\([a-zA-Z_0-9][a-zA-Z_0-9]*\);/\t\1 @/g;/@/ P" |sed -n 'P;=' | sed '{;N;s/\n//;}' >> $@
echo "" >> $@
buildlocktrees: $(LOCKTREE) $(RANGETREE) ; buildlocktrees: $(LOCKTREE) $(RANGETREE) ;
......
...@@ -5,13 +5,26 @@ EXPORTS ...@@ -5,13 +5,26 @@ EXPORTS
db_version @4 db_version @4
log_compare @5 log_compare @5
db_env_set_func_fsync @6 db_env_set_func_fsync @6
db_env_set_func_malloc @7
db_env_set_func_realloc @8
db_env_set_func_free @9
toku_os_get_max_rss @10
toku_ydb_error_all_cases @11
toku_set_trace_file @12
toku_close_trace_file @13
toku_add_trace_mem @14
toku_print_trace_mem @15
toku_free @16
toku_malloc @17
toku_os_get_file_size @18
toku_os_getpid @19
toku_os_gettid @20
toku_os_initialize_settings @21
toku_os_is_absolute_name @22
toku_os_mkdir @23
toku_realloc @24
toku_strdup @25
dlmalloc @26
dlrealloc @27
dlfree @28
toku_ydb_error_all_cases @8
toku_set_trace_file @9
toku_close_trace_file @10
toku_add_trace_mem @11
toku_print_trace_mem @12
toku_ydb_init @13
toku_ydb_destroy @14
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
db_env_set_func_realloc; db_env_set_func_realloc;
db_env_set_func_free; db_env_set_func_free;
toku_get_maxrss; toku_os_get_max_rss;
toku_ydb_error_all_cases; toku_ydb_error_all_cases;
toku_set_trace_file; toku_set_trace_file;
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
#define DONT_DEPRECATE_MALLOC #define DONT_DEPRECATE_MALLOC
#if !defined(TOKU_WINDOWS) || !TOKU_WINDOWS
#include <valgrind/memcheck.h> #include <valgrind/memcheck.h>
#endif
#include <toku_portability.h> #include <toku_portability.h>
#include <memory.h> #include <memory.h>
......
...@@ -27,9 +27,7 @@ const char *toku_copyright_string = "Copyright (c) 2007, 2008 Tokutek Inc. All ...@@ -27,9 +27,7 @@ const char *toku_copyright_string = "Copyright (c) 2007, 2008 Tokutek Inc. All
#include "cachetable.h" #include "cachetable.h"
#include "log.h" #include "log.h"
#include "memory.h" #include "memory.h"
#ifndef TOKU_WINDOWS
#include "dlmalloc.h" #include "dlmalloc.h"
#endif
#ifdef TOKUTRACE #ifdef TOKUTRACE
#define DB_ENV_CREATE_FUN db_env_create_toku10 #define DB_ENV_CREATE_FUN db_env_create_toku10
...@@ -3669,9 +3667,7 @@ int db_env_set_func_free (void (*f)(void*)) { ...@@ -3669,9 +3667,7 @@ int db_env_set_func_free (void (*f)(void*)) {
} }
// Got to call dlmalloc, or else it won't get included. // Got to call dlmalloc, or else it won't get included.
void setup_dlmalloc (void) { void setup_dlmalloc (void) {
#ifndef TOKU_WINDOWS
db_env_set_func_malloc(dlmalloc); db_env_set_func_malloc(dlmalloc);
db_env_set_func_realloc(dlrealloc); db_env_set_func_realloc(dlrealloc);
db_env_set_func_free(dlfree); db_env_set_func_free(dlfree);
#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