diff options
author | Benety Goh <benety@mongodb.com> | 2014-05-19 13:36:16 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2014-05-21 11:17:04 -0400 |
commit | 219bcdbc9b4dd1be804cf5385624fdc1557b3467 (patch) | |
tree | 35b32c5e9f956a326481c0641da5e8d39e3331ee | |
parent | e06a94e70c25ce97628dddbb551e5669f435922e (diff) | |
download | mongo-219bcdbc9b4dd1be804cf5385624fdc1557b3467.tar.gz |
SERVER-8995 added gperftools-2.2 generated headers and SConscript files. cpu-profiler build tweaks.
config-10gen_macos.h:
- generated by: ./configure
- disabled HAVE_LIBUNWIND_H
config-10gen_linux.h:
- generated by: ./configure --enable-minimal
- applied config-10gen_linux.h changes made in src/gperftools-2.0/src/config-10gen_linux.h in commit eee3fe4ce66c7bbda9329a3c8bd8e3549b07437c:
SERVER-4683 Support the imported tcmalloc, ystem tcmalloc or the default system allocator library.
Pass --allocator=tcmalloc (default on Linux) or --allocator=system (default elsewhere)
to control which allocator is used, and --use-system-tcmalloc to use the system-
installed tcmalloc instead of the one in the mongo source tree if you use --allocator=tcmalloc.
- applied config-10gen_linux.h changes made in src/gperftools-2.0/src/config-10gen_linux.h in commit 498d9102e00e61ca2d41b7db1448969728884b50:
SERVER-6758 - use third_party profiler when using --use-cpu-profiler
does require libunwind installed on system
SCons --use-cpu-profiler changes:
- enabled HAVE_UNWIND_H for use-cpu-profile
- excluded cpu profile commands from mongos
-rw-r--r-- | src/mongo/SConscript | 8 | ||||
-rw-r--r-- | src/third_party/gperftools-2.2/SConscript | 94 | ||||
-rw-r--r-- | src/third_party/gperftools-2.2/src/config-10gen-linux.h | 295 | ||||
-rw-r--r-- | src/third_party/gperftools-2.2/src/config-10gen-macos.h | 294 | ||||
-rw-r--r-- | src/third_party/gperftools-2.2/src/config.h | 7 | ||||
-rw-r--r-- | src/third_party/gperftools-2.2/src/gperftools/tcmalloc.h | 135 |
6 files changed, 829 insertions, 4 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index ed7ee39fc2e..49eadd7a4aa 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -812,6 +812,10 @@ serverOnlyFiles += [ "s/d_logic.cpp", "s/d_merge.cpp", "s/distlock_test.cpp" ] +if has_option( 'use-cpu-profiler' ): + serverOnlyFiles.append( 'db/commands/cpuprofile.cpp' ) + env.Append(LIBS=['unwind']) + env.Library("defaultversion", "s/default_version.cpp") # Geo @@ -927,10 +931,6 @@ mongodOnlyFiles = [ "db/db.cpp", "db/commands/touch.cpp", "db/mongod_options_ini env.Library("gridfs", "client/gridfs.cpp") -if has_option( 'use-cpu-profiler' ): - coreServerFiles.append( 'db/commands/cpuprofile.cpp' ) - env.Append(LIBS=['unwind']) - env.Library("coreserver", coreServerFiles, LIBDEPS=["mongocommon", "scripting"]) # mongod options diff --git a/src/third_party/gperftools-2.2/SConscript b/src/third_party/gperftools-2.2/SConscript new file mode 100644 index 00000000000..898061fe10d --- /dev/null +++ b/src/third_party/gperftools-2.2/SConscript @@ -0,0 +1,94 @@ +# -*- mode: python -*- + +Import("env") +Import("has_option") +Import("debugBuild") +Import("darwin") + +files = [ + 'src/base/dynamic_annotations.c', + 'src/base/spinlock_internal.cc', + 'src/base/logging.cc', + 'src/base/atomicops-internals-x86.cc', + 'src/base/sysinfo.cc', + 'src/base/spinlock.cc', + 'src/base/vdso_support.cc', + 'src/base/elf_mem_image.cc', + 'src/malloc_hook.cc', + 'src/span.cc', + 'src/maybe_threads.cc', + 'src/internal_logging.cc', + 'src/symbolize.cc', + 'src/system-alloc.cc', + 'src/memfs_malloc.cc', + 'src/central_freelist.cc', + 'src/thread_cache.cc', + 'src/page_heap.cc', + 'src/common.cc', + 'src/static_vars.cc', + 'src/stack_trace_table.cc', + 'src/malloc_extension.cc', + 'src/sampler.cc', + 'src/stacktrace.cc' + ] + +if not debugBuild: + files += ['src/tcmalloc.cc'], +else: + files += ['src/debugallocation.cc'] + +if has_option( 'use-cpu-profiler' ): + files += [ + 'src/profiler.cc', + 'src/profiledata.cc', + 'src/profile-handler.cc' + ] + +__malloc_hook_fragment = ''' +#include <malloc.h> +void* (* volatile __malloc_hook)(size_t, const void*) = 0; +''' + +def __checkMallocHookVolatile(check_context): + check_context.Message("Checking if __malloc_hook is declared volatile... ") + is_malloc_hook_volatile = check_context.TryCompile(__malloc_hook_fragment, '.cc') + check_context.Result(is_malloc_hook_volatile) + malloc_hook_define = 'MALLOC_HOOK_MAYBE_VOLATILE=' + if is_malloc_hook_volatile: + malloc_hook_define += 'volatile' + check_context.env.Append(CPPDEFINES=[malloc_hook_define]) + + +conf = Configure(env.Clone(), custom_tests=dict(CheckMallocHookVolatile=__checkMallocHookVolatile)) +conf.CheckMallocHookVolatile() +env = conf.Finish() + + +env.Append( CPPDEFINES=[ "NO_TCMALLOC_SAMPLES", "NO_HEAP_CHECK"] ) + +# The build system doesn't define NDEBUG globally for historical reasons, however, TCMalloc +# expects that NDEBUG is used to select between preferring the mmap or the sbrk allocator. For +# non-debug builds, we want to prefer the sbrk allocator since this is TCMallocs preferred +# production deployment configuration. See the use of NDEBUG and kDebugMode in +# src/system-alloc.cc for more details. +if not debugBuild: + env.Append( CPPDEFINES=["NDEBUG"] ) + +env.Prepend( CPPPATH=["src/"] ) + +my_SYSLIBDEPS = [] + +if has_option( 'use-cpu-profiler' ): + env.Append( CPPDEFINES=["NO_FRAME_POINTER", ("HAVE_LIBUNWIND_H", "1")] ) + my_SYSLIBDEPS.append( "unwind" ) + +def removeIfPresent(lst, item): + try: + lst.remove(item) + except ValueError: + pass + +for to_remove in ['-Werror', "-Wsign-compare","-Wall"]: + removeIfPresent(env['CCFLAGS'], to_remove) + +env.Library('tcmalloc_minimal', files, SYSLIBDEPS=my_SYSLIBDEPS) diff --git a/src/third_party/gperftools-2.2/src/config-10gen-linux.h b/src/third_party/gperftools-2.2/src/config-10gen-linux.h new file mode 100644 index 00000000000..6c3f28b2be3 --- /dev/null +++ b/src/third_party/gperftools-2.2/src/config-10gen-linux.h @@ -0,0 +1,295 @@ +/* src/config.h. Generated from config.h.in by configure. */ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + + +#ifndef GPERFTOOLS_CONFIG_H_ +#define GPERFTOOLS_CONFIG_H_ + + +/* Define to 1 if compiler supports __builtin_expect */ +#define HAVE_BUILTIN_EXPECT 1 + +/* Define to 1 if compiler supports __builtin_stack_pointer */ +/* #undef HAVE_BUILTIN_STACK_POINTER */ + +/* Define to 1 if you have the <conflict-signal.h> header file. */ +/* #undef HAVE_CONFLICT_SIGNAL_H */ + +/* Define to 1 if you have the <cygwin/signal.h> header file. */ +/* #undef HAVE_CYGWIN_SIGNAL_H */ + +/* Define to 1 if you have the declaration of `backtrace', and to 0 if you + don't. */ +/* #undef HAVE_DECL_BACKTRACE */ + +/* Define to 1 if you have the declaration of `cfree', and to 0 if you don't. + */ +#define HAVE_DECL_CFREE 1 + +/* Define to 1 if you have the declaration of `memalign', and to 0 if you + don't. */ +#define HAVE_DECL_MEMALIGN 1 + +/* Define to 1 if you have the declaration of `nanosleep', and to 0 if you + don't. */ +/* #undef HAVE_DECL_NANOSLEEP */ + +/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if + you don't. */ +#define HAVE_DECL_POSIX_MEMALIGN 1 + +/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you + don't. */ +#define HAVE_DECL_PVALLOC 1 + +/* Define to 1 if you have the declaration of `sleep', and to 0 if you don't. + */ +/* #undef HAVE_DECL_SLEEP */ + +/* Define to 1 if you have the declaration of `uname', and to 0 if you don't. + */ +#define HAVE_DECL_UNAME 1 + +/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't. + */ +#define HAVE_DECL_VALLOC 1 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if the system has the type `Elf32_Versym'. */ +#define HAVE_ELF32_VERSYM 1 + +/* Define to 1 if you have the <execinfo.h> header file. */ +#define HAVE_EXECINFO_H 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the <features.h> header file. */ +#define HAVE_FEATURES_H 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the <glob.h> header file. */ +#define HAVE_GLOB_H 1 + +/* Define to 1 if you have the <grp.h> header file. */ +#define HAVE_GRP_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <libunwind.h> header file. */ +/* #undef HAVE_LIBUNWIND_H */ + +/* Define to 1 if you have the <linux/ptrace.h> header file. */ +#define HAVE_LINUX_PTRACE_H 1 + +/* Define to 1 if you have the <malloc.h> header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the <malloc/malloc.h> header file. */ +/* #undef HAVE_MALLOC_MALLOC_H */ + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#define HAVE_MMAP 1 + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES 1 + +/* Define to 1 if you have the <poll.h> header file. */ +#define HAVE_POLL_H 1 + +/* define if libc has program_invocation_name */ +#define HAVE_PROGRAM_INVOCATION_NAME 1 + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* defined to 1 if pthread symbols are exposed even without include pthread.h + */ +/* #undef HAVE_PTHREAD_DESPITE_ASKING_FOR */ + +/* Define to 1 if you have the <pwd.h> header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `sbrk' function. */ +#define HAVE_SBRK 1 + +/* Define to 1 if you have the <sched.h> header file. */ +#define HAVE_SCHED_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct mallinfo'. */ +#define HAVE_STRUCT_MALLINFO 1 + +/* Define to 1 if you have the <sys/cdefs.h> header file. */ +#define HAVE_SYS_CDEFS_H 1 + +/* Define to 1 if you have the <sys/malloc.h> header file. */ +/* #undef HAVE_SYS_MALLOC_H */ + +/* Define to 1 if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the <sys/prctl.h> header file. */ +#define HAVE_SYS_PRCTL_H 1 + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/syscall.h> header file. */ +#define HAVE_SYS_SYSCALL_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* <sys/ucontext.h> is broken on redhat 7 */ +/* #undef HAVE_SYS_UCONTEXT_H */ + +/* Define to 1 if you have the <sys/wait.h> header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if compiler supports __thread */ +#define HAVE_TLS 1 + +/* Define to 1 if you have the <ucontext.h> header file. */ +#define HAVE_UCONTEXT_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the <unwind.h> header file. */ +#define HAVE_UNWIND_H 1 + +/* Define to 1 if you have the <valgrind.h> header file. */ +/* #undef HAVE_VALGRIND_H */ + +/* define if your compiler has __attribute__ */ +#define HAVE___ATTRIBUTE__ 1 + +/* Define to 1 if compiler supports __environ */ +#define HAVE___ENVIRON 1 + +/* Define to 1 if the system has the type `__int64'. */ +/* #undef HAVE___INT64 */ + +/* prefix where we look for installed files */ +#define INSTALL_PREFIX "/usr/local" + +/* Define to 1 if int32_t is equivalent to intptr_t */ +/* #undef INT32_EQUALS_INTPTR */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "gperftools" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "google-perftools@googlegroups.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "gperftools" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "gperftools 2.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "gperftools" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.2" + +/* How to access the PC from a struct ucontext */ +#ifdef __i386 +#define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_EIP] +#else +#define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP] +#endif + +/* Always the empty-string on non-windows systems. On windows, should be + "__declspec(dllexport)". This way, when we compile the dll, we export our + functions/classes. It's safe to define this here because config.h is only + used internally, to compile the DLL, and every DLL source file #includes + "config.h" before anything else. */ +#define PERFTOOLS_DLL_DECL /**/ + +/* printf format code for printing a size_t and ssize_t */ +#define PRIdS "ld" + +/* printf format code for printing a size_t and ssize_t */ +#define PRIuS "lu" + +/* printf format code for printing a size_t and ssize_t */ +#define PRIxS "lx" + +/* Mark the systems where we know it's bad if pthreads runs too + early before main (before threads are initialized, presumably). */ +#ifdef __FreeBSD__ +#define PTHREADS_CRASHES_IF_RUN_TOO_EARLY 1 +#endif + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* the namespace where STL code like vector<> is defined */ +#define STL_NAMESPACE std + +/* Version number of package */ +#define VERSION "2.2" + +/* C99 says: define this to get the PRI... macros from stdint.h */ +#ifndef __STDC_FORMAT_MACROS +# define __STDC_FORMAT_MACROS 1 +#endif + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + + +#ifdef __MINGW32__ +#include "windows/mingw.h" +#endif + +#endif /* #ifndef GPERFTOOLS_CONFIG_H_ */ + diff --git a/src/third_party/gperftools-2.2/src/config-10gen-macos.h b/src/third_party/gperftools-2.2/src/config-10gen-macos.h new file mode 100644 index 00000000000..2a9af3e496a --- /dev/null +++ b/src/third_party/gperftools-2.2/src/config-10gen-macos.h @@ -0,0 +1,294 @@ +/* src/config.h. Generated from config.h.in by configure. */ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + + +#ifndef GPERFTOOLS_CONFIG_H_ +#define GPERFTOOLS_CONFIG_H_ + + +/* Define to 1 if compiler supports __builtin_expect */ +#define HAVE_BUILTIN_EXPECT 1 + +/* Define to 1 if compiler supports __builtin_stack_pointer */ +/* #undef HAVE_BUILTIN_STACK_POINTER */ + +/* Define to 1 if you have the <conflict-signal.h> header file. */ +/* #undef HAVE_CONFLICT_SIGNAL_H */ + +/* Define to 1 if you have the <cygwin/signal.h> header file. */ +/* #undef HAVE_CYGWIN_SIGNAL_H */ + +/* Define to 1 if you have the declaration of `backtrace', and to 0 if you + don't. */ +/* #undef HAVE_DECL_BACKTRACE */ + +/* Define to 1 if you have the declaration of `cfree', and to 0 if you don't. + */ +#define HAVE_DECL_CFREE 0 + +/* Define to 1 if you have the declaration of `memalign', and to 0 if you + don't. */ +#define HAVE_DECL_MEMALIGN 0 + +/* Define to 1 if you have the declaration of `nanosleep', and to 0 if you + don't. */ +/* #undef HAVE_DECL_NANOSLEEP */ + +/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if + you don't. */ +#define HAVE_DECL_POSIX_MEMALIGN 0 + +/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you + don't. */ +#define HAVE_DECL_PVALLOC 0 + +/* Define to 1 if you have the declaration of `sleep', and to 0 if you don't. + */ +/* #undef HAVE_DECL_SLEEP */ + +/* Define to 1 if you have the declaration of `uname', and to 0 if you don't. + */ +#define HAVE_DECL_UNAME 1 + +/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't. + */ +#define HAVE_DECL_VALLOC 0 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if the system has the type `Elf32_Versym'. */ +/* #undef HAVE_ELF32_VERSYM */ + +/* Define to 1 if you have the <execinfo.h> header file. */ +#define HAVE_EXECINFO_H 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the <features.h> header file. */ +/* #undef HAVE_FEATURES_H */ + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the <glob.h> header file. */ +#define HAVE_GLOB_H 1 + +/* Define to 1 if you have the <grp.h> header file. */ +#define HAVE_GRP_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <libunwind.h> header file. */ +/* #undef HAVE_LIBUNWIND_H */ + +/* Define to 1 if you have the <linux/ptrace.h> header file. */ +/* #undef HAVE_LINUX_PTRACE_H */ + +/* Define to 1 if you have the <malloc.h> header file. */ +/* #undef HAVE_MALLOC_H */ + +/* Define to 1 if you have the <malloc/malloc.h> header file. */ +#define HAVE_MALLOC_MALLOC_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#define HAVE_MMAP 1 + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES 1 + +/* Define to 1 if you have the <poll.h> header file. */ +#define HAVE_POLL_H 1 + +/* define if libc has program_invocation_name */ +/* #undef HAVE_PROGRAM_INVOCATION_NAME */ + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* defined to 1 if pthread symbols are exposed even without include pthread.h + */ +/* #undef HAVE_PTHREAD_DESPITE_ASKING_FOR */ + +/* Define to 1 if you have the <pwd.h> header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `sbrk' function. */ +#define HAVE_SBRK 1 + +/* Define to 1 if you have the <sched.h> header file. */ +#define HAVE_SCHED_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct mallinfo'. */ +/* #undef HAVE_STRUCT_MALLINFO */ + +/* Define to 1 if you have the <sys/cdefs.h> header file. */ +#define HAVE_SYS_CDEFS_H 1 + +/* Define to 1 if you have the <sys/malloc.h> header file. */ +#define HAVE_SYS_MALLOC_H 1 + +/* Define to 1 if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the <sys/prctl.h> header file. */ +/* #undef HAVE_SYS_PRCTL_H */ + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/syscall.h> header file. */ +#define HAVE_SYS_SYSCALL_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* <sys/ucontext.h> is broken on redhat 7 */ +#define HAVE_SYS_UCONTEXT_H 1 + +/* Define to 1 if you have the <sys/wait.h> header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if compiler supports __thread */ +/* #undef HAVE_TLS */ + +/* Define to 1 if you have the <ucontext.h> header file. */ +/* #undef HAVE_UCONTEXT_H */ + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the <unwind.h> header file. */ +#define HAVE_UNWIND_H 1 + +/* Define to 1 if you have the <valgrind.h> header file. */ +/* #undef HAVE_VALGRIND_H */ + +/* define if your compiler has __attribute__ */ +#define HAVE___ATTRIBUTE__ 1 + +/* Define to 1 if compiler supports __environ */ +/* #undef HAVE___ENVIRON */ + +/* Define to 1 if the system has the type `__int64'. */ +/* #undef HAVE___INT64 */ + +/* prefix where we look for installed files */ +#define INSTALL_PREFIX "/usr/local" + +/* Define to 1 if int32_t is equivalent to intptr_t */ +/* #undef INT32_EQUALS_INTPTR */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 'volatile' if __malloc_hook is declared volatile */ +#define MALLOC_HOOK_MAYBE_VOLATILE /**/ + +/* Name of package */ +#define PACKAGE "gperftools" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "google-perftools@googlegroups.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "gperftools" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "gperftools 2.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "gperftools" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.2" + +/* How to access the PC from a struct ucontext */ +#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip + +/* Always the empty-string on non-windows systems. On windows, should be + "__declspec(dllexport)". This way, when we compile the dll, we export our + functions/classes. It's safe to define this here because config.h is only + used internally, to compile the DLL, and every DLL source file #includes + "config.h" before anything else. */ +#define PERFTOOLS_DLL_DECL /**/ + +/* printf format code for printing a size_t and ssize_t */ +#define PRIdS "ld" + +/* printf format code for printing a size_t and ssize_t */ +#define PRIuS "lu" + +/* printf format code for printing a size_t and ssize_t */ +#define PRIxS "lx" + +/* Mark the systems where we know it's bad if pthreads runs too + early before main (before threads are initialized, presumably). */ +#ifdef __FreeBSD__ +#define PTHREADS_CRASHES_IF_RUN_TOO_EARLY 1 +#endif + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* the namespace where STL code like vector<> is defined */ +#define STL_NAMESPACE std + +/* Version number of package */ +#define VERSION "2.2" + +/* C99 says: define this to get the PRI... macros from stdint.h */ +#ifndef __STDC_FORMAT_MACROS +# define __STDC_FORMAT_MACROS 1 +#endif + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + + +#ifdef __MINGW32__ +#include "windows/mingw.h" +#endif + +#endif /* #ifndef GPERFTOOLS_CONFIG_H_ */ + diff --git a/src/third_party/gperftools-2.2/src/config.h b/src/third_party/gperftools-2.2/src/config.h new file mode 100644 index 00000000000..841dc1ae2c2 --- /dev/null +++ b/src/third_party/gperftools-2.2/src/config.h @@ -0,0 +1,7 @@ +#if defined(__linux__) +#include "config-10gen-linux.h" +#elif defined(__APPLE__) +#include "config-10gen-macos.h" +#else +#error "In tree version of TCMalloc not supported on this platform!" +#endif diff --git a/src/third_party/gperftools-2.2/src/gperftools/tcmalloc.h b/src/third_party/gperftools-2.2/src/gperftools/tcmalloc.h new file mode 100644 index 00000000000..c471cd6bb7b --- /dev/null +++ b/src/third_party/gperftools-2.2/src/gperftools/tcmalloc.h @@ -0,0 +1,135 @@ +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- +/* Copyright (c) 2003, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * --- + * Author: Sanjay Ghemawat <opensource@google.com> + * .h file by Craig Silverstein <opensource@google.com> + */ + +#ifndef TCMALLOC_TCMALLOC_H_ +#define TCMALLOC_TCMALLOC_H_ + +#include <stddef.h> // for size_t +#ifdef HAVE_SYS_CDEFS_H +#include <sys/cdefs.h> // where glibc defines __THROW +#endif + +// __THROW is defined in glibc systems. It means, counter-intuitively, +// "This function will never throw an exception." It's an optional +// optimization tool, but we may need to use it to match glibc prototypes. +#ifndef __THROW /* I guess we're not on a glibc system */ +# define __THROW /* __THROW is just an optimization, so ok to make it "" */ +#endif + +// Define the version number so folks can check against it +#define TC_VERSION_MAJOR 2 +#define TC_VERSION_MINOR 2 +#define TC_VERSION_PATCH "" +#define TC_VERSION_STRING "gperftools 2.2" + +// For struct mallinfo, if it's defined. +#ifdef HAVE_STRUCT_MALLINFO +// Malloc can be in several places on older versions of OS X. +# if defined(HAVE_MALLOC_H) +# include <malloc.h> +# elif defined(HAVE_SYS_MALLOC_H) +# include <sys/malloc.h> +# elif defined(HAVE_MALLOC_MALLOC_H) +# include <malloc/malloc.h> +# endif +#endif + +// Annoying stuff for windows -- makes sure clients can import these functions +#ifndef PERFTOOLS_DLL_DECL +# ifdef _WIN32 +# define PERFTOOLS_DLL_DECL __declspec(dllimport) +# else +# define PERFTOOLS_DLL_DECL +# endif +#endif + +#ifdef __cplusplus +namespace std { +struct nothrow_t; +} + +extern "C" { +#endif + // Returns a human-readable version string. If major, minor, + // and/or patch are not NULL, they are set to the major version, + // minor version, and patch-code (a string, usually ""). + PERFTOOLS_DLL_DECL const char* tc_version(int* major, int* minor, + const char** patch) __THROW; + + PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) __THROW; + PERFTOOLS_DLL_DECL void* tc_malloc_skip_new_handler(size_t size) __THROW; + PERFTOOLS_DLL_DECL void tc_free(void* ptr) __THROW; + PERFTOOLS_DLL_DECL void* tc_realloc(void* ptr, size_t size) __THROW; + PERFTOOLS_DLL_DECL void* tc_calloc(size_t nmemb, size_t size) __THROW; + PERFTOOLS_DLL_DECL void tc_cfree(void* ptr) __THROW; + + PERFTOOLS_DLL_DECL void* tc_memalign(size_t __alignment, + size_t __size) __THROW; + PERFTOOLS_DLL_DECL int tc_posix_memalign(void** ptr, + size_t align, size_t size) __THROW; + PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) __THROW; + PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) __THROW; + + PERFTOOLS_DLL_DECL void tc_malloc_stats(void) __THROW; + PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) __THROW; +#if 0 + PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW; +#endif + + // This is an alias for MallocExtension::instance()->GetAllocatedSize(). + // It is equivalent to + // OS X: malloc_size() + // glibc: malloc_usable_size() + // Windows: _msize() + PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) __THROW; + +#ifdef __cplusplus + PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) __THROW; + PERFTOOLS_DLL_DECL void* tc_new(size_t size); + PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size, + const std::nothrow_t&) __THROW; + PERFTOOLS_DLL_DECL void tc_delete(void* p) __THROW; + PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p, + const std::nothrow_t&) __THROW; + PERFTOOLS_DLL_DECL void* tc_newarray(size_t size); + PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size, + const std::nothrow_t&) __THROW; + PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW; + PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p, + const std::nothrow_t&) __THROW; +} +#endif + +#endif // #ifndef TCMALLOC_TCMALLOC_H_ |