├── LICENSE ├── Makefile ├── README.md ├── build.sh ├── deps ├── gperftools2 │ ├── AUTHORS │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── Makefile.am │ ├── Makefile.in │ ├── NEWS │ ├── README │ ├── README_windows.txt │ ├── TODO │ ├── aclocal.m4 │ ├── compile │ ├── config.guess │ ├── config.sub │ ├── configure │ ├── configure.ac │ ├── depcomp │ ├── doc │ │ ├── cpuprofile-fileformat.html │ │ ├── cpuprofile.html │ │ ├── designstyle.css │ │ ├── heap-example1.png │ │ ├── heap_checker.html │ │ ├── heapprofile.html │ │ ├── index.html │ │ ├── overview.dot │ │ ├── overview.gif │ │ ├── pageheap.dot │ │ ├── pageheap.gif │ │ ├── pprof-test-big.gif │ │ ├── pprof-test.gif │ │ ├── pprof-vsnprintf-big.gif │ │ ├── pprof-vsnprintf.gif │ │ ├── pprof.1 │ │ ├── pprof_remote_servers.html │ │ ├── spanmap.dot │ │ ├── spanmap.gif │ │ ├── t-test1.times.txt │ │ ├── tcmalloc-opspercpusec.vs.threads.1024.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.128.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.131072.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.16384.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.2048.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.256.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.32768.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.4096.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.512.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.64.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.65536.bytes.png │ │ ├── tcmalloc-opspercpusec.vs.threads.8192.bytes.png │ │ ├── tcmalloc-opspersec.vs.size.1.threads.png │ │ ├── tcmalloc-opspersec.vs.size.12.threads.png │ │ ├── tcmalloc-opspersec.vs.size.16.threads.png │ │ ├── tcmalloc-opspersec.vs.size.2.threads.png │ │ ├── tcmalloc-opspersec.vs.size.20.threads.png │ │ ├── tcmalloc-opspersec.vs.size.3.threads.png │ │ ├── tcmalloc-opspersec.vs.size.4.threads.png │ │ ├── tcmalloc-opspersec.vs.size.5.threads.png │ │ ├── tcmalloc-opspersec.vs.size.8.threads.png │ │ ├── tcmalloc.html │ │ ├── threadheap.dot │ │ └── threadheap.gif │ ├── gperftools.sln │ ├── install-sh │ ├── libtool │ ├── ltmain.sh │ ├── m4 │ │ ├── ac_have_attribute.m4 │ │ ├── acx_nanosleep.m4 │ │ ├── acx_pthread.m4 │ │ ├── compiler_characteristics.m4 │ │ ├── install_prefix.m4 │ │ ├── libtool.m4 │ │ ├── ltoptions.m4 │ │ ├── ltsugar.m4 │ │ ├── ltversion.m4 │ │ ├── lt~obsolete.m4 │ │ ├── namespaces.m4 │ │ ├── pc_from_ucontext.m4 │ │ ├── program_invocation_name.m4 │ │ └── stl_namespace.m4 │ ├── missing │ ├── packages │ │ ├── deb.sh │ │ ├── deb │ │ │ ├── README │ │ │ ├── changelog │ │ │ ├── compat │ │ │ ├── control │ │ │ ├── copyright │ │ │ ├── docs │ │ │ ├── libgperftools-dev.dirs │ │ │ ├── libgperftools-dev.install │ │ │ ├── libgperftools0.dirs │ │ │ ├── libgperftools0.install │ │ │ ├── libgperftools0.manpages │ │ │ └── rules │ │ ├── rpm.sh │ │ └── rpm │ │ │ └── rpm.spec │ ├── src │ │ ├── addressmap-inl.h │ │ ├── base │ │ │ ├── arm_instruction_set_select.h │ │ │ ├── atomicops-internals-arm-generic.h │ │ │ ├── atomicops-internals-arm-v6plus.h │ │ │ ├── atomicops-internals-linuxppc.h │ │ │ ├── atomicops-internals-macosx.h │ │ │ ├── atomicops-internals-windows.h │ │ │ ├── atomicops-internals-x86.cc │ │ │ ├── atomicops-internals-x86.h │ │ │ ├── atomicops.h │ │ │ ├── basictypes.h │ │ │ ├── commandlineflags.h │ │ │ ├── cycleclock.h │ │ │ ├── dynamic_annotations.c │ │ │ ├── dynamic_annotations.h │ │ │ ├── elf_mem_image.cc │ │ │ ├── elf_mem_image.h │ │ │ ├── elfcore.h │ │ │ ├── googleinit.h │ │ │ ├── linux_syscall_support.h │ │ │ ├── linuxthreads.cc │ │ │ ├── linuxthreads.h │ │ │ ├── logging.cc │ │ │ ├── logging.h │ │ │ ├── low_level_alloc.cc │ │ │ ├── low_level_alloc.h │ │ │ ├── simple_mutex.h │ │ │ ├── spinlock.cc │ │ │ ├── spinlock.h │ │ │ ├── spinlock_internal.cc │ │ │ ├── spinlock_internal.h │ │ │ ├── spinlock_linux-inl.h │ │ │ ├── spinlock_posix-inl.h │ │ │ ├── spinlock_win32-inl.h │ │ │ ├── stl_allocator.h │ │ │ ├── synchronization_profiling.h │ │ │ ├── sysinfo.cc │ │ │ ├── sysinfo.h │ │ │ ├── thread_annotations.h │ │ │ ├── thread_lister.c │ │ │ ├── thread_lister.h │ │ │ ├── vdso_support.cc │ │ │ └── vdso_support.h │ │ ├── central_freelist.cc │ │ ├── central_freelist.h │ │ ├── common.cc │ │ ├── common.h │ │ ├── config.h.in │ │ ├── config_for_unittests.h │ │ ├── debugallocation.cc │ │ ├── getpc.h │ │ ├── google │ │ │ ├── heap-checker.h │ │ │ ├── heap-profiler.h │ │ │ ├── malloc_extension.h │ │ │ ├── malloc_extension_c.h │ │ │ ├── malloc_hook.h │ │ │ ├── malloc_hook_c.h │ │ │ ├── profiler.h │ │ │ ├── stacktrace.h │ │ │ └── tcmalloc.h │ │ ├── gperftools │ │ │ ├── heap-checker.h │ │ │ ├── heap-profiler.h │ │ │ ├── malloc_extension.h │ │ │ ├── malloc_extension_c.h │ │ │ ├── malloc_hook.h │ │ │ ├── malloc_hook_c.h │ │ │ ├── profiler.h │ │ │ ├── stacktrace.h │ │ │ └── tcmalloc.h.in │ │ ├── heap-checker-bcad.cc │ │ ├── heap-checker.cc │ │ ├── heap-profile-table.cc │ │ ├── heap-profile-table.h │ │ ├── heap-profiler.cc │ │ ├── internal_logging.cc │ │ ├── internal_logging.h │ │ ├── libc_override.h │ │ ├── libc_override_gcc_and_weak.h │ │ ├── libc_override_glibc.h │ │ ├── libc_override_osx.h │ │ ├── libc_override_redefine.h │ │ ├── linked_list.h │ │ ├── malloc_extension.cc │ │ ├── malloc_hook-inl.h │ │ ├── malloc_hook.cc │ │ ├── malloc_hook_mmap_freebsd.h │ │ ├── malloc_hook_mmap_linux.h │ │ ├── maybe_threads.cc │ │ ├── maybe_threads.h │ │ ├── memfs_malloc.cc │ │ ├── memory_region_map.cc │ │ ├── memory_region_map.h │ │ ├── packed-cache-inl.h │ │ ├── page_heap.cc │ │ ├── page_heap.h │ │ ├── page_heap_allocator.h │ │ ├── pagemap.h │ │ ├── pprof │ │ ├── profile-handler.cc │ │ ├── profile-handler.h │ │ ├── profiledata.cc │ │ ├── profiledata.h │ │ ├── profiler.cc │ │ ├── raw_printer.cc │ │ ├── raw_printer.h │ │ ├── sampler.cc │ │ ├── sampler.h │ │ ├── solaris │ │ │ └── libstdc++.la │ │ ├── span.cc │ │ ├── span.h │ │ ├── stack_trace_table.cc │ │ ├── stack_trace_table.h │ │ ├── stacktrace.cc │ │ ├── stacktrace_arm-inl.h │ │ ├── stacktrace_config.h │ │ ├── stacktrace_generic-inl.h │ │ ├── stacktrace_libunwind-inl.h │ │ ├── stacktrace_powerpc-inl.h │ │ ├── stacktrace_win32-inl.h │ │ ├── stacktrace_x86-inl.h │ │ ├── static_vars.cc │ │ ├── static_vars.h │ │ ├── symbolize.cc │ │ ├── symbolize.h │ │ ├── system-alloc.cc │ │ ├── system-alloc.h │ │ ├── tcmalloc.cc │ │ ├── tcmalloc.h │ │ ├── tcmalloc_guard.h │ │ ├── tests │ │ │ ├── addressmap_unittest.cc │ │ │ ├── atomicops_unittest.cc │ │ │ ├── current_allocated_bytes_test.cc │ │ │ ├── debugallocation_test.cc │ │ │ ├── debugallocation_test.sh │ │ │ ├── frag_unittest.cc │ │ │ ├── getpc_test.cc │ │ │ ├── heap-checker-death_unittest.sh │ │ │ ├── heap-checker_unittest.cc │ │ │ ├── heap-checker_unittest.sh │ │ │ ├── heap-profiler_unittest.cc │ │ │ ├── heap-profiler_unittest.sh │ │ │ ├── large_heap_fragmentation_unittest.cc │ │ │ ├── low_level_alloc_unittest.cc │ │ │ ├── malloc_extension_c_test.c │ │ │ ├── malloc_extension_test.cc │ │ │ ├── malloc_hook_test.cc │ │ │ ├── markidle_unittest.cc │ │ │ ├── maybe_threads_unittest.sh │ │ │ ├── memalign_unittest.cc │ │ │ ├── packed-cache_test.cc │ │ │ ├── page_heap_test.cc │ │ │ ├── pagemap_unittest.cc │ │ │ ├── profile-handler_unittest.cc │ │ │ ├── profiledata_unittest.cc │ │ │ ├── profiler_unittest.cc │ │ │ ├── profiler_unittest.sh │ │ │ ├── raw_printer_test.cc │ │ │ ├── realloc_unittest.cc │ │ │ ├── sampler_test.cc │ │ │ ├── sampling_test.cc │ │ │ ├── sampling_test.sh │ │ │ ├── simple_compat_test.cc │ │ │ ├── stack_trace_table_test.cc │ │ │ ├── stacktrace_unittest.cc │ │ │ ├── system-alloc_unittest.cc │ │ │ ├── tcmalloc_large_unittest.cc │ │ │ ├── tcmalloc_unittest.cc │ │ │ ├── tcmalloc_unittest.sh │ │ │ ├── testutil.cc │ │ │ ├── testutil.h │ │ │ └── thread_dealloc_unittest.cc │ │ ├── third_party │ │ │ └── valgrind.h │ │ ├── thread_cache.cc │ │ ├── thread_cache.h │ │ └── windows │ │ │ ├── addr2line-pdb.c │ │ │ ├── auto_testing_hook.h │ │ │ ├── config.h │ │ │ ├── get_mangled_names.cc │ │ │ ├── gperftools │ │ │ ├── tcmalloc.h │ │ │ └── tcmalloc.h.in │ │ │ ├── ia32_modrm_map.cc │ │ │ ├── ia32_opcode_map.cc │ │ │ ├── mingw.h │ │ │ ├── mini_disassembler.cc │ │ │ ├── mini_disassembler.h │ │ │ ├── mini_disassembler_types.h │ │ │ ├── nm-pdb.c │ │ │ ├── override_functions.cc │ │ │ ├── patch_functions.cc │ │ │ ├── port.cc │ │ │ ├── port.h │ │ │ ├── preamble_patcher.cc │ │ │ ├── preamble_patcher.h │ │ │ ├── preamble_patcher_test.cc │ │ │ ├── preamble_patcher_with_stub.cc │ │ │ └── shortproc.asm │ ├── test-driver │ └── vsprojects │ │ ├── addr2line-pdb │ │ └── addr2line-pdb.vcproj │ │ ├── addressmap_unittest │ │ └── addressmap_unittest.vcproj │ │ ├── current_allocated_bytes_test │ │ └── current_allocated_bytes_test.vcproj │ │ ├── frag_unittest │ │ └── frag_unittest.vcproj │ │ ├── libtcmalloc_minimal │ │ └── libtcmalloc_minimal.vcproj │ │ ├── low_level_alloc_unittest │ │ └── low_level_alloc_unittest.vcproj │ │ ├── malloc_extension_test │ │ └── malloc_extension_test.vcproj │ │ ├── malloc_hook_test │ │ └── malloc_hook_test.vcproj │ │ ├── markidle_unittest │ │ └── markidle_unittest.vcproj │ │ ├── nm-pdb │ │ └── nm-pdb.vcproj │ │ ├── packed-cache_test │ │ └── packed-cache_test.vcproj │ │ ├── page_heap_test │ │ └── page_heap_test.vcproj │ │ ├── pagemap_unittest │ │ └── pagemap_unittest.vcproj │ │ ├── preamble_patcher_test │ │ └── preamble_patcher_test.vcproj │ │ ├── realloc_unittest │ │ └── realloc_unittest.vcproj │ │ ├── sampler_test │ │ └── sampler_test.vcproj │ │ ├── stack_trace_table_test │ │ └── stack_trace_table_test.vcproj │ │ ├── tcmalloc_minimal_large │ │ └── tcmalloc_minimal_large_unittest.vcproj │ │ ├── tcmalloc_minimal_unittest │ │ └── tcmalloc_minimal_unittest.vcproj │ │ ├── thread_dealloc_unittest │ │ └── thread_dealloc_unittest.vcproj │ │ └── tmu-static │ │ └── tmu-static.vcproj └── libevent2 │ ├── ChangeLog │ ├── Doxyfile │ ├── LICENSE │ ├── Makefile.am │ ├── Makefile.in │ ├── Makefile.nmake │ ├── README │ ├── WIN32-Code │ ├── event2 │ │ └── event-config.h │ └── tree.h │ ├── aclocal.m4 │ ├── arc4random.c │ ├── autogen.sh │ ├── buffer.c │ ├── buffer_iocp.c │ ├── bufferevent-internal.h │ ├── bufferevent.c │ ├── bufferevent_async.c │ ├── bufferevent_filter.c │ ├── bufferevent_openssl.c │ ├── bufferevent_pair.c │ ├── bufferevent_ratelim.c │ ├── bufferevent_sock.c │ ├── changelist-internal.h │ ├── compat │ └── sys │ │ └── queue.h │ ├── compile │ ├── config.guess │ ├── config.h.in │ ├── config.sub │ ├── configure │ ├── configure.in │ ├── defer-internal.h │ ├── depcomp │ ├── devpoll.c │ ├── epoll.c │ ├── epoll_sub.c │ ├── evbuffer-internal.h │ ├── evdns.c │ ├── evdns.h │ ├── event-internal.h │ ├── event.c │ ├── event.h │ ├── event_iocp.c │ ├── event_rpcgen.py │ ├── event_tagging.c │ ├── evhttp.h │ ├── evmap-internal.h │ ├── evmap.c │ ├── evport.c │ ├── evrpc-internal.h │ ├── evrpc.c │ ├── evrpc.h │ ├── evsignal-internal.h │ ├── evthread-internal.h │ ├── evthread.c │ ├── evthread_pthread.c │ ├── evthread_win32.c │ ├── evutil.c │ ├── evutil.h │ ├── evutil_rand.c │ ├── ht-internal.h │ ├── http-internal.h │ ├── http.c │ ├── include │ ├── Makefile.am │ ├── Makefile.in │ └── event2 │ │ ├── buffer.h │ │ ├── buffer_compat.h │ │ ├── bufferevent.h │ │ ├── bufferevent_compat.h │ │ ├── bufferevent_ssl.h │ │ ├── bufferevent_struct.h │ │ ├── dns.h │ │ ├── dns_compat.h │ │ ├── dns_struct.h │ │ ├── event.h │ │ ├── event_compat.h │ │ ├── event_struct.h │ │ ├── http.h │ │ ├── http_compat.h │ │ ├── http_struct.h │ │ ├── keyvalq_struct.h │ │ ├── listener.h │ │ ├── rpc.h │ │ ├── rpc_compat.h │ │ ├── rpc_struct.h │ │ ├── tag.h │ │ ├── tag_compat.h │ │ ├── thread.h │ │ └── util.h │ ├── install-sh │ ├── iocp-internal.h │ ├── ipv6-internal.h │ ├── kqueue.c │ ├── libevent.pc.in │ ├── libevent_openssl.pc.in │ ├── libevent_pthreads.pc.in │ ├── listener.c │ ├── log-internal.h │ ├── log.c │ ├── ltmain.sh │ ├── m4 │ ├── acx_pthread.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ └── lt~obsolete.m4 │ ├── make-event-config.sed │ ├── minheap-internal.h │ ├── missing │ ├── mm-internal.h │ ├── poll.c │ ├── ratelim-internal.h │ ├── sample │ ├── Makefile.am │ ├── Makefile.in │ ├── dns-example.c │ ├── event-test.c │ ├── hello-world.c │ ├── http-server.c │ ├── le-proxy.c │ ├── signal-test.c │ └── time-test.c │ ├── select.c │ ├── signal.c │ ├── strlcpy-internal.h │ ├── strlcpy.c │ ├── test │ ├── Makefile.am │ ├── Makefile.in │ ├── Makefile.nmake │ ├── bench.c │ ├── bench_cascade.c │ ├── bench_http.c │ ├── bench_httpclient.c │ ├── regress.c │ ├── regress.gen.c │ ├── regress.gen.h │ ├── regress.h │ ├── regress.rpc │ ├── regress_buffer.c │ ├── regress_bufferevent.c │ ├── regress_dns.c │ ├── regress_et.c │ ├── regress_http.c │ ├── regress_iocp.c │ ├── regress_listener.c │ ├── regress_main.c │ ├── regress_minheap.c │ ├── regress_rpc.c │ ├── regress_ssl.c │ ├── regress_testutils.c │ ├── regress_testutils.h │ ├── regress_thread.c │ ├── regress_util.c │ ├── regress_zlib.c │ ├── rpcgen_wrapper.sh │ ├── test-changelist.c │ ├── test-eof.c │ ├── test-init.c │ ├── test-ratelim.c │ ├── test-time.c │ ├── test-weof.c │ ├── test.sh │ ├── tinytest.c │ ├── tinytest.h │ ├── tinytest_local.h │ └── tinytest_macros.h │ ├── util-internal.h │ ├── whatsnew-2.0.txt │ └── win32select.c ├── etc └── kvproxy.ini ├── sbin └── kvproxy ├── src ├── Makefile ├── config.cpp ├── config.h ├── conn_pool.cpp ├── conn_pool.h ├── ext │ └── memcached │ │ ├── Makefile │ │ ├── memcached.cpp │ │ ├── memcached.h │ │ └── protocol_binary.h ├── extension.cpp ├── extension.h ├── hash.cpp ├── hash.h ├── kvproxy.cpp ├── kvproxy.h ├── log.cpp ├── log.h ├── serv.cpp ├── serv.h ├── util.cpp ├── util.h └── version.h └── test ├── gprof2dot.py ├── makefile ├── test_config.cpp ├── test_conn.cpp ├── test_ext.cpp ├── test_hash.cpp ├── test_log.cpp ├── test_serv.cpp └── test_util.cpp /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, exinnet 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of kvproxy nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX=/usr/local/kvproxy 2 | 3 | $(shell sh build.sh 1>&2) 4 | include build_config.mk 5 | 6 | all: 7 | @echo 8 | @echo "##### init folders ... #####" 9 | mkdir -p ./ext 10 | mkdir -p ./etc 11 | mkdir -p ./bin 12 | mkdir -p ./sbin 13 | mkdir -p ./log 14 | @echo "##### init folders finished #####" 15 | @echo 16 | @echo "##### building kvproxy ... #####" 17 | cd ./src; ${MAKE} 18 | @echo "##### building kvproxy finished #####" 19 | @echo 20 | @echo "##### building extension [memcached] ... #####" 21 | cd ./src/ext/memcached; ${MAKE}; ${MAKE} install 22 | @echo "##### building extension [memcached] finished #####" 23 | @echo 24 | @echo "##### building finished. #####" 25 | @echo 26 | @echo "##### if you want to install kvproxy to folder[${PREFIX}], you should run the command [make install] #####" 27 | @echo 28 | 29 | install: 30 | mkdir -p ${PREFIX} 31 | mkdir -p ${PREFIX}/log 32 | cp -r ./bin ${PREFIX} 33 | cp -r ./sbin ${PREFIX} 34 | cp -r ./etc ${PREFIX} 35 | cp -r ./ext ${PREFIX} 36 | chmod 755 ${PREFIX} 37 | chmod +x -R ${PREFIX}/sbin 38 | chmod 777 ${PREFIX}/log 39 | @echo "install to folder $(PREFIX) finished" 40 | 41 | clean: 42 | cd "${LIBEVENT_PATH}"; ${MAKE} clean 43 | cd ./src; ${MAKE} clean 44 | cd ./src/ext/memcached; ${MAKE} clean 45 | rm -f ./build_config.mk 46 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | BASE_DIR=`pwd` 3 | LIBEVENT_PATH="$BASE_DIR/deps/libevent2" 4 | TCMALLOC_PATH="$BASE_DIR/deps/gperftools2" 5 | 6 | if test -z "$TARGET_OS"; then 7 | TARGET_OS=`uname -s` 8 | fi 9 | if test -z "$MAKE"; then 10 | MAKE=make 11 | fi 12 | if test -z "$CC"; then 13 | CC=gcc 14 | fi 15 | if test -z "$CXX"; then 16 | CXX=g++ 17 | fi 18 | 19 | case "$TARGET_OS" in 20 | Darwin) 21 | PLATFORM_CLIBS="-ldl -pthread -std=c++0x" 22 | ;; 23 | Linux) 24 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 25 | ;; 26 | OS_ANDROID_CROSSCOMPILE) 27 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 28 | ;; 29 | CYGWIN_*) 30 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 31 | ;; 32 | SunOS) 33 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 34 | ;; 35 | FreeBSD) 36 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 37 | MAKE=gmake 38 | ;; 39 | NetBSD) 40 | PLATFORM_CLIBS="-ldl -pthread -lgcc_s -lrt -std=c++0x" 41 | ;; 42 | OpenBSD) 43 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 44 | ;; 45 | DragonFly) 46 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 47 | ;; 48 | HP-UX) 49 | PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x" 50 | ;; 51 | *) 52 | echo "Unknown platform!" >&2 53 | exit 1 54 | esac 55 | 56 | DIR=`pwd` 57 | cd $LIBEVENT_PATH 58 | if [ ! -f "$LIBEVENT_PATH/.libs/libevent.a" ]; then 59 | echo "" 60 | echo "##### building libevent... #####" 61 | ./configure 62 | make 63 | cp "$LIBEVENT_PATH/event.h" "$LIBEVENT_PATH/include/event.h" 64 | cp "$LIBEVENT_PATH/evutil.h" "$LIBEVENT_PATH/include/evutil.h" 65 | echo "##### building libevent finished #####" 66 | echo "" 67 | fi 68 | cd "$DIR" 69 | 70 | DIR=`pwd` 71 | cd $TCMALLOC_PATH 72 | if [ ! -f "$TCMALLOC_PATH/.libs/libtcmalloc_minimal.a" ]; then 73 | echo "" 74 | echo "##### building tcmalloc... #####" 75 | ./configure --disable-cpu-profiler --disable-heap-profiler --disable-heap-checker --disable-debugalloc --enable-minimal 76 | make 77 | echo "##### building tcmalloc finished #####" 78 | echo "" 79 | fi 80 | cd "$DIR" 81 | 82 | rm -f build_config.mk 83 | echo CC=$CC >> build_config.mk 84 | echo CXX=$CXX >> build_config.mk 85 | echo "MAKE=$MAKE" >> build_config.mk 86 | echo "LIBEVENT_PATH=$LIBEVENT_PATH" >> build_config.mk 87 | 88 | echo "CFLAGS=" >> build_config.mk 89 | echo "CFLAGS = -DNDEBUG -D__STDC_FORMAT_MACROS -g -O2 -Wno-sign-compare" >> build_config.mk 90 | echo "CFLAGS += ${PLATFORM_CFLAGS}" >> build_config.mk 91 | echo "CFLAGS += -I \"$LIBEVENT_PATH/include\"" >> build_config.mk 92 | 93 | echo "CLIBS=" >> build_config.mk 94 | echo "CLIBS += ${PLATFORM_CLIBS}" >> build_config.mk 95 | echo "CLIBS += \"$LIBEVENT_PATH/.libs/libevent.a\"" >> build_config.mk 96 | 97 | if [ -f "$TCMALLOC_PATH/.libs/libtcmalloc_minimal.a" ]; then 98 | echo "CLIBS += \"$TCMALLOC_PATH/.libs/libtcmalloc_minimal.a\"" >> build_config.mk 99 | fi 100 | echo "##tips: if stoped, please run command [make] again ##" 101 | -------------------------------------------------------------------------------- /deps/gperftools2/AUTHORS: -------------------------------------------------------------------------------- 1 | google-perftools@googlegroups.com 2 | 3 | -------------------------------------------------------------------------------- /deps/gperftools2/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /deps/gperftools2/TODO: -------------------------------------------------------------------------------- 1 | HEAP PROFILER 2 | 3 | 1) Fix heap profiling under all STLs 4 | * Find out how to force non-glibc STL libraries to call new() and 5 | delete() for every allocation / deallocation. 6 | * Make heap profiler ignore STL-internal allocations for those 7 | libraries under which we cannot profile accurately, so we only 8 | see object-level leaks. 9 | 2) Remove dependency on tcmalloc? 10 | 3) Port to non-linux O/Ses (right now code uses /proc for library info) 11 | 4) Port to non-x86 architectures (locking code in spinlock is x86-specific) 12 | 5) Port to C? 13 | 6) Figure out how to get setenv() to work properly before main() in 14 | shared libaries, and get rid of the profile-naming hack once we 15 | do. (See HeapProfiler::Init().) 16 | 17 | 18 | HEAP CHECKER 19 | 20 | 1) Remove requirement that the heap-checker must be linked last into 21 | an application (hard! -- it needs its global constructor to run 22 | first) 23 | 24 | TCMALLOC 25 | 26 | 1) Implement mallinfo/mallopt 27 | 2) Have tcmalloc work correctly when libpthread is not linked in 28 | (currently working for glibc, could use other libc's too) 29 | 3) Return memory to the system when requirements drop 30 | 4) Explore coloring allocated objects to avoid cache conflicts 31 | 5) Explore biasing reclamation to larger addresses 32 | 6) Add contention stats to a synchronization.cc (can do spinlocks, 33 | but threads? -- may have to provide our own thread implementation) 34 | 35 | CPU PROFILER 36 | 37 | 1) Figure out how to get setenv() to work properly before main() in 38 | shared libaries(), and get rid of the profile-naming hack once we 39 | do. (See Profiler::GetUniquePathFromEnv().) 40 | 2) Resolve crashing problems on x86_64 (see README) 41 | 42 | STACKTRACE 43 | 44 | 1) Remove dependency on linux/x86 45 | 46 | --- 47 | 11 March 2008 48 | -------------------------------------------------------------------------------- /deps/gperftools2/doc/designstyle.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ffffff; 3 | color: black; 4 | margin-right: 1in; 5 | margin-left: 1in; 6 | } 7 | 8 | 9 | h1, h2, h3, h4, h5, h6 { 10 | color: #3366ff; 11 | font-family: sans-serif; 12 | } 13 | @media print { 14 | /* Darker version for printing */ 15 | h1, h2, h3, h4, h5, h6 { 16 | color: #000080; 17 | font-family: helvetica, sans-serif; 18 | } 19 | } 20 | 21 | h1 { 22 | text-align: center; 23 | font-size: 18pt; 24 | } 25 | h2 { 26 | margin-left: -0.5in; 27 | } 28 | h3 { 29 | margin-left: -0.25in; 30 | } 31 | h4 { 32 | margin-left: -0.125in; 33 | } 34 | hr { 35 | margin-left: -1in; 36 | } 37 | 38 | /* Definition lists: definition term bold */ 39 | dt { 40 | font-weight: bold; 41 | } 42 | 43 | address { 44 | text-align: right; 45 | } 46 | /* Use the tag for bits of code and for variables and objects. */ 47 | code,pre,samp,var { 48 | color: #006000; 49 | } 50 | /* Use the tag for file and directory paths and names. */ 51 | file { 52 | color: #905050; 53 | font-family: monospace; 54 | } 55 | /* Use the tag for stuff the user should type. */ 56 | kbd { 57 | color: #600000; 58 | } 59 | div.note p { 60 | float: right; 61 | width: 3in; 62 | margin-right: 0%; 63 | padding: 1px; 64 | border: 2px solid #6060a0; 65 | background-color: #fffff0; 66 | } 67 | 68 | UL.nobullets { 69 | list-style-type: none; 70 | list-style-image: none; 71 | margin-left: -1em; 72 | } 73 | 74 | /* pretty printing styles. See prettify.js */ 75 | .str { color: #080; } 76 | .kwd { color: #008; } 77 | .com { color: #800; } 78 | .typ { color: #606; } 79 | .lit { color: #066; } 80 | .pun { color: #660; } 81 | .pln { color: #000; } 82 | .tag { color: #008; } 83 | .atn { color: #606; } 84 | .atv { color: #080; } 85 | pre.prettyprint { padding: 2px; border: 1px solid #888; } 86 | 87 | .embsrc { background: #eee; } 88 | 89 | @media print { 90 | .str { color: #060; } 91 | .kwd { color: #006; font-weight: bold; } 92 | .com { color: #600; font-style: italic; } 93 | .typ { color: #404; font-weight: bold; } 94 | .lit { color: #044; } 95 | .pun { color: #440; } 96 | .pln { color: #000; } 97 | .tag { color: #006; font-weight: bold; } 98 | .atn { color: #404; } 99 | .atv { color: #060; } 100 | } 101 | 102 | /* Table Column Headers */ 103 | .hdr { 104 | color: #006; 105 | font-weight: bold; 106 | background-color: #dddddd; } 107 | .hdr2 { 108 | color: #006; 109 | background-color: #eeeeee; } -------------------------------------------------------------------------------- /deps/gperftools2/doc/heap-example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/heap-example1.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Gperftools 5 | 6 | 7 | 8 | 14 | 15 |
16 | Last modified: Thu Feb 2 14:40:47 PST 2012 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /deps/gperftools2/doc/overview.dot: -------------------------------------------------------------------------------- 1 | digraph Overview { 2 | node [shape = box] 3 | 4 | {rank=same 5 | T1 [label="Thread Cache"] 6 | Tsep [label="...", shape=plaintext] 7 | Tn [label="Thread Cache"] 8 | T1 -> Tsep -> Tn [style=invis] 9 | } 10 | 11 | C [label="Central\nHeap"] 12 | T1 -> C [dir=both] 13 | Tn -> C [dir=both] 14 | 15 | } 16 | -------------------------------------------------------------------------------- /deps/gperftools2/doc/overview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/overview.gif -------------------------------------------------------------------------------- /deps/gperftools2/doc/pageheap.dot: -------------------------------------------------------------------------------- 1 | digraph PageHeap { 2 | rankdir=LR 3 | node [shape=box, width=0.3, height=0.3] 4 | nodesep=.05 5 | 6 | heap [shape=record, height=3, label="1 page|2 pages|3 pages|...|255 pages|rest"] 7 | O0 [shape=record, label=""] 8 | O1 [shape=record, label=""] 9 | O2 [shape=record, label="{|}"] 10 | O3 [shape=record, label="{|}"] 11 | O4 [shape=record, label="{||}"] 12 | O5 [shape=record, label="{||}"] 13 | O6 [shape=record, label="{|...|}"] 14 | O7 [shape=record, label="{|...|}"] 15 | O8 [shape=record, label="{|.....|}"] 16 | O9 [shape=record, label="{|.....|}"] 17 | sep1 [shape=plaintext, label="..."] 18 | sep2 [shape=plaintext, label="..."] 19 | sep3 [shape=plaintext, label="..."] 20 | sep4 [shape=plaintext, label="..."] 21 | sep5 [shape=plaintext, label="..."] 22 | 23 | heap:f0 -> O0 -> O1 -> sep1 24 | heap:f1 -> O2 -> O3 -> sep2 25 | heap:f2 -> O4 -> O5 -> sep3 26 | heap:f255 -> O6 -> O7 -> sep4 27 | heap:frest -> O8 -> O9 -> sep5 28 | 29 | } 30 | -------------------------------------------------------------------------------- /deps/gperftools2/doc/pageheap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/pageheap.gif -------------------------------------------------------------------------------- /deps/gperftools2/doc/pprof-test-big.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/pprof-test-big.gif -------------------------------------------------------------------------------- /deps/gperftools2/doc/pprof-test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/pprof-test.gif -------------------------------------------------------------------------------- /deps/gperftools2/doc/pprof-vsnprintf-big.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/pprof-vsnprintf-big.gif -------------------------------------------------------------------------------- /deps/gperftools2/doc/pprof-vsnprintf.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/pprof-vsnprintf.gif -------------------------------------------------------------------------------- /deps/gperftools2/doc/spanmap.dot: -------------------------------------------------------------------------------- 1 | digraph SpanMap { 2 | node [shape=box, width=0.3, height=0.3] 3 | nodesep=.05 4 | 5 | map [shape=record, width=6, label="||||||||||"] 6 | S0 [label="a"] 7 | S1 [label="b"] 8 | S2 [label="c"] 9 | S3 [label="d"] 10 | map:f0 -> S0 11 | map:f1 -> S0 12 | map:f2 -> S1 13 | map:f3 -> S2 14 | map:f4 -> S2 15 | map:f5 -> S2 16 | map:f6 -> S2 17 | map:f7 -> S2 18 | map:f8 -> S3 19 | map:f9 -> S3 20 | map:f10 -> S3 21 | 22 | } 23 | -------------------------------------------------------------------------------- /deps/gperftools2/doc/spanmap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/spanmap.gif -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.1024.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.1024.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.128.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.128.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.131072.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.131072.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.16384.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.16384.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.2048.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.2048.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.256.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.256.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.32768.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.32768.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.4096.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.4096.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.512.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.512.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.64.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.64.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.65536.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.65536.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.8192.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.8192.bytes.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.1.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.1.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.12.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.12.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.16.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.16.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.2.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.2.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.20.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.20.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.3.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.3.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.4.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.4.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.5.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.5.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/tcmalloc-opspersec.vs.size.8.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.8.threads.png -------------------------------------------------------------------------------- /deps/gperftools2/doc/threadheap.dot: -------------------------------------------------------------------------------- 1 | digraph ThreadHeap { 2 | rankdir=LR 3 | node [shape=box, width=0.3, height=0.3] 4 | nodesep=.05 5 | 6 | heap [shape=record, height=2, label="class 0|class 1|class 2|..."] 7 | O0 [label=""] 8 | O1 [label=""] 9 | O2 [label=""] 10 | O3 [label=""] 11 | O4 [label=""] 12 | O5 [label=""] 13 | sep1 [shape=plaintext, label="..."] 14 | sep2 [shape=plaintext, label="..."] 15 | sep3 [shape=plaintext, label="..."] 16 | 17 | heap:f0 -> O0 -> O1 -> sep1 18 | heap:f1 -> O2 -> O3 -> sep2 19 | heap:f2 -> O4 -> O5 -> sep3 20 | 21 | } 22 | -------------------------------------------------------------------------------- /deps/gperftools2/doc/threadheap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/doc/threadheap.gif -------------------------------------------------------------------------------- /deps/gperftools2/m4/ac_have_attribute.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([AX_C___ATTRIBUTE__], [ 2 | AC_MSG_CHECKING(for __attribute__) 3 | AC_CACHE_VAL(ac_cv___attribute__, [ 4 | AC_TRY_COMPILE( 5 | [#include 6 | static void foo(void) __attribute__ ((unused)); 7 | void foo(void) { exit(1); }], 8 | [], 9 | ac_cv___attribute__=yes, 10 | ac_cv___attribute__=no 11 | )]) 12 | if test "$ac_cv___attribute__" = "yes"; then 13 | AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__]) 14 | fi 15 | AC_MSG_RESULT($ac_cv___attribute__) 16 | ]) 17 | -------------------------------------------------------------------------------- /deps/gperftools2/m4/acx_nanosleep.m4: -------------------------------------------------------------------------------- 1 | # Check for support for nanosleep. It's defined in , but on 2 | # some systems, such as solaris, you need to link in a library to use it. 3 | # We set acx_nanosleep_ok if nanosleep is supported; in that case, 4 | # NANOSLEEP_LIBS is set to whatever libraries are needed to support 5 | # nanosleep. 6 | 7 | AC_DEFUN([ACX_NANOSLEEP], 8 | [AC_MSG_CHECKING(if nanosleep requires any libraries) 9 | AC_LANG_SAVE 10 | AC_LANG_C 11 | acx_nanosleep_ok="no" 12 | NANOSLEEP_LIBS= 13 | # For most folks, this should just work 14 | AC_TRY_LINK([#include ], 15 | [static struct timespec ts; nanosleep(&ts, NULL);], 16 | [acx_nanosleep_ok=yes]) 17 | # For solaris, we may need -lrt 18 | if test "x$acx_nanosleep_ok" != "xyes"; then 19 | OLD_LIBS="$LIBS" 20 | LIBS="-lrt $LIBS" 21 | AC_TRY_LINK([#include ], 22 | [static struct timespec ts; nanosleep(&ts, NULL);], 23 | [acx_nanosleep_ok=yes]) 24 | if test "x$acx_nanosleep_ok" = "xyes"; then 25 | NANOSLEEP_LIBS="-lrt" 26 | fi 27 | LIBS="$OLD_LIBS" 28 | fi 29 | if test "x$acx_nanosleep_ok" != "xyes"; then 30 | AC_MSG_ERROR([cannot find the nanosleep function]) 31 | else 32 | AC_MSG_RESULT(${NANOSLEEP_LIBS:-no}) 33 | fi 34 | AC_LANG_RESTORE 35 | ]) 36 | -------------------------------------------------------------------------------- /deps/gperftools2/m4/compiler_characteristics.m4: -------------------------------------------------------------------------------- 1 | # Check compiler characteristics (e.g. type sizes, PRIxx macros, ...) 2 | 3 | # If types $1 and $2 are compatible, perform action $3 4 | AC_DEFUN([AC_TYPES_COMPATIBLE], 5 | [AC_TRY_COMPILE([#include ], [$1 v1 = 0; $2 v2 = 0; return (&v1 - &v2)], $3)]) 6 | 7 | define(AC_PRIUS_COMMENT, [printf format code for printing a size_t and ssize_t]) 8 | 9 | AC_DEFUN([AC_COMPILER_CHARACTERISTICS], 10 | [AC_CACHE_CHECK(AC_PRIUS_COMMENT, ac_cv_formatting_prius_prefix, 11 | [AC_TYPES_COMPATIBLE(unsigned int, size_t, 12 | ac_cv_formatting_prius_prefix=; ac_cv_prius_defined=1) 13 | AC_TYPES_COMPATIBLE(unsigned long, size_t, 14 | ac_cv_formatting_prius_prefix=l; ac_cv_prius_defined=1) 15 | AC_TYPES_COMPATIBLE(unsigned long long, size_t, 16 | ac_cv_formatting_prius_prefix=ll; ac_cv_prius_defined=1 17 | )]) 18 | if test -z "$ac_cv_prius_defined"; then 19 | ac_cv_formatting_prius_prefix=z; 20 | fi 21 | AC_DEFINE_UNQUOTED(PRIuS, "${ac_cv_formatting_prius_prefix}u", AC_PRIUS_COMMENT) 22 | AC_DEFINE_UNQUOTED(PRIxS, "${ac_cv_formatting_prius_prefix}x", AC_PRIUS_COMMENT) 23 | AC_DEFINE_UNQUOTED(PRIdS, "${ac_cv_formatting_prius_prefix}d", AC_PRIUS_COMMENT) 24 | ]) 25 | -------------------------------------------------------------------------------- /deps/gperftools2/m4/install_prefix.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([AC_INSTALL_PREFIX], 2 | [ac_cv_install_prefix="$prefix"; 3 | if test x"$ac_cv_install_prefix" = x"NONE" ; then 4 | ac_cv_install_prefix="$ac_default_prefix"; 5 | fi 6 | AC_DEFINE_UNQUOTED(INSTALL_PREFIX, "$ac_cv_install_prefix", 7 | [prefix where we look for installed files]) 8 | ]) 9 | -------------------------------------------------------------------------------- /deps/gperftools2/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /deps/gperftools2/m4/namespaces.m4: -------------------------------------------------------------------------------- 1 | # Checks whether the compiler implements namespaces 2 | AC_DEFUN([AC_CXX_NAMESPACES], 3 | [AC_CACHE_CHECK(whether the compiler implements namespaces, 4 | ac_cv_cxx_namespaces, 5 | [AC_LANG_SAVE 6 | AC_LANG_CPLUSPLUS 7 | AC_TRY_COMPILE([namespace Outer { 8 | namespace Inner { int i = 0; }}], 9 | [using namespace Outer::Inner; return i;], 10 | ac_cv_cxx_namespaces=yes, 11 | ac_cv_cxx_namespaces=no) 12 | AC_LANG_RESTORE]) 13 | if test "$ac_cv_cxx_namespaces" = yes; then 14 | AC_DEFINE(HAVE_NAMESPACES, 1, [define if the compiler implements namespaces]) 15 | fi]) 16 | -------------------------------------------------------------------------------- /deps/gperftools2/m4/program_invocation_name.m4: -------------------------------------------------------------------------------- 1 | # We need to be careful to avoid having the reference to 2 | # program_invocation_name optimized out. We do that by 3 | # returning the value. 4 | 5 | AC_DEFUN([AC_PROGRAM_INVOCATION_NAME], 6 | [AC_CACHE_CHECK( 7 | for program_invocation_name, 8 | ac_cv_have_program_invocation_name, 9 | AC_TRY_LINK([extern char* program_invocation_name;], 10 | [return *program_invocation_name;], 11 | [ac_cv_have_program_invocation_name=yes], 12 | [ac_cv_have_program_invocation_name=no]) 13 | ) 14 | if test "$ac_cv_have_program_invocation_name" = "yes"; then 15 | AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME, 1, 16 | [define if libc has program_invocation_name]) 17 | fi 18 | ]) 19 | 20 | -------------------------------------------------------------------------------- /deps/gperftools2/m4/stl_namespace.m4: -------------------------------------------------------------------------------- 1 | # We check what namespace stl code like vector expects to be executed in 2 | 3 | AC_DEFUN([AC_CXX_STL_NAMESPACE], 4 | [AC_CACHE_CHECK( 5 | what namespace STL code is in, 6 | ac_cv_cxx_stl_namespace, 7 | [AC_REQUIRE([AC_CXX_NAMESPACES]) 8 | AC_LANG_SAVE 9 | AC_LANG_CPLUSPLUS 10 | AC_TRY_COMPILE([#include ], 11 | [vector t; return 0;], 12 | ac_cv_cxx_stl_namespace=none) 13 | AC_TRY_COMPILE([#include ], 14 | [std::vector t; return 0;], 15 | ac_cv_cxx_stl_namespace=std) 16 | AC_LANG_RESTORE]) 17 | if test "$ac_cv_cxx_stl_namespace" = none; then 18 | AC_DEFINE(STL_NAMESPACE,, 19 | [the namespace where STL code like vector<> is defined]) 20 | fi 21 | if test "$ac_cv_cxx_stl_namespace" = std; then 22 | AC_DEFINE(STL_NAMESPACE,std, 23 | [the namespace where STL code like vector<> is defined]) 24 | fi 25 | ]) 26 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # This takes one commandline argument, the name of the package. If no 4 | # name is given, then we'll end up just using the name associated with 5 | # an arbitrary .tar.gz file in the rootdir. That's fine: there's probably 6 | # only one. 7 | # 8 | # Run this from the 'packages' directory, just under rootdir 9 | 10 | ## Set LIB to lib if exporting a library, empty-string else 11 | LIB= 12 | #LIB=lib 13 | 14 | PACKAGE="$1" 15 | VERSION="$2" 16 | 17 | # We can only build Debian packages, if the Debian build tools are installed 18 | if [ \! -x /usr/bin/debuild ]; then 19 | echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2 20 | exit 0 21 | fi 22 | 23 | # Double-check we're in the packages directory, just under rootdir 24 | if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then 25 | echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 26 | echo "Also, you must run \"make dist\" before running this script." 1>&2 27 | exit 0 28 | fi 29 | 30 | # Find the top directory for this package 31 | topdir="${PWD%/*}" 32 | 33 | # Find the tar archive built by "make dist" 34 | archive="${PACKAGE}-${VERSION}" 35 | archive_with_underscore="${PACKAGE}_${VERSION}" 36 | if [ -z "${archive}" ]; then 37 | echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2 38 | exit 0 39 | fi 40 | 41 | # Create a pristine directory for building the Debian package files 42 | trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM 43 | 44 | rm -rf tmp 45 | mkdir -p tmp 46 | cd tmp 47 | 48 | # Debian has very specific requirements about the naming of build 49 | # directories, and tar archives. It also wants to write all generated 50 | # packages to the parent of the source directory. We accommodate these 51 | # requirements by building directly from the tar file. 52 | ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive}.orig.tar.gz" 53 | # Some version of debuilder want foo.orig.tar.gz with _ between versions. 54 | ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive_with_underscore}.orig.tar.gz" 55 | tar zfx "${LIB}${archive}.orig.tar.gz" 56 | [ -n "${LIB}" ] && mv "${archive}" "${LIB}${archive}" 57 | cd "${LIB}${archive}" 58 | # This is one of those 'specific requirements': where the deb control files live 59 | cp -a "packages/deb" "debian" 60 | 61 | # Now, we can call Debian's standard build tool 62 | debuild -uc -us 63 | cd ../.. # get back to the original top-level dir 64 | 65 | # We'll put the result in a subdirectory that's named after the OS version 66 | # we've made this .deb file for. 67 | destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)" 68 | 69 | rm -rf "$destdir" 70 | mkdir -p "$destdir" 71 | mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir" 72 | 73 | echo 74 | echo "The Debian package files are located in $PWD/$destdir" 75 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/README: -------------------------------------------------------------------------------- 1 | The list of files here isn't complete. For a step-by-step guide on 2 | how to set this package up correctly, check out 3 | http://www.debian.org/doc/maint-guide/ 4 | 5 | Most of the files that are in this directory are boilerplate. 6 | However, you may need to change the list of binary-arch dependencies 7 | in 'rules'. 8 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/compat: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/control: -------------------------------------------------------------------------------- 1 | Source: gperftools 2 | Priority: optional 3 | Maintainer: gperftools Contributors 4 | Build-Depends: debhelper (>= 4.0.0), binutils 5 | Standards-Version: 3.6.1 6 | 7 | Package: libgperftools-dev 8 | Section: libdevel 9 | Architecture: any 10 | Depends: libgperftools0 (= ${Source-Version}) 11 | Description: libraries for CPU and heap analysis, plus an efficient thread-caching malloc 12 | The gperftools package contains some utilities to improve and 13 | analyze the performance of C++ programs. This includes an optimized 14 | thread-caching malloc() and cpu and heap profiling utilities. The 15 | devel package contains static and debug libraries and header files 16 | for developing applications that use the gperftools package. 17 | 18 | Package: libgperftools0 19 | Section: libs 20 | Architecture: any 21 | Depends: ${shlibs:Depends} 22 | Description: libraries for CPU and heap analysis, plus an efficient thread-caching malloc 23 | The gperftools package contains some utilities to improve and 24 | analyze the performance of C++ programs. This includes an optimized 25 | thread-caching malloc() and cpu and heap profiling utilities. 26 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by gperftools Contributors 2 | on Sat, 20 Jul 2013 14:21:10 -0700. 3 | 4 | It was downloaded from http://code.google.com/p/gperftools/downloads/list 5 | 6 | Upstream Author: google-perftools@googlegroups.com 7 | 8 | Copyright (c) 2005, Google Inc. 9 | All rights reserved. 10 | 11 | Copyright (c) 2013, gperftools Contributors 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google Inc. nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/docs: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | COPYING 3 | ChangeLog 4 | INSTALL 5 | NEWS 6 | README 7 | TODO 8 | doc/cpuprofile.html 9 | doc/cpuprofile-fileformat.html 10 | doc/designstyle.css 11 | doc/heap-example1.png 12 | doc/heap_checker.html 13 | doc/heapprofile.html 14 | doc/index.html 15 | doc/overview.gif 16 | doc/pageheap.gif 17 | doc/pprof-test-big.gif 18 | doc/pprof-test.gif 19 | doc/pprof-vsnprintf-big.gif 20 | doc/pprof-vsnprintf.gif 21 | doc/pprof.1 22 | doc/pprof_remote_servers.html 23 | doc/spanmap.gif 24 | doc/t-test1.times.txt 25 | doc/tcmalloc-opspercpusec.vs.threads.1024.bytes.png 26 | doc/tcmalloc-opspercpusec.vs.threads.128.bytes.png 27 | doc/tcmalloc-opspercpusec.vs.threads.131072.bytes.png 28 | doc/tcmalloc-opspercpusec.vs.threads.16384.bytes.png 29 | doc/tcmalloc-opspercpusec.vs.threads.2048.bytes.png 30 | doc/tcmalloc-opspercpusec.vs.threads.256.bytes.png 31 | doc/tcmalloc-opspercpusec.vs.threads.32768.bytes.png 32 | doc/tcmalloc-opspercpusec.vs.threads.4096.bytes.png 33 | doc/tcmalloc-opspercpusec.vs.threads.512.bytes.png 34 | doc/tcmalloc-opspercpusec.vs.threads.64.bytes.png 35 | doc/tcmalloc-opspercpusec.vs.threads.65536.bytes.png 36 | doc/tcmalloc-opspercpusec.vs.threads.8192.bytes.png 37 | doc/tcmalloc-opspersec.vs.size.1.threads.png 38 | doc/tcmalloc-opspersec.vs.size.12.threads.png 39 | doc/tcmalloc-opspersec.vs.size.16.threads.png 40 | doc/tcmalloc-opspersec.vs.size.2.threads.png 41 | doc/tcmalloc-opspersec.vs.size.20.threads.png 42 | doc/tcmalloc-opspersec.vs.size.3.threads.png 43 | doc/tcmalloc-opspersec.vs.size.4.threads.png 44 | doc/tcmalloc-opspersec.vs.size.5.threads.png 45 | doc/tcmalloc-opspersec.vs.size.8.threads.png 46 | doc/tcmalloc.html 47 | doc/threadheap.gif 48 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/libgperftools-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/lib/pkgconfig 3 | usr/include 4 | usr/include/google 5 | usr/include/gperftools 6 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/libgperftools-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/google/* 2 | usr/include/gperftools/* 3 | usr/lib/lib*.so 4 | usr/lib/lib*.a 5 | usr/lib/*.la 6 | usr/lib/pkgconfig/*.pc 7 | debian/tmp/usr/include/google/* 8 | debian/tmp/usr/include/gperftools/* 9 | debian/tmp/usr/lib/lib*.so 10 | debian/tmp/usr/lib/lib*.a 11 | debian/tmp/usr/lib/*.la 12 | debian/tmp/usr/lib/pkgconfig/*.pc 13 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/libgperftools0.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/bin 3 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/libgperftools0.install: -------------------------------------------------------------------------------- 1 | usr/lib/lib*.so.* 2 | usr/bin/pprof* 3 | debian/tmp/usr/lib/lib*.so.* 4 | debian/tmp/usr/bin/pprof* 5 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/deb/libgperftools0.manpages: -------------------------------------------------------------------------------- 1 | doc/pprof.1 2 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/rpm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Run this from the 'packages' directory, just under rootdir 4 | 5 | # We can only build rpm packages, if the rpm build tools are installed 6 | if [ \! -x /usr/bin/rpmbuild ] 7 | then 8 | echo "Cannot find /usr/bin/rpmbuild. Not building an rpm." 1>&2 9 | exit 0 10 | fi 11 | 12 | # Check the commandline flags 13 | PACKAGE="$1" 14 | VERSION="$2" 15 | fullname="${PACKAGE}-${VERSION}" 16 | archive=../$fullname.tar.gz 17 | 18 | if [ -z "$1" -o -z "$2" ] 19 | then 20 | echo "Usage: $0 " 1>&2 21 | exit 0 22 | fi 23 | 24 | # Double-check we're in the packages directory, just under rootdir 25 | if [ \! -r ../Makefile -a \! -r ../INSTALL ] 26 | then 27 | echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 28 | echo "Also, you must run \"make dist\" before running this script." 1>&2 29 | exit 0 30 | fi 31 | 32 | if [ \! -r "$archive" ] 33 | then 34 | echo "Cannot find $archive. Run \"make dist\" first." 1>&2 35 | exit 0 36 | fi 37 | 38 | # Create the directory where the input lives, and where the output should live 39 | RPM_SOURCE_DIR="/tmp/rpmsource-$fullname" 40 | RPM_BUILD_DIR="/tmp/rpmbuild-$fullname" 41 | 42 | trap 'rm -rf $RPM_SOURCE_DIR $RPM_BUILD_DIR; exit $?' EXIT SIGHUP SIGINT SIGTERM 43 | 44 | rm -rf "$RPM_SOURCE_DIR" "$RPM_BUILD_DIR" 45 | mkdir "$RPM_SOURCE_DIR" 46 | mkdir "$RPM_BUILD_DIR" 47 | 48 | cp "$archive" "$RPM_SOURCE_DIR" 49 | 50 | # rpmbuild -- as far as I can tell -- asks the OS what CPU it has. 51 | # This may differ from what kind of binaries gcc produces. dpkg 52 | # does a better job of this, so if we can run 'dpkg --print-architecture' 53 | # to get the build CPU, we use that in preference of the rpmbuild 54 | # default. 55 | target=`dpkg --print-architecture 2>/dev/null || echo ""` 56 | if [ -n "$target" ] 57 | then 58 | target=" --target $target" 59 | fi 60 | 61 | rpmbuild -bb rpm/rpm.spec $target \ 62 | --define "NAME $PACKAGE" \ 63 | --define "VERSION $VERSION" \ 64 | --define "_sourcedir $RPM_SOURCE_DIR" \ 65 | --define "_builddir $RPM_BUILD_DIR" \ 66 | --define "_rpmdir $RPM_SOURCE_DIR" 67 | 68 | # We put the output in a directory based on what system we've built for 69 | destdir=rpm-unknown 70 | if [ -r /etc/issue ] 71 | then 72 | grep "Red Hat.*release 7" /etc/issue >/dev/null 2>&1 && destdir=rh7 73 | grep "Red Hat.*release 8" /etc/issue >/dev/null 2>&1 && destdir=rh8 74 | grep "Red Hat.*release 9" /etc/issue >/dev/null 2>&1 && destdir=rh9 75 | grep "Fedora Core.*release 1" /etc/issue >/dev/null 2>&1 && destdir=fc1 76 | grep "Fedora Core.*release 2" /etc/issue >/dev/null 2>&1 && destdir=fc2 77 | grep "Fedora Core.*release 3" /etc/issue >/dev/null 2>&1 && destdir=fc3 78 | fi 79 | 80 | rm -rf "$destdir" 81 | mkdir -p "$destdir" 82 | # We want to get not only the main package but devel etc, hence the middle * 83 | mv "$RPM_SOURCE_DIR"/*/"${PACKAGE}"-*"${VERSION}"*.rpm "$destdir" 84 | 85 | echo 86 | echo "The rpm package file(s) are located in $PWD/$destdir" 87 | -------------------------------------------------------------------------------- /deps/gperftools2/packages/rpm/rpm.spec: -------------------------------------------------------------------------------- 1 | %define RELEASE 1 2 | %define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} 3 | %define prefix /usr 4 | 5 | Name: %NAME 6 | Summary: Performance tools for C++ 7 | Version: %VERSION 8 | Release: %rel 9 | Group: Development/Libraries 10 | URL: http://code.google.com/p/gperftools/ 11 | License: BSD 12 | Vendor: gperftools Contributors 13 | Packager: gperftools Contributors 14 | Source: http://%{NAME}.googlecode.com/files/%{NAME}-%{VERSION}.tar.gz 15 | Distribution: Redhat 7 and above. 16 | Buildroot: %{_tmppath}/%{name}-root 17 | Prefix: %prefix 18 | 19 | %description 20 | The %name packages contains some utilities to improve and analyze the 21 | performance of C++ programs. This includes an optimized thread-caching 22 | malloc() and cpu and heap profiling utilities. 23 | 24 | %package devel 25 | Summary: Performance tools for C++ 26 | Group: Development/Libraries 27 | Requires: %{NAME} = %{VERSION} 28 | 29 | %description devel 30 | The %name-devel package contains static and debug libraries and header 31 | files for developing applications that use the %name package. 32 | 33 | %changelog 34 | * Mon Apr 20 2009 35 | - Change build rule to use a configure line more like '%configure' 36 | - Change install to use DESTDIR instead of prefix for configure 37 | - Use wildcards for doc/ and lib/ directories 38 | 39 | * Fri Mar 11 2005 40 | - First draft 41 | 42 | %prep 43 | %setup 44 | 45 | %build 46 | # I can't use '% configure', because it defines -m32 which breaks some 47 | # of the low-level atomicops files in this package. But I do take 48 | # as much from % configure (in /usr/lib/rpm/macros) as I can. 49 | ./configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} 50 | make 51 | 52 | %install 53 | rm -rf $RPM_BUILD_ROOT 54 | make DESTDIR=$RPM_BUILD_ROOT install 55 | 56 | %clean 57 | rm -rf $RPM_BUILD_ROOT 58 | 59 | %files 60 | %defattr(-,root,root) 61 | 62 | %docdir %{prefix}/share/doc/%{NAME}-%{VERSION} 63 | %{prefix}/share/doc/%{NAME}-%{VERSION}/* 64 | 65 | %{_libdir}/*.so.* 66 | %{_bindir}/pprof 67 | %{_mandir}/man1/pprof.1* 68 | 69 | %files devel 70 | %defattr(-,root,root) 71 | 72 | %{_includedir}/google 73 | %{_includedir}/gperftools 74 | %{_libdir}/*.a 75 | %{_libdir}/*.la 76 | %{_libdir}/*.so 77 | %{_libdir}/pkgconfig/*.pc 78 | -------------------------------------------------------------------------------- /deps/gperftools2/src/base/arm_instruction_set_select.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Alexander Levitskiy 31 | // 32 | // Generalizes the plethora of ARM flavors available to an easier to manage set 33 | // Defs reference is at https://wiki.edubuntu.org/ARM/Thumb2PortingHowto 34 | 35 | #ifndef ARM_INSTRUCTION_SET_SELECT_H_ 36 | #define ARM_INSTRUCTION_SET_SELECT_H_ 37 | 38 | #if defined(__ARM_ARCH_7__) || \ 39 | defined(__ARM_ARCH_7R__) || \ 40 | defined(__ARM_ARCH_7A__) 41 | # define ARMV7 1 42 | #endif 43 | 44 | #if defined(ARMV7) || \ 45 | defined(__ARM_ARCH_6__) || \ 46 | defined(__ARM_ARCH_6J__) || \ 47 | defined(__ARM_ARCH_6K__) || \ 48 | defined(__ARM_ARCH_6Z__) || \ 49 | defined(__ARM_ARCH_6T2__) || \ 50 | defined(__ARM_ARCH_6ZK__) 51 | # define ARMV6 1 52 | #endif 53 | 54 | #if defined(ARMV6) || \ 55 | defined(__ARM_ARCH_5T__) || \ 56 | defined(__ARM_ARCH_5E__) || \ 57 | defined(__ARM_ARCH_5TE__) || \ 58 | defined(__ARM_ARCH_5TEJ__) 59 | # define ARMV5 1 60 | #endif 61 | 62 | #if defined(ARMV5) || \ 63 | defined(__ARM_ARCH_4__) || \ 64 | defined(__ARM_ARCH_4T__) 65 | # define ARMV4 1 66 | #endif 67 | 68 | #if defined(ARMV4) || \ 69 | defined(__ARM_ARCH_3__) || \ 70 | defined(__ARM_ARCH_3M__) 71 | # define ARMV3 1 72 | #endif 73 | 74 | #if defined(ARMV3) || \ 75 | defined(__ARM_ARCH_2__) 76 | # define ARMV2 1 77 | #endif 78 | 79 | #endif // ARM_INSTRUCTION_SET_SELECT_H_ 80 | -------------------------------------------------------------------------------- /deps/gperftools2/src/base/googleinit.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Jacob Hoffman-Andrews 32 | 33 | #ifndef _GOOGLEINIT_H 34 | #define _GOOGLEINIT_H 35 | 36 | #include "base/logging.h" 37 | 38 | class GoogleInitializer { 39 | public: 40 | typedef void (*VoidFunction)(void); 41 | GoogleInitializer(const char* name, VoidFunction ctor, VoidFunction dtor) 42 | : name_(name), destructor_(dtor) { 43 | RAW_VLOG(10, " constructing: %s\n", name_); 44 | if (ctor) 45 | ctor(); 46 | } 47 | ~GoogleInitializer() { 48 | RAW_VLOG(10, " destroying: %s\n", name_); 49 | if (destructor_) 50 | destructor_(); 51 | } 52 | 53 | private: 54 | const char* const name_; 55 | const VoidFunction destructor_; 56 | }; 57 | 58 | #define REGISTER_MODULE_INITIALIZER(name, body) \ 59 | namespace { \ 60 | static void google_init_module_##name () { body; } \ 61 | GoogleInitializer google_initializer_module_##name(#name, \ 62 | google_init_module_##name, NULL); \ 63 | } 64 | 65 | #define REGISTER_MODULE_DESTRUCTOR(name, body) \ 66 | namespace { \ 67 | static void google_destruct_module_##name () { body; } \ 68 | GoogleInitializer google_destructor_module_##name(#name, \ 69 | NULL, google_destruct_module_##name); \ 70 | } 71 | 72 | 73 | #endif /* _GOOGLEINIT_H */ 74 | -------------------------------------------------------------------------------- /deps/gperftools2/src/base/linuxthreads.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005-2007, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Markus Gutschke 32 | */ 33 | 34 | #ifndef _LINUXTHREADS_H 35 | #define _LINUXTHREADS_H 36 | 37 | /* Include thread_lister.h to get the interface that we implement for linux. 38 | */ 39 | 40 | /* We currently only support x86-32 and x86-64 on Linux. Porting to other 41 | * related platforms should not be difficult. 42 | */ 43 | #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ 44 | defined(__mips__) || defined(__PPC__)) && defined(__linux) 45 | 46 | /* Define the THREADS symbol to make sure that there is exactly one core dumper 47 | * built into the library. 48 | */ 49 | #define THREADS "Linux /proc" 50 | 51 | #endif 52 | 53 | #endif /* _LINUXTHREADS_H */ 54 | -------------------------------------------------------------------------------- /deps/gperftools2/src/base/spinlock_internal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * This file is an internal part spinlock.cc and once.cc 32 | * It may not be used directly by code outside of //base. 33 | */ 34 | 35 | #ifndef BASE_SPINLOCK_INTERNAL_H_ 36 | #define BASE_SPINLOCK_INTERNAL_H_ 37 | 38 | #include 39 | #include "base/basictypes.h" 40 | #include "base/atomicops.h" 41 | 42 | namespace base { 43 | namespace internal { 44 | 45 | // SpinLockWait() waits until it can perform one of several transitions from 46 | // "from" to "to". It returns when it performs a transition where done==true. 47 | struct SpinLockWaitTransition { 48 | int32 from; 49 | int32 to; 50 | bool done; 51 | }; 52 | 53 | // Wait until *w can transition from trans[i].from to trans[i].to for some i 54 | // satisfying 0<=i 35 | #include 36 | #ifdef HAVE_SCHED_H 37 | #include /* For sched_yield() */ 38 | #endif 39 | #include /* For nanosleep() */ 40 | 41 | namespace base { 42 | namespace internal { 43 | 44 | void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) { 45 | int save_errno = errno; 46 | if (loop == 0) { 47 | } else if (loop == 1) { 48 | sched_yield(); 49 | } else { 50 | struct timespec tm; 51 | tm.tv_sec = 0; 52 | tm.tv_nsec = base::internal::SuggestedDelayNS(loop); 53 | nanosleep(&tm, NULL); 54 | } 55 | errno = save_errno; 56 | } 57 | 58 | void SpinLockWake(volatile Atomic32 *w, bool all) { 59 | } 60 | 61 | } // namespace internal 62 | } // namespace base 63 | -------------------------------------------------------------------------------- /deps/gperftools2/src/base/spinlock_win32-inl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * This file is a Win32-specific part of spinlock_internal.cc 32 | */ 33 | 34 | 35 | #include 36 | 37 | namespace base { 38 | namespace internal { 39 | 40 | void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) { 41 | if (loop == 0) { 42 | } else if (loop == 1) { 43 | Sleep(0); 44 | } else { 45 | Sleep(base::internal::SuggestedDelayNS(loop) / 1000000); 46 | } 47 | } 48 | 49 | void SpinLockWake(volatile Atomic32 *w, bool all) { 50 | } 51 | 52 | } // namespace internal 53 | } // namespace base 54 | -------------------------------------------------------------------------------- /deps/gperftools2/src/base/synchronization_profiling.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Chris Ruemmler 32 | */ 33 | 34 | #ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ 35 | #define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ 36 | 37 | #include "base/basictypes.h" 38 | 39 | namespace base { 40 | 41 | // We can do contention-profiling of SpinLocks, but the code is in 42 | // mutex.cc, which is not always linked in with spinlock. Hence we 43 | // provide a weak definition, which are used if mutex.cc isn't linked in. 44 | 45 | // Submit the number of cycles the spinlock spent contending. 46 | ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64); 47 | extern void SubmitSpinLockProfileData(const void *contendedlock, 48 | int64 wait_cycles) {} 49 | } 50 | #endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ 51 | -------------------------------------------------------------------------------- /deps/gperftools2/src/base/thread_lister.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005-2007, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Markus Gutschke 32 | */ 33 | 34 | #include "config.h" 35 | #include /* needed for NULL on some powerpc platforms (?!) */ 36 | #ifdef HAVE_SYS_PRCTL 37 | # include 38 | #endif 39 | #include "base/thread_lister.h" 40 | #include "base/linuxthreads.h" 41 | /* Include other thread listers here that define THREADS macro 42 | * only when they can provide a good implementation. 43 | */ 44 | 45 | #ifndef THREADS 46 | 47 | /* Default trivial thread lister for single-threaded applications, 48 | * or if the multi-threading code has not been ported, yet. 49 | */ 50 | 51 | int ListAllProcessThreads(void *parameter, 52 | ListAllProcessThreadsCallBack callback, ...) { 53 | int rc; 54 | va_list ap; 55 | pid_t pid; 56 | 57 | #ifdef HAVE_SYS_PRCTL 58 | int dumpable = prctl(PR_GET_DUMPABLE, 0); 59 | if (!dumpable) 60 | prctl(PR_SET_DUMPABLE, 1); 61 | #endif 62 | va_start(ap, callback); 63 | pid = getpid(); 64 | rc = callback(parameter, 1, &pid, ap); 65 | va_end(ap); 66 | #ifdef HAVE_SYS_PRCTL 67 | if (!dumpable) 68 | prctl(PR_SET_DUMPABLE, 0); 69 | #endif 70 | return rc; 71 | } 72 | 73 | int ResumeAllProcessThreads(int num_threads, pid_t *thread_pids) { 74 | return 1; 75 | } 76 | 77 | #endif /* ifndef THREADS */ 78 | -------------------------------------------------------------------------------- /deps/gperftools2/src/config_for_unittests.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // All Rights Reserved. 32 | // 33 | // Author: Craig Silverstein 34 | // 35 | // This file is needed for windows -- unittests are not part of the 36 | // perftools dll, but still want to include config.h just like the 37 | // dll does, so they can use internal tools and APIs for testing. 38 | // 39 | // The problem is that config.h declares PERFTOOLS_DLL_DECL to be 40 | // for exporting symbols, but the unittest needs to *import* symbols 41 | // (since it's not the dll). 42 | // 43 | // The solution is to have this file, which is just like config.h but 44 | // sets PERFTOOLS_DLL_DECL to do a dllimport instead of a dllexport. 45 | // 46 | // The reason we need this extra PERFTOOLS_DLL_DECL_FOR_UNITTESTS 47 | // variable is in case people want to set PERFTOOLS_DLL_DECL explicitly 48 | // to something other than __declspec(dllexport). In that case, they 49 | // may want to use something other than __declspec(dllimport) for the 50 | // unittest case. For that, we allow folks to define both 51 | // PERFTOOLS_DLL_DECL and PERFTOOLS_DLL_DECL_FOR_UNITTESTS explicitly. 52 | // 53 | // NOTE: This file is equivalent to config.h on non-windows systems, 54 | // which never defined PERFTOOLS_DLL_DECL_FOR_UNITTESTS and always 55 | // define PERFTOOLS_DLL_DECL to the empty string. 56 | 57 | #include "config.h" 58 | 59 | #undef PERFTOOLS_DLL_DECL 60 | #ifdef PERFTOOLS_DLL_DECL_FOR_UNITTESTS 61 | # define PERFTOOLS_DLL_DECL PERFTOOLS_DLL_DECL_FOR_UNITTESTS 62 | #else 63 | # define PERFTOOLS_DLL_DECL // if DLL_DECL_FOR_UNITTESTS isn't defined, use "" 64 | #endif 65 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/heap-checker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/heap-profiler.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/malloc_extension.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/malloc_extension_c.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/malloc_hook.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/malloc_hook_c.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/profiler.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/stacktrace.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /deps/gperftools2/src/google/tcmalloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2003, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /deps/gperftools2/src/maybe_threads.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Paul Menage 32 | 33 | //------------------------------------------------------------------- 34 | // Some wrappers for pthread functions so that we can be LD_PRELOADed 35 | // against non-pthreads apps. 36 | //------------------------------------------------------------------- 37 | 38 | #ifndef GOOGLE_MAYBE_THREADS_H_ 39 | #define GOOGLE_MAYBE_THREADS_H_ 40 | 41 | #ifdef HAVE_PTHREAD 42 | #include 43 | #endif 44 | 45 | int perftools_pthread_key_create(pthread_key_t *key, 46 | void (*destr_function) (void *)); 47 | void *perftools_pthread_getspecific(pthread_key_t key); 48 | int perftools_pthread_setspecific(pthread_key_t key, void *val); 49 | int perftools_pthread_once(pthread_once_t *ctl, 50 | void (*init_routine) (void)); 51 | 52 | #endif /* GOOGLE_MAYBE_THREADS_H_ */ 53 | -------------------------------------------------------------------------------- /deps/gperftools2/src/raw_printer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: sanjay@google.com (Sanjay Ghemawat) 32 | 33 | #include 34 | #include 35 | #include 36 | #include "raw_printer.h" 37 | #include "base/logging.h" 38 | 39 | namespace base { 40 | 41 | RawPrinter::RawPrinter(char* buf, int length) 42 | : base_(buf), 43 | ptr_(buf), 44 | limit_(buf + length - 1) { 45 | RAW_DCHECK(length > 0, ""); 46 | *ptr_ = '\0'; 47 | *limit_ = '\0'; 48 | } 49 | 50 | void RawPrinter::Printf(const char* format, ...) { 51 | if (limit_ > ptr_) { 52 | va_list ap; 53 | va_start(ap, format); 54 | int avail = limit_ - ptr_; 55 | // We pass avail+1 to vsnprintf() since that routine needs room 56 | // to store the trailing \0. 57 | const int r = perftools_vsnprintf(ptr_, avail+1, format, ap); 58 | va_end(ap); 59 | if (r < 0) { 60 | // Perhaps an old glibc that returns -1 on truncation? 61 | ptr_ = limit_; 62 | } else if (r > avail) { 63 | // Truncation 64 | ptr_ = limit_; 65 | } else { 66 | ptr_ += r; 67 | } 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /deps/gperftools2/src/solaris/libstdc++.la: -------------------------------------------------------------------------------- 1 | # libstdc++.la - a libtool library file 2 | # Generated by ltmain.sh - GNU libtool 1.4a-GCC3.0 (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes) 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # --- 8 | # NOTE: This file lives in /usr/sfw/lib on Solaris 10. Unfortunately, 9 | # due to an apparent bug in the Solaris 10 6/06 release, 10 | # /usr/sfw/lib/libstdc++.la is empty. Below is the correct content, 11 | # according to 12 | # http://forum.java.sun.com/thread.jspa?threadID=5073150 13 | # By passing LDFLAGS='-Lsrc/solaris' to configure, make will pick up 14 | # this copy of the file rather than the empty copy in /usr/sfw/lib. 15 | # 16 | # Also see 17 | # http://www.technicalarticles.org/index.php/Compiling_MySQL_5.0_on_Solaris_10 18 | # 19 | # Note: this is for 32-bit systems. If you have a 64-bit system, 20 | # uncomment the appropriate dependency_libs line below. 21 | # ---- 22 | 23 | # The name that we can dlopen(3). 24 | dlname='libstdc++.so.6' 25 | 26 | # Names of this library. 27 | library_names='libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so' 28 | 29 | # The name of the static archive. 30 | old_library='libstdc++.a' 31 | 32 | # Libraries that this one depends upon. 33 | # 32-bit version: 34 | dependency_libs='-lc -lm -L/usr/sfw/lib -lgcc_s' 35 | # 64-bit version: 36 | #dependency_libs='-L/lib/64 -lc -lm -L/usr/sfw/lib/64 -lgcc_s' 37 | 38 | # Version information for libstdc++. 39 | current=6 40 | age=0 41 | revision=3 42 | 43 | # Is this an already installed library? 44 | installed=yes 45 | 46 | # Files to dlopen/dlpreopen 47 | dlopen='' 48 | dlpreopen='' 49 | 50 | # Directory that this library needs to be installed in: 51 | libdir='/usr/sfw/lib' 52 | -------------------------------------------------------------------------------- /deps/gperftools2/src/stack_trace_table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Andrew Fikes 32 | // 33 | // Utility class for coalescing sampled stack traces. Not thread-safe. 34 | 35 | #ifndef TCMALLOC_STACK_TRACE_TABLE_H_ 36 | #define TCMALLOC_STACK_TRACE_TABLE_H_ 37 | 38 | #include 39 | #ifdef HAVE_STDINT_H 40 | #include // for uintptr_t 41 | #endif 42 | #include "common.h" 43 | 44 | namespace tcmalloc { 45 | 46 | class PERFTOOLS_DLL_DECL StackTraceTable { 47 | public: 48 | // REQUIRES: L < pageheap_lock 49 | StackTraceTable(); 50 | ~StackTraceTable(); 51 | 52 | // Adds stack trace "t" to table. 53 | // 54 | // REQUIRES: L >= pageheap_lock 55 | void AddTrace(const StackTrace& t); 56 | 57 | // Returns stack traces formatted per MallocExtension guidelines. 58 | // May return NULL on error. Clears state before returning. 59 | // 60 | // REQUIRES: L < pageheap_lock 61 | void** ReadStackTracesAndClear(); 62 | 63 | // Exposed for PageHeapAllocator 64 | struct Bucket { 65 | // Key 66 | uintptr_t hash; 67 | StackTrace trace; 68 | 69 | // Payload 70 | int count; 71 | Bucket* next; 72 | 73 | bool KeyEqual(uintptr_t h, const StackTrace& t) const; 74 | }; 75 | 76 | // For testing 77 | int depth_total() const { return depth_total_; } 78 | int bucket_total() const { return bucket_total_; } 79 | 80 | private: 81 | static const int kHashTableSize = 1 << 14; // => table_ is 128k 82 | 83 | bool error_; 84 | int depth_total_; 85 | int bucket_total_; 86 | Bucket** table_; 87 | }; 88 | 89 | } // namespace tcmalloc 90 | 91 | #endif // TCMALLOC_STACK_TRACE_TABLE_H_ 92 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tcmalloc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Craig Silverstein 32 | // 33 | // Some obscure memory-allocation routines may not be declared on all 34 | // systems. In those cases, we'll just declare them ourselves. 35 | // This file is meant to be used only internally, for unittests. 36 | 37 | #include 38 | 39 | #ifndef _XOPEN_SOURCE 40 | # define _XOPEN_SOURCE 600 // for posix_memalign 41 | #endif 42 | #include // for posix_memalign 43 | // FreeBSD has malloc.h, but complains if you use it 44 | #if defined(HAVE_MALLOC_H) && !defined(__FreeBSD__) 45 | #include // for memalign, valloc, pvalloc 46 | #endif 47 | 48 | // __THROW is defined in glibc systems. It means, counter-intuitively, 49 | // "This function will never throw an exception." It's an optional 50 | // optimization tool, but we may need to use it to match glibc prototypes. 51 | #ifndef __THROW // I guess we're not on a glibc system 52 | # define __THROW // __THROW is just an optimization, so ok to make it "" 53 | #endif 54 | 55 | #if !HAVE_CFREE_SYMBOL 56 | extern "C" void cfree(void* ptr) __THROW; 57 | #endif 58 | #if !HAVE_POSIX_MEMALIGN_SYMBOL 59 | extern "C" int posix_memalign(void** ptr, size_t align, size_t size) __THROW; 60 | #endif 61 | #if !HAVE_MEMALIGN_SYMBOL 62 | extern "C" void* memalign(size_t __alignment, size_t __size) __THROW; 63 | #endif 64 | #if !HAVE_VALLOC_SYMBOL 65 | extern "C" void* valloc(size_t __size) __THROW; 66 | #endif 67 | #if !HAVE_PVALLOC_SYMBOL 68 | extern "C" void* pvalloc(size_t __size) __THROW; 69 | #endif 70 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tcmalloc_guard.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Craig Silverstein 32 | // 33 | // We expose the TCMallocGuard class -- which initializes the tcmalloc 34 | // allocator -- so classes that need to be sure tcmalloc is loaded 35 | // before they do stuff -- notably heap-profiler -- can. To use this 36 | // create a static TCMallocGuard instance at the top of a file where 37 | // you need tcmalloc to be initialized before global constructors run. 38 | 39 | #ifndef TCMALLOC_TCMALLOC_GUARD_H_ 40 | #define TCMALLOC_TCMALLOC_GUARD_H_ 41 | 42 | class TCMallocGuard { 43 | public: 44 | TCMallocGuard(); 45 | ~TCMallocGuard(); 46 | }; 47 | 48 | #endif // TCMALLOC_TCMALLOC_GUARD_H_ 49 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/current_allocated_bytes_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // --- 30 | // 31 | // Author: Craig Silverstein 32 | 33 | // This tests the accounting done by tcmalloc. When we allocate and 34 | // free a small buffer, the number of bytes used by the application 35 | // before the alloc+free should match the number of bytes used after. 36 | // However, the internal data structures used by tcmalloc will be 37 | // quite different -- new spans will have been allocated, etc. This 38 | // is, thus, a simple test that we account properly for the internal 39 | // data structures, so that we report the actual application-used 40 | // bytes properly. 41 | 42 | #include "config_for_unittests.h" 43 | #include 44 | #include 45 | #include 46 | #include "base/logging.h" 47 | 48 | const char kCurrent[] = "generic.current_allocated_bytes"; 49 | 50 | int main() { 51 | // We don't do accounting right when using debugallocation.cc, so 52 | // turn off the test then. TODO(csilvers): get this working too. 53 | #ifdef NDEBUG 54 | size_t before_bytes, after_bytes; 55 | MallocExtension::instance()->GetNumericProperty(kCurrent, &before_bytes); 56 | free(malloc(200)); 57 | MallocExtension::instance()->GetNumericProperty(kCurrent, &after_bytes); 58 | 59 | CHECK_EQ(before_bytes, after_bytes); 60 | #endif 61 | printf("PASS\n"); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/large_heap_fragmentation_unittest.cc: -------------------------------------------------------------------------------- 1 | // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- 2 | // Redistribution and use in source and binary forms, with or without 3 | // modification, are permitted provided that the following conditions are 4 | // met: 5 | // 6 | // * Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // * Redistributions in binary form must reproduce the above 9 | // copyright notice, this list of conditions and the following disclaimer 10 | // in the documentation and/or other materials provided with the 11 | // distribution. 12 | // * Neither the name of Google Inc. nor the names of its 13 | // contributors may be used to endorse or promote products derived from 14 | // this software without specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // This is a unit test for exercising fragmentation of large (over 1 29 | // meg) page spans. It makes sure that allocations/releases of 30 | // increasing memory chunks do not blowup memory 31 | // usage. See also https://code.google.com/p/gperftools/issues/detail?id=368 32 | 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | #include "base/logging.h" 39 | #include "common.h" 40 | #include 41 | 42 | 43 | int main (int argc, char** argv) { 44 | for (int pass = 1; pass <= 3; pass++) { 45 | size_t size = 100*1024*1024; 46 | while (size < 500*1024*1024) { 47 | void *ptr = malloc(size); 48 | free(ptr); 49 | size += 20000; 50 | 51 | size_t heap_size = static_cast(-1); 52 | MallocExtension::instance()->GetNumericProperty("generic.heap_size", 53 | &heap_size); 54 | 55 | 56 | CHECK_LT(heap_size, 1*1024*1024*1024); 57 | } 58 | } 59 | 60 | printf("PASS\n"); 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/packed-cache_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Geoff Pike 32 | 33 | #include 34 | #include "base/logging.h" 35 | #include "packed-cache-inl.h" 36 | 37 | static const int kHashbits = PackedCache<64, uint64>::kHashbits; 38 | 39 | // A basic sanity test. 40 | void PackedCacheTest_basic() { 41 | PackedCache<32, uint32> cache(0); 42 | CHECK_EQ(cache.GetOrDefault(0, 1), 0); 43 | cache.Put(0, 17); 44 | CHECK(cache.Has(0)); 45 | CHECK_EQ(cache.GetOrDefault(0, 1), 17); 46 | cache.Put(19, 99); 47 | CHECK(cache.Has(0) && cache.Has(19)); 48 | CHECK_EQ(cache.GetOrDefault(0, 1), 17); 49 | CHECK_EQ(cache.GetOrDefault(19, 1), 99); 50 | // Knock <0, 17> out by using a conflicting key. 51 | cache.Put(1 << kHashbits, 22); 52 | CHECK(!cache.Has(0)); 53 | CHECK_EQ(cache.GetOrDefault(0, 1), 1); 54 | CHECK_EQ(cache.GetOrDefault(1 << kHashbits, 1), 22); 55 | } 56 | 57 | int main(int argc, char **argv) { 58 | PackedCacheTest_basic(); 59 | 60 | printf("PASS\n"); 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/raw_printer_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009 Google Inc. All Rights Reserved. 2 | // Author: sanjay@google.com (Sanjay Ghemawat) 3 | 4 | #include "raw_printer.h" 5 | #include 6 | #include 7 | #include "base/logging.h" 8 | 9 | using std::string; 10 | 11 | #define TEST(a, b) void TEST_##a##_##b() 12 | #define RUN_TEST(a, b) TEST_##a##_##b() 13 | 14 | TEST(RawPrinter, Empty) { 15 | char buffer[1]; 16 | base::RawPrinter printer(buffer, arraysize(buffer)); 17 | CHECK_EQ(0, printer.length()); 18 | CHECK_EQ(string(""), buffer); 19 | CHECK_EQ(0, printer.space_left()); 20 | printer.Printf("foo"); 21 | CHECK_EQ(string(""), string(buffer)); 22 | CHECK_EQ(0, printer.length()); 23 | CHECK_EQ(0, printer.space_left()); 24 | } 25 | 26 | TEST(RawPrinter, PartiallyFilled) { 27 | char buffer[100]; 28 | base::RawPrinter printer(buffer, arraysize(buffer)); 29 | printer.Printf("%s %s", "hello", "world"); 30 | CHECK_EQ(string("hello world"), string(buffer)); 31 | CHECK_EQ(11, printer.length()); 32 | CHECK_LT(0, printer.space_left()); 33 | } 34 | 35 | TEST(RawPrinter, Truncated) { 36 | char buffer[3]; 37 | base::RawPrinter printer(buffer, arraysize(buffer)); 38 | printer.Printf("%d", 12345678); 39 | CHECK_EQ(string("12"), string(buffer)); 40 | CHECK_EQ(2, printer.length()); 41 | CHECK_EQ(0, printer.space_left()); 42 | } 43 | 44 | TEST(RawPrinter, ExactlyFilled) { 45 | char buffer[12]; 46 | base::RawPrinter printer(buffer, arraysize(buffer)); 47 | printer.Printf("%s %s", "hello", "world"); 48 | CHECK_EQ(string("hello world"), string(buffer)); 49 | CHECK_EQ(11, printer.length()); 50 | CHECK_EQ(0, printer.space_left()); 51 | } 52 | 53 | int main(int argc, char **argv) { 54 | RUN_TEST(RawPrinter, Empty); 55 | RUN_TEST(RawPrinter, PartiallyFilled); 56 | RUN_TEST(RawPrinter, Truncated); 57 | RUN_TEST(RawPrinter, ExactlyFilled); 58 | printf("PASS\n"); 59 | return 0; // 0 means success 60 | } 61 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/sampling_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Craig Silverstein 32 | // 33 | // This tests ReadStackTraces and ReadGrowthStackTraces. It does this 34 | // by doing a bunch of allocations and then calling those functions. 35 | // A driver shell-script can call this, and then call pprof, and 36 | // verify the expected output. The output is written to 37 | // argv[1].heap and argv[1].growth 38 | 39 | #include "config_for_unittests.h" 40 | #include 41 | #include 42 | #include 43 | #include "base/logging.h" 44 | #include 45 | 46 | using std::string; 47 | 48 | extern "C" void* AllocateAllocate() ATTRIBUTE_NOINLINE; 49 | 50 | extern "C" void* AllocateAllocate() { 51 | // The VLOG's are mostly to discourage inlining 52 | VLOG(1, "Allocating some more"); 53 | void* p = malloc(10000); 54 | VLOG(1, "Done allocating"); 55 | return p; 56 | } 57 | 58 | static void WriteStringToFile(const string& s, const string& filename) { 59 | FILE* fp = fopen(filename.c_str(), "w"); 60 | fwrite(s.data(), 1, s.length(), fp); 61 | fclose(fp); 62 | } 63 | 64 | int main(int argc, char** argv) { 65 | if (argc < 2) { 66 | fprintf(stderr, "USAGE: %s \n", argv[0]); 67 | exit(1); 68 | } 69 | for (int i = 0; i < 8000; i++) { 70 | AllocateAllocate(); 71 | } 72 | 73 | string s; 74 | MallocExtension::instance()->GetHeapSample(&s); 75 | WriteStringToFile(s, string(argv[1]) + ".heap"); 76 | 77 | s.clear(); 78 | MallocExtension::instance()->GetHeapGrowthStacks(&s); 79 | WriteStringToFile(s, string(argv[1]) + ".growth"); 80 | 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/simple_compat_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Craig Silverstein 32 | // 33 | // This just verifies that we can compile code that #includes stuff 34 | // via the backwards-compatibility 'google/' #include-dir. It does 35 | // not include config.h on purpose, to better simulate a perftools 36 | // client. 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | // We don't link in -lprofiler for this test, so be sure not to make 51 | // any function calls that require the cpu-profiler code. The 52 | // heap-profiler is ok. 53 | 54 | HeapLeakChecker::Disabler* heap_checker_h; 55 | void (*heap_profiler_h)(const char*) = &HeapProfilerStart; 56 | MallocExtension::Ownership malloc_extension_h; 57 | MallocExtension_Ownership malloc_extension_c_h; 58 | MallocHook::NewHook* malloc_hook_h; 59 | MallocHook_NewHook* malloc_hook_c_h; 60 | ProfilerOptions* profiler_h; 61 | int (*stacktrace_h)(void**, int, int) = &GetStackTrace; 62 | void* (*tcmalloc_h)(size_t) = &tc_new; 63 | 64 | int main(int argc, char** argv) { 65 | printf("PASS\n"); 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/tcmalloc_unittest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (c) 2013, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # --- 33 | # Author: Adhemerval Zanella 34 | # 35 | # Runs the tcmalloc_unittest with various environment variables. 36 | # This is necessary because tuning some environment variables 37 | # (TCMALLOC_TRANSFER_NUM_OBJ for instance) should not change program 38 | # behavior, just performance. 39 | 40 | BINDIR="${BINDIR:-.}" 41 | TCMALLOC_UNITTEST="${1:-$BINDIR}/tcmalloc_unittest" 42 | 43 | TMPDIR=/tmp/tcmalloc_unittest 44 | rm -rf $TMPDIR || exit 2 45 | mkdir $TMPDIR || exit 3 46 | 47 | # $1: value of tcmalloc_unittest env. var. 48 | run_check_transfer_num_obj() { 49 | [ -n "$1" ] && export TCMALLOC_TRANSFER_NUM_OBJ="$1" 50 | 51 | echo -n "Testing $TCMALLOC_UNITTEST with TCMALLOC_TRANSFER_NUM_OBJ=$1 ... " 52 | if $TCMALLOC_UNITTEST > $TMPDIR/output 2>&1; then 53 | echo "OK" 54 | else 55 | echo "FAILED" 56 | echo "Output from the failed run:" 57 | echo "----" 58 | cat $TMPDIR/output 59 | echo "----" 60 | exit 4 61 | fi 62 | } 63 | 64 | run_check_transfer_num_obj "" 65 | run_check_transfer_num_obj "40" 66 | run_check_transfer_num_obj "4096" 67 | 68 | echo "PASS" 69 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/testutil.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Craig Silverstein 32 | 33 | #ifndef TCMALLOC_TOOLS_TESTUTIL_H_ 34 | #define TCMALLOC_TOOLS_TESTUTIL_H_ 35 | 36 | // Run a function in a thread of its own and wait for it to finish. 37 | // The function you pass in must have the signature 38 | // void MyFunction(); 39 | extern "C" void RunThread(void (*fn)()); 40 | 41 | // Run a function X times, in X threads, and wait for them all to finish. 42 | // The function you pass in must have the signature 43 | // void MyFunction(); 44 | extern "C" void RunManyThreads(void (*fn)(), int count); 45 | 46 | // The 'advanced' version: run a function X times, in X threads, and 47 | // wait for them all to finish. Give them all the specified stack-size. 48 | // (If you're curious why this takes a stacksize and the others don't, 49 | // it's because the one client of this fn wanted to specify stacksize. :-) ) 50 | // The function you pass in must have the signature 51 | // void MyFunction(int idx); 52 | // where idx is the index of the thread (which of the X threads this is). 53 | extern "C" void RunManyThreadsWithId(void (*fn)(int), int count, int stacksize); 54 | 55 | // When compiled 64-bit and run on systems with swap several unittests will end 56 | // up trying to consume all of RAM+swap, and that can take quite some time. By 57 | // limiting the address-space size we get sufficient coverage without blowing 58 | // out job limits. 59 | void SetTestResourceLimit(); 60 | 61 | #endif // TCMALLOC_TOOLS_TESTUTIL_H_ 62 | -------------------------------------------------------------------------------- /deps/gperftools2/src/tests/thread_dealloc_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2004, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Sanjay Ghemawat 32 | // 33 | // Check that we do not leak memory when cycling through lots of threads. 34 | 35 | #include "config_for_unittests.h" 36 | #include 37 | #ifdef HAVE_UNISTD_H 38 | #include // for sleep() 39 | #endif 40 | #include "base/logging.h" 41 | #include 42 | #include "tests/testutil.h" // for RunThread() 43 | 44 | // Size/number of objects to allocate per thread (1 MB per thread) 45 | static const int kObjectSize = 1024; 46 | static const int kNumObjects = 1024; 47 | 48 | // Number of threads to create and destroy 49 | static const int kNumThreads = 1000; 50 | 51 | // Allocate lots of stuff 52 | static void AllocStuff() { 53 | void** objects = new void*[kNumObjects]; 54 | for (int i = 0; i < kNumObjects; i++) { 55 | objects[i] = malloc(kObjectSize); 56 | } 57 | for (int i = 0; i < kNumObjects; i++) { 58 | free(objects[i]); 59 | } 60 | delete[] objects; 61 | } 62 | 63 | int main(int argc, char** argv) { 64 | static const int kDisplaySize = 1048576; 65 | char* display = new char[kDisplaySize]; 66 | 67 | for (int i = 0; i < kNumThreads; i++) { 68 | RunThread(&AllocStuff); 69 | 70 | if (((i+1) % 200) == 0) { 71 | fprintf(stderr, "Iteration: %d of %d\n", (i+1), kNumThreads); 72 | MallocExtension::instance()->GetStats(display, kDisplaySize); 73 | fprintf(stderr, "%s\n", display); 74 | } 75 | } 76 | delete[] display; 77 | 78 | printf("PASS\n"); 79 | #ifdef HAVE_UNISTD_H 80 | sleep(1); // Prevent exit race problem with glibc 81 | #endif 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /deps/gperftools2/src/windows/get_mangled_names.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // --- 31 | // Author: Craig Silverstein (opensource@google.com) 32 | 33 | // When you are porting perftools to a new compiler or architecture 34 | // (win64 vs win32) for instance, you'll need to change the mangled 35 | // symbol names for operator new and friends at the top of 36 | // patch_functions.cc. This file helps you do that. 37 | // 38 | // It does this by defining these functions with the proper signature. 39 | // All you need to do is compile this file and the run dumpbin on it. 40 | // (See http://msdn.microsoft.com/en-us/library/5x49w699.aspx for more 41 | // on dumpbin). To do this in MSVC, use the MSVC commandline shell: 42 | // http://msdn.microsoft.com/en-us/library/ms235639(VS.80).aspx) 43 | // 44 | // The run: 45 | // cl /c get_mangled_names.cc 46 | // dumpbin /symbols get_mangled_names.obj 47 | // 48 | // It will print out the mangled (and associated unmangled) names of 49 | // the 8 symbols you need to put at the top of patch_functions.cc 50 | 51 | #include // for size_t 52 | #include // for nothrow_t 53 | 54 | static char m; // some dummy memory so new doesn't return NULL. 55 | 56 | void* operator new(size_t size) { return &m; } 57 | void operator delete(void* p) throw() { } 58 | void* operator new[](size_t size) { return &m; } 59 | void operator delete[](void* p) throw() { } 60 | 61 | void* operator new(size_t size, const std::nothrow_t&) throw() { return &m; } 62 | void operator delete(void* p, const std::nothrow_t&) throw() { } 63 | void* operator new[](size_t size, const std::nothrow_t&) throw() { return &m; } 64 | void operator delete[](void* p, const std::nothrow_t&) throw() { } 65 | -------------------------------------------------------------------------------- /deps/gperftools2/src/windows/ia32_modrm_map.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/src/windows/ia32_modrm_map.cc -------------------------------------------------------------------------------- /deps/gperftools2/src/windows/ia32_opcode_map.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/src/windows/ia32_opcode_map.cc -------------------------------------------------------------------------------- /deps/gperftools2/src/windows/mingw.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Craig Silverstein 32 | * 33 | * MinGW is an interesting mix of unix and windows. We use a normal 34 | * configure script, but still need the windows port.h to define some 35 | * stuff that MinGW doesn't support, like pthreads. 36 | */ 37 | 38 | #ifndef GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_ 39 | #define GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_ 40 | 41 | #ifdef __MINGW32__ 42 | 43 | // Older version of the mingw msvcrt don't define _aligned_malloc 44 | #if __MSVCRT_VERSION__ < 0x0700 45 | # define PERFTOOLS_NO_ALIGNED_MALLOC 1 46 | #endif 47 | 48 | // This must be defined before the windows.h is included. We need at 49 | // least 0x0400 for mutex.h to have access to TryLock, and at least 50 | // 0x0501 for patch_functions.cc to have access to GetModuleHandleEx. 51 | // (This latter is an optimization we could take out if need be.) 52 | #ifndef _WIN32_WINNT 53 | # define _WIN32_WINNT 0x0501 54 | #endif 55 | 56 | #define HAVE_SNPRINTF 1 57 | 58 | // Some mingw distributions have a pthreads wrapper, but it doesn't 59 | // work as well as native windows spinlocks (at least for us). So 60 | // pretend the pthreads wrapper doesn't exist, even when it does. 61 | #undef HAVE_PTHREAD 62 | 63 | #define HAVE_PID_T 64 | 65 | #include "windows/port.h" 66 | 67 | #endif /* __MINGW32__ */ 68 | 69 | #endif /* GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_ */ 70 | -------------------------------------------------------------------------------- /deps/gperftools2/src/windows/mini_disassembler.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exinnet/kvproxy/1ebaf1c26f0e093cdb5d3955c829cd0d4d22cf39/deps/gperftools2/src/windows/mini_disassembler.h -------------------------------------------------------------------------------- /deps/libevent2/Makefile.nmake: -------------------------------------------------------------------------------- 1 | # WATCH OUT! This makefile is a work in progress. It is probably missing 2 | # tons of important things. DO NOT RELY ON IT TO BUILD A GOOD LIBEVENT. 3 | 4 | # Needed for correctness 5 | CFLAGS=/IWIN32-Code /Iinclude /Icompat /DWIN32 /DHAVE_CONFIG_H /I. 6 | 7 | # For optimization and warnings 8 | CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo 9 | 10 | # XXXX have a debug mode 11 | 12 | LIBFLAGS=/nologo 13 | 14 | CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \ 15 | bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \ 16 | strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \ 17 | bufferevent_ratelim.obj evutil_rand.obj 18 | WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \ 19 | event_iocp.obj bufferevent_async.obj 20 | EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj 21 | 22 | ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) 23 | STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib 24 | 25 | 26 | all: static_libs tests 27 | 28 | static_libs: $(STATIC_LIBS) 29 | 30 | libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS) 31 | lib $(LIBFLAGS) $(CORE_OBJS) $(WIN_OBJS) /out:libevent_core.lib 32 | 33 | libevent_extras.lib: $(EXTRA_OBJS) 34 | lib $(LIBFLAGS) $(EXTRA_OBJS) /out:libevent_extras.lib 35 | 36 | libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) 37 | lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib 38 | 39 | clean: 40 | del $(ALL_OBJS) 41 | del $(STATIC_LIBS) 42 | cd test 43 | $(MAKE) /F Makefile.nmake clean 44 | 45 | tests: 46 | cd test 47 | $(MAKE) /F Makefile.nmake 48 | -------------------------------------------------------------------------------- /deps/libevent2/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -x "`which autoreconf 2>/dev/null`" ] ; then 3 | exec autoreconf -ivf 4 | fi 5 | 6 | LIBTOOLIZE=libtoolize 7 | SYSNAME=`uname` 8 | if [ "x$SYSNAME" = "xDarwin" ] ; then 9 | LIBTOOLIZE=glibtoolize 10 | fi 11 | aclocal -I m4 && \ 12 | autoheader && \ 13 | $LIBTOOLIZE && \ 14 | autoconf && \ 15 | automake --add-missing --force-missing --copy 16 | -------------------------------------------------------------------------------- /deps/libevent2/epoll_sub.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2009 Niels Provos 3 | * Copyright 2009-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | int 36 | epoll_create(int size) 37 | { 38 | return (syscall(__NR_epoll_create, size)); 39 | } 40 | 41 | int 42 | epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 43 | { 44 | 45 | return (syscall(__NR_epoll_ctl, epfd, op, fd, event)); 46 | } 47 | 48 | int 49 | epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) 50 | { 51 | return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout)); 52 | } 53 | -------------------------------------------------------------------------------- /deps/libevent2/evdns.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVDNS_H_ 28 | #define _EVDNS_H_ 29 | 30 | /** @file evdns.h 31 | 32 | A dns subsystem for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVDNS_H_ */ 46 | -------------------------------------------------------------------------------- /deps/libevent2/event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT_H_ 28 | #define _EVENT_H_ 29 | 30 | /** @file event.h 31 | 32 | A library for writing event-driven network servers. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other event2/ 37 | headers. 38 | */ 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | #include 45 | #ifdef _EVENT_HAVE_SYS_TYPES_H 46 | #include 47 | #endif 48 | #ifdef _EVENT_HAVE_SYS_TIME_H 49 | #include 50 | #endif 51 | #ifdef _EVENT_HAVE_STDINT_H 52 | #include 53 | #endif 54 | #include 55 | 56 | /* For int types. */ 57 | #include 58 | 59 | #ifdef WIN32 60 | #ifndef WIN32_LEAN_AND_MEAN 61 | #define WIN32_LEAN_AND_MEAN 62 | #endif 63 | #include 64 | #include 65 | #undef WIN32_LEAN_AND_MEAN 66 | typedef unsigned char u_char; 67 | typedef unsigned short u_short; 68 | #endif 69 | 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /* _EVENT_H_ */ 86 | -------------------------------------------------------------------------------- /deps/libevent2/evhttp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2007 Niels Provos 3 | * Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVHTTP_H_ 28 | #define _EVHTTP_H_ 29 | 30 | /** @file evhttp.h 31 | 32 | An http implementation subsystem for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVHTTP_H_ */ 46 | -------------------------------------------------------------------------------- /deps/libevent2/evrpc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVRPC_H_ 28 | #define _EVRPC_H_ 29 | 30 | /** @file evrpc.h 31 | 32 | An RPC system for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVRPC_H_ */ 46 | -------------------------------------------------------------------------------- /deps/libevent2/evsignal-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2007 Niels Provos 3 | * Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVSIGNAL_H_ 28 | #define _EVSIGNAL_H_ 29 | 30 | #ifndef evutil_socket_t 31 | #include "event2/util.h" 32 | #endif 33 | #include 34 | 35 | typedef void (*ev_sighandler_t)(int); 36 | 37 | /* Data structure for the default signal-handling implementation in signal.c 38 | */ 39 | struct evsig_info { 40 | /* Event watching ev_signal_pair[1] */ 41 | struct event ev_signal; 42 | /* Socketpair used to send notifications from the signal handler */ 43 | evutil_socket_t ev_signal_pair[2]; 44 | /* True iff we've added the ev_signal event yet. */ 45 | int ev_signal_added; 46 | /* Count of the number of signals we're currently watching. */ 47 | int ev_n_signals_added; 48 | 49 | /* Array of previous signal handler objects before Libevent started 50 | * messing with them. Used to restore old signal handlers. */ 51 | #ifdef _EVENT_HAVE_SIGACTION 52 | struct sigaction **sh_old; 53 | #else 54 | ev_sighandler_t **sh_old; 55 | #endif 56 | /* Size of sh_old. */ 57 | int sh_old_max; 58 | }; 59 | int evsig_init(struct event_base *); 60 | void evsig_dealloc(struct event_base *); 61 | 62 | void evsig_set_base(struct event_base *base); 63 | 64 | #endif /* _EVSIGNAL_H_ */ 65 | -------------------------------------------------------------------------------- /deps/libevent2/evutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | #ifndef _EVUTIL_H_ 27 | #define _EVUTIL_H_ 28 | 29 | /** @file evutil.h 30 | 31 | Utility and compatibility functions for Libevent. 32 | 33 | The header is deprecated in Libevent 2.0 and later; please 34 | use instead. 35 | */ 36 | 37 | #include 38 | 39 | #endif /* _EVUTIL_H_ */ 40 | -------------------------------------------------------------------------------- /deps/libevent2/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # include/Makefile.am for libevent 2 | # Copyright 2000-2007 Niels Provos 3 | # Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | # 5 | # See LICENSE for copying information. 6 | 7 | AUTOMAKE_OPTIONS = foreign 8 | 9 | EVENT2_EXPORT = \ 10 | event2/buffer.h \ 11 | event2/buffer_compat.h \ 12 | event2/bufferevent.h \ 13 | event2/bufferevent_compat.h \ 14 | event2/bufferevent_ssl.h \ 15 | event2/bufferevent_struct.h \ 16 | event2/dns.h \ 17 | event2/dns_compat.h \ 18 | event2/dns_struct.h \ 19 | event2/event.h \ 20 | event2/event_compat.h \ 21 | event2/event_struct.h \ 22 | event2/http.h \ 23 | event2/http_compat.h \ 24 | event2/http_struct.h \ 25 | event2/keyvalq_struct.h \ 26 | event2/listener.h \ 27 | event2/rpc.h \ 28 | event2/rpc_compat.h \ 29 | event2/rpc_struct.h \ 30 | event2/tag.h \ 31 | event2/tag_compat.h \ 32 | event2/thread.h \ 33 | event2/util.h 34 | 35 | EXTRA_SRC = $(EVENT2_EXPORT) 36 | 37 | ## Without the nobase_ prefixing, Automake would strip "event2/" from 38 | ## the source header filename to derive the installed header filename. 39 | ## With nobase_ the installed path is $(includedir)/event2/ev*.h. 40 | 41 | if INSTALL_LIBEVENT 42 | nobase_include_HEADERS = $(EVENT2_EXPORT) 43 | nobase_nodist_include_HEADERS = ./event2/event-config.h 44 | else 45 | noinst_HEADERS = $(EVENT2_EXPORT) 46 | nodist_noinst_HEADERS = ./event2/event-config.h 47 | endif 48 | -------------------------------------------------------------------------------- /deps/libevent2/include/event2/dns_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_DNS_STRUCT_H_ 28 | #define _EVENT2_DNS_STRUCT_H_ 29 | 30 | /** @file event2/dns_struct.h 31 | 32 | Data structures for dns. Using these structures may hurt forward 33 | compatibility with later versions of Libevent: be careful! 34 | 35 | */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include 42 | #ifdef _EVENT_HAVE_SYS_TYPES_H 43 | #include 44 | #endif 45 | #ifdef _EVENT_HAVE_SYS_TIME_H 46 | #include 47 | #endif 48 | 49 | /* For int types. */ 50 | #include 51 | 52 | /* 53 | * Structures used to implement a DNS server. 54 | */ 55 | 56 | struct evdns_server_request { 57 | int flags; 58 | int nquestions; 59 | struct evdns_server_question **questions; 60 | }; 61 | struct evdns_server_question { 62 | int type; 63 | #ifdef __cplusplus 64 | int dns_question_class; 65 | #else 66 | /* You should refer to this field as "dns_question_class". The 67 | * name "class" works in C for backward compatibility, and will be 68 | * removed in a future version. (1.5 or later). */ 69 | int class; 70 | #define dns_question_class class 71 | #endif 72 | char name[1]; 73 | }; 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* _EVENT2_DNS_STRUCT_H_ */ 80 | 81 | -------------------------------------------------------------------------------- /deps/libevent2/include/event2/keyvalq_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_EVENT_KEYVALQ_STRUCT_H_ 28 | #define _EVENT2_EVENT_KEYVALQ_STRUCT_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /* Fix so that people don't have to run with */ 35 | /* XXXX This code is duplicated with event_struct.h */ 36 | #ifndef TAILQ_ENTRY 37 | #define _EVENT_DEFINED_TQENTRY 38 | #define TAILQ_ENTRY(type) \ 39 | struct { \ 40 | struct type *tqe_next; /* next element */ \ 41 | struct type **tqe_prev; /* address of previous next element */ \ 42 | } 43 | #endif /* !TAILQ_ENTRY */ 44 | 45 | #ifndef TAILQ_HEAD 46 | #define _EVENT_DEFINED_TQHEAD 47 | #define TAILQ_HEAD(name, type) \ 48 | struct name { \ 49 | struct type *tqh_first; \ 50 | struct type **tqh_last; \ 51 | } 52 | #endif 53 | 54 | /* 55 | * Key-Value pairs. Can be used for HTTP headers but also for 56 | * query argument parsing. 57 | */ 58 | struct evkeyval { 59 | TAILQ_ENTRY(evkeyval) next; 60 | 61 | char *key; 62 | char *value; 63 | }; 64 | 65 | TAILQ_HEAD (evkeyvalq, evkeyval); 66 | 67 | /* XXXX This code is duplicated with event_struct.h */ 68 | #ifdef _EVENT_DEFINED_TQENTRY 69 | #undef TAILQ_ENTRY 70 | #endif 71 | 72 | #ifdef _EVENT_DEFINED_TQHEAD 73 | #undef TAILQ_HEAD 74 | #endif 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /deps/libevent2/include/event2/rpc_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_RPC_COMPAT_H_ 28 | #define _EVENT2_RPC_COMPAT_H_ 29 | 30 | /** @file event2/rpc_compat.h 31 | 32 | Deprecated versions of the functions in rpc.h: provided only for 33 | backwards compatibility. 34 | 35 | */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** backwards compatible accessors that work only with gcc */ 42 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 43 | 44 | #undef EVTAG_ASSIGN 45 | #undef EVTAG_GET 46 | #undef EVTAG_ADD 47 | 48 | #define EVTAG_ASSIGN(msg, member, args...) \ 49 | (*(msg)->base->member##_assign)(msg, ## args) 50 | #define EVTAG_GET(msg, member, args...) \ 51 | (*(msg)->base->member##_get)(msg, ## args) 52 | #define EVTAG_ADD(msg, member, args...) \ 53 | (*(msg)->base->member##_add)(msg, ## args) 54 | #endif 55 | #define EVTAG_LEN(msg, member) ((msg)->member##_length) 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* _EVENT2_EVENT_COMPAT_H_ */ 62 | -------------------------------------------------------------------------------- /deps/libevent2/include/event2/tag_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_TAG_COMPAT_H_ 28 | #define _EVENT2_TAG_COMPAT_H_ 29 | 30 | /** @file event2/tag_compat.h 31 | 32 | Obsolete/deprecated functions from tag.h; provided only for backwards 33 | compatibility. 34 | */ 35 | 36 | /** 37 | @name Misnamed functions 38 | 39 | @deprecated These macros are deprecated because their names don't follow 40 | Libevent's naming conventions. Use evtag_encode_int and 41 | evtag_encode_int64 instead. 42 | 43 | @{ 44 | */ 45 | #define encode_int(evbuf, number) evtag_encode_int((evbuf), (number)) 46 | #define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number)) 47 | /**@}*/ 48 | 49 | #endif /* _EVENT2_TAG_H_ */ 50 | -------------------------------------------------------------------------------- /deps/libevent2/ipv6-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | /* Internal use only: Fake IPv6 structures and values on platforms that 28 | * do not have them */ 29 | 30 | #ifndef _EVENT_IPV6_INTERNAL_H 31 | #define _EVENT_IPV6_INTERNAL_H 32 | 33 | #include 34 | #ifdef _EVENT_HAVE_SYS_SOCKET_H 35 | #include 36 | #endif 37 | #include "event2/event-config.h" 38 | #include "event2/util.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /** @file ipv6-internal.h 45 | * 46 | * Replacement types and functions for platforms that don't support ipv6 47 | * properly. 48 | */ 49 | 50 | #ifndef _EVENT_HAVE_STRUCT_IN6_ADDR 51 | struct in6_addr { 52 | ev_uint8_t s6_addr[16]; 53 | }; 54 | #endif 55 | 56 | #ifndef _EVENT_HAVE_SA_FAMILY_T 57 | typedef int sa_family_t; 58 | #endif 59 | 60 | #ifndef _EVENT_HAVE_STRUCT_SOCKADDR_IN6 61 | struct sockaddr_in6 { 62 | /* This will fail if we find a struct sockaddr that doesn't have 63 | * sa_family as the first element. */ 64 | sa_family_t sin6_family; 65 | ev_uint16_t sin6_port; 66 | struct in6_addr sin6_addr; 67 | }; 68 | #endif 69 | 70 | #ifndef AF_INET6 71 | #define AF_INET6 3333 72 | #endif 73 | #ifndef PF_INET6 74 | #define PF_INET6 AF_INET6 75 | #endif 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /deps/libevent2/libevent.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent 9 | Description: libevent is an asynchronous notification event loop library 10 | Version: @VERSION@ 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -levent 14 | Libs.private: @LIBS@ 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /deps/libevent2/libevent_openssl.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent_openssl 9 | Description: libevent_openssl adds openssl-based TLS support to libevent 10 | Version: @VERSION@ 11 | Requires: libevent 12 | Conflicts: 13 | Libs: -L${libdir} -levent_openssl 14 | Libs.private: @LIBS@ -lssl -lcrypto 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /deps/libevent2/libevent_pthreads.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent_pthreads 9 | Description: libevent_pthreads adds pthreads-based threading support to libevent 10 | Version: @VERSION@ 11 | Requires: libevent 12 | Conflicts: 13 | Libs: -L${libdir} -levent_pthreads 14 | Libs.private: @LIBS@ @PTHREAD_LIBS@ 15 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 16 | 17 | -------------------------------------------------------------------------------- /deps/libevent2/log-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _LOG_H_ 28 | #define _LOG_H_ 29 | 30 | #include "event2/util.h" 31 | 32 | #ifdef __GNUC__ 33 | #define EV_CHECK_FMT(a,b) __attribute__((format(printf, a, b))) 34 | #define EV_NORETURN __attribute__((noreturn)) 35 | #else 36 | #define EV_CHECK_FMT(a,b) 37 | #define EV_NORETURN 38 | #endif 39 | 40 | #define _EVENT_ERR_ABORT ((int)0xdeaddead) 41 | 42 | void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN; 43 | void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2); 44 | void event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(3,4) EV_NORETURN; 45 | void event_sock_warn(evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(2,3); 46 | void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN; 47 | void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2); 48 | void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2); 49 | void _event_debugx(const char *fmt, ...) EV_CHECK_FMT(1,2); 50 | 51 | #ifdef USE_DEBUG 52 | #define event_debug(x) _event_debugx x 53 | #else 54 | #define event_debug(x) do {;} while (0) 55 | #endif 56 | 57 | #undef EV_CHECK_FMT 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /deps/libevent2/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /deps/libevent2/make-event-config.sed: -------------------------------------------------------------------------------- 1 | # Sed script to postprocess config.h into event-config.h. 2 | 3 | 1i\ 4 | /* event2/event-config.h\ 5 | *\ 6 | * This file was generated by autoconf when libevent was built, and post-\ 7 | * processed by Libevent so that its macros would have a uniform prefix.\ 8 | *\ 9 | * DO NOT EDIT THIS FILE.\ 10 | *\ 11 | * Do not rely on macros in this file existing in later versions.\ 12 | */\ 13 | \ 14 | #ifndef _EVENT2_EVENT_CONFIG_H_\ 15 | #define _EVENT2_EVENT_CONFIG_H_\ 16 | 17 | $a\ 18 | \ 19 | #endif /* event2/event-config.h */ 20 | 21 | s/#define /#define _EVENT_/ 22 | s/#undef /#undef _EVENT_/ 23 | s/#ifndef /#ifndef _EVENT_/ 24 | -------------------------------------------------------------------------------- /deps/libevent2/mm-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | #ifndef _EVENT_MM_INTERNAL_H 27 | #define _EVENT_MM_INTERNAL_H 28 | 29 | #include 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #ifndef _EVENT_DISABLE_MM_REPLACEMENT 36 | /* Internal use only: Memory allocation functions. We give them nice short 37 | * mm_names for our own use, but make sure that the symbols have longer names 38 | * so they don't conflict with other libraries (like, say, libmm). */ 39 | void *event_mm_malloc_(size_t sz); 40 | void *event_mm_calloc_(size_t count, size_t size); 41 | char *event_mm_strdup_(const char *s); 42 | void *event_mm_realloc_(void *p, size_t sz); 43 | void event_mm_free_(void *p); 44 | #define mm_malloc(sz) event_mm_malloc_(sz) 45 | #define mm_calloc(count, size) event_mm_calloc_((count), (size)) 46 | #define mm_strdup(s) event_mm_strdup_(s) 47 | #define mm_realloc(p, sz) event_mm_realloc_((p), (sz)) 48 | #define mm_free(p) event_mm_free_(p) 49 | #else 50 | #define mm_malloc(sz) malloc(sz) 51 | #define mm_calloc(n, sz) calloc((n), (sz)) 52 | #define mm_strdup(s) strdup(s) 53 | #define mm_realloc(p, sz) realloc((p), (sz)) 54 | #define mm_free(p) free(p) 55 | #endif 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /deps/libevent2/sample/Makefile.am: -------------------------------------------------------------------------------- 1 | # sample/Makefile.am for libevent 2 | # Copyright 2000-2007 Niels Provos 3 | # Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | # 5 | # See LICENSE for copying information. 6 | 7 | AUTOMAKE_OPTIONS = foreign no-dependencies 8 | 9 | LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la 10 | AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include 11 | 12 | noinst_PROGRAMS = event-test time-test signal-test dns-example hello-world http-server 13 | 14 | event_test_SOURCES = event-test.c 15 | time_test_SOURCES = time-test.c 16 | signal_test_SOURCES = signal-test.c 17 | dns_example_SOURCES = dns-example.c 18 | hello_world_SOURCES = hello-world.c 19 | http_server_SOURCES = http-server.c 20 | 21 | if OPENSSL 22 | noinst_PROGRAMS += le-proxy 23 | le_proxy_SOURCES = le-proxy.c 24 | le_proxy_LDADD = $(LDADD) ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD} 25 | endif 26 | 27 | verify: 28 | 29 | DISTCLEANFILES = *~ 30 | -------------------------------------------------------------------------------- /deps/libevent2/sample/signal-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Compile with: 3 | * cc -I/usr/local/include -o signal-test \ 4 | * signal-test.c -L/usr/local/lib -levent 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | #ifndef WIN32 13 | #include 14 | #include 15 | #include 16 | #else 17 | #include 18 | #include 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #ifdef _EVENT___func__ 30 | #define __func__ _EVENT___func__ 31 | #endif 32 | 33 | int called = 0; 34 | 35 | static void 36 | signal_cb(evutil_socket_t fd, short event, void *arg) 37 | { 38 | struct event *signal = arg; 39 | 40 | printf("%s: got signal %d\n", __func__, EVENT_SIGNAL(signal)); 41 | 42 | if (called >= 2) 43 | event_del(signal); 44 | 45 | called++; 46 | } 47 | 48 | int 49 | main(int argc, char **argv) 50 | { 51 | struct event signal_int; 52 | struct event_base* base; 53 | #ifdef WIN32 54 | WORD wVersionRequested; 55 | WSADATA wsaData; 56 | 57 | wVersionRequested = MAKEWORD(2, 2); 58 | 59 | (void) WSAStartup(wVersionRequested, &wsaData); 60 | #endif 61 | 62 | /* Initalize the event library */ 63 | base = event_base_new(); 64 | 65 | /* Initalize one event */ 66 | event_assign(&signal_int, base, SIGINT, EV_SIGNAL|EV_PERSIST, signal_cb, 67 | &signal_int); 68 | 69 | event_add(&signal_int, NULL); 70 | 71 | event_base_dispatch(base); 72 | event_base_free(base); 73 | 74 | return (0); 75 | } 76 | 77 | -------------------------------------------------------------------------------- /deps/libevent2/sample/time-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * XXX This sample code was once meant to show how to use the basic Libevent 3 | * interfaces, but it never worked on non-Unix platforms, and some of the 4 | * interfaces have changed since it was first written. It should probably 5 | * be removed or replaced with something better. 6 | * 7 | * Compile with: 8 | * cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent 9 | */ 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | #ifndef WIN32 17 | #include 18 | #include 19 | #endif 20 | #include 21 | #ifdef _EVENT_HAVE_SYS_TIME_H 22 | #include 23 | #endif 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #ifdef WIN32 35 | #include 36 | #endif 37 | 38 | struct timeval lasttime; 39 | 40 | int event_is_persistent; 41 | 42 | static void 43 | timeout_cb(evutil_socket_t fd, short event, void *arg) 44 | { 45 | struct timeval newtime, difference; 46 | struct event *timeout = arg; 47 | double elapsed; 48 | 49 | evutil_gettimeofday(&newtime, NULL); 50 | evutil_timersub(&newtime, &lasttime, &difference); 51 | elapsed = difference.tv_sec + 52 | (difference.tv_usec / 1.0e6); 53 | 54 | printf("timeout_cb called at %d: %.3f seconds elapsed.\n", 55 | (int)newtime.tv_sec, elapsed); 56 | lasttime = newtime; 57 | 58 | if (! event_is_persistent) { 59 | struct timeval tv; 60 | evutil_timerclear(&tv); 61 | tv.tv_sec = 2; 62 | event_add(timeout, &tv); 63 | } 64 | } 65 | 66 | int 67 | main(int argc, char **argv) 68 | { 69 | struct event timeout; 70 | struct timeval tv; 71 | struct event_base *base; 72 | int flags; 73 | 74 | #ifdef WIN32 75 | WORD wVersionRequested; 76 | WSADATA wsaData; 77 | 78 | wVersionRequested = MAKEWORD(2, 2); 79 | 80 | (void)WSAStartup(wVersionRequested, &wsaData); 81 | #endif 82 | 83 | if (argc == 2 && !strcmp(argv[1], "-p")) { 84 | event_is_persistent = 1; 85 | flags = EV_PERSIST; 86 | } else { 87 | event_is_persistent = 0; 88 | flags = 0; 89 | } 90 | 91 | /* Initalize the event library */ 92 | base = event_base_new(); 93 | 94 | /* Initalize one event */ 95 | event_assign(&timeout, base, -1, flags, timeout_cb, (void*) &timeout); 96 | 97 | evutil_timerclear(&tv); 98 | tv.tv_sec = 2; 99 | event_add(&timeout, &tv); 100 | 101 | evutil_gettimeofday(&lasttime, NULL); 102 | 103 | event_base_dispatch(base); 104 | 105 | return (0); 106 | } 107 | 108 | -------------------------------------------------------------------------------- /deps/libevent2/strlcpy-internal.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRLCPY_INTERNAL_H_ 2 | #define _STRLCPY_INTERNAL_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "event2/event-config.h" 9 | 10 | #ifndef _EVENT_HAVE_STRLCPY 11 | #include 12 | size_t _event_strlcpy(char *dst, const char *src, size_t siz); 13 | #define strlcpy _event_strlcpy 14 | #endif 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /deps/libevent2/strlcpy.c: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1998 Todd C. Miller 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #if defined(LIBC_SCCS) && !defined(lint) 31 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $"; 32 | #endif /* LIBC_SCCS and not lint */ 33 | 34 | #include 35 | 36 | #include "event2/event-config.h" 37 | 38 | #ifndef _EVENT_HAVE_STRLCPY 39 | #include "strlcpy-internal.h" 40 | 41 | /* 42 | * Copy src to string dst of size siz. At most siz-1 characters 43 | * will be copied. Always NUL terminates (unless siz == 0). 44 | * Returns strlen(src); if retval >= siz, truncation occurred. 45 | */ 46 | size_t 47 | _event_strlcpy(dst, src, siz) 48 | char *dst; 49 | const char *src; 50 | size_t siz; 51 | { 52 | register char *d = dst; 53 | register const char *s = src; 54 | register size_t n = siz; 55 | 56 | /* Copy as many bytes as will fit */ 57 | if (n != 0 && --n != 0) { 58 | do { 59 | if ((*d++ = *s++) == 0) 60 | break; 61 | } while (--n != 0); 62 | } 63 | 64 | /* Not enough room in dst, add NUL and traverse rest of src */ 65 | if (n == 0) { 66 | if (siz != 0) 67 | *d = '\0'; /* NUL-terminate dst */ 68 | while (*s++) 69 | ; 70 | } 71 | 72 | return (s - src - 1); /* count does not include NUL */ 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /deps/libevent2/test/Makefile.nmake: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS=/I.. /I../WIN32-Code /I../include /I../compat /DWIN32 /DHAVE_CONFIG_H /DTINYTEST_LOCAL 3 | 4 | CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo 5 | 6 | REGRESS_OBJS=regress.obj regress_buffer.obj regress_http.obj regress_dns.obj \ 7 | regress_testutils.obj \ 8 | regress_rpc.obj regress.gen.obj \ 9 | regress_et.obj regress_bufferevent.obj \ 10 | regress_listener.obj regress_util.obj tinytest.obj \ 11 | regress_main.obj regress_minheap.obj regress_iocp.obj \ 12 | regress_thread.obj 13 | 14 | OTHER_OBJS=test-init.obj test-eof.obj test-weof.obj test-time.obj \ 15 | bench.obj bench_cascade.obj bench_http.obj bench_httpclient.obj \ 16 | test-changelist.obj 17 | 18 | PROGRAMS=regress.exe \ 19 | test-init.exe test-eof.exe test-weof.exe test-time.exe \ 20 | test-changelist.exe 21 | 22 | # Disabled for now: 23 | # bench.exe bench_cascade.exe bench_http.exe bench_httpclient.exe 24 | 25 | 26 | LIBS=..\libevent.lib ws2_32.lib shell32.lib advapi32.lib 27 | 28 | all: $(PROGRAMS) 29 | 30 | regress.exe: $(REGRESS_OBJS) 31 | $(CC) $(CFLAGS) $(LIBS) $(REGRESS_OBJS) 32 | 33 | test-init.exe: test-init.obj 34 | $(CC) $(CFLAGS) $(LIBS) test-init.obj 35 | test-eof.exe: test-eof.obj 36 | $(CC) $(CFLAGS) $(LIBS) test-eof.obj 37 | test-changelist.exe: test-changelist.obj 38 | $(CC) $(CFLAGS) $(LIBS) test-changelist.obj 39 | test-weof.exe: test-weof.obj 40 | $(CC) $(CFLAGS) $(LIBS) test-weof.obj 41 | test-time.exe: test-time.obj 42 | $(CC) $(CFLAGS) $(LIBS) test-time.obj 43 | 44 | bench.exe: bench.obj 45 | $(CC) $(CFLAGS) $(LIBS) bench.obj 46 | bench_cascade.exe: bench_cascade.obj 47 | $(CC) $(CFLAGS) $(LIBS) bench_cascade.obj 48 | bench_http.exe: bench_http.obj 49 | $(CC) $(CFLAGS) $(LIBS) bench_http.obj 50 | bench_httpclient.exe: bench_httpclient.obj 51 | $(CC) $(CFLAGS) $(LIBS) bench_httpclient.obj 52 | 53 | regress.gen.c regress.gen.h: regress.rpc ../event_rpcgen.py 54 | echo // > regress.gen.c 55 | echo #define NO_PYTHON_EXISTS > regress.gen.h 56 | -python ..\event_rpcgen.py regress.rpc 57 | 58 | clean: 59 | -del $(REGRESS_OBJS) 60 | -del $(OTHER_OBJS) 61 | -del regress.exe 62 | -------------------------------------------------------------------------------- /deps/libevent2/test/regress.rpc: -------------------------------------------------------------------------------- 1 | /* tests data packing and unpacking */ 2 | 3 | struct msg { 4 | string /* sender */ from_name = 1; /* be verbose */ 5 | string to_name = 2; 6 | optional struct[kill] attack = 3; 7 | array struct[run] run = 4; 8 | } 9 | 10 | struct kill { 11 | string weapon = 0x10121; 12 | string action = 2; 13 | array int how_often = 3; 14 | } 15 | 16 | struct run { 17 | string how = 1; 18 | optional bytes some_bytes = 2; 19 | 20 | bytes fixed_bytes[24] = 3; 21 | array string notes = 4; 22 | 23 | optional int64 large_number = 5; 24 | array int other_numbers = 6; 25 | } 26 | -------------------------------------------------------------------------------- /deps/libevent2/test/regress_testutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef _TESTUTILS_H 28 | #define _TESTUTILS_H 29 | 30 | #include "event2/dns.h" 31 | 32 | struct regress_dns_server_table { 33 | const char *q; 34 | const char *anstype; 35 | const char *ans; 36 | int seen; 37 | }; 38 | 39 | struct evdns_server_port * 40 | regress_get_dnsserver(struct event_base *base, 41 | ev_uint16_t *portnum, 42 | evutil_socket_t *psock, 43 | evdns_request_callback_fn_type cb, 44 | void *arg); 45 | 46 | /* Helper: return the port that a socket is bound on, in host order. */ 47 | int regress_get_socket_port(evutil_socket_t fd); 48 | 49 | /* used to look up pre-canned responses in a search table */ 50 | void regress_dns_server_cb( 51 | struct evdns_server_request *req, void *data); 52 | 53 | /* globally allocates a dns server that serves from a search table */ 54 | int regress_dnsserver(struct event_base *base, ev_uint16_t *port, 55 | struct regress_dns_server_table *seach_table); 56 | 57 | /* clean up the global dns server resources */ 58 | void regress_clean_dnsserver(void); 59 | 60 | struct evconnlistener; 61 | struct sockaddr; 62 | int regress_get_listener_addr(struct evconnlistener *lev, 63 | struct sockaddr *sa, ev_socklen_t *socklen); 64 | 65 | #endif /* _TESTUTILS_H */ 66 | 67 | -------------------------------------------------------------------------------- /deps/libevent2/test/rpcgen_wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # libevent rpcgen_wrapper.sh 3 | # Transforms event_rpcgen.py failure into success for make, only if 4 | # regress.gen.c and regress.gen.h already exist in $srcdir. This 5 | # is needed for "make distcheck" to pass the read-only $srcdir build, 6 | # as with read-only sources fresh from tarball, regress.gen.[ch] will 7 | # be correct in $srcdir but unwritable. This previously triggered 8 | # Makefile.am to create stub regress.gen.c and regress.gen.h in the 9 | # distcheck _build directory, which were then detected as leftover 10 | # files in the build tree after distclean, breaking distcheck. 11 | # Note that regress.gen.[ch] are not in fresh git clones, making 12 | # working Python a requirement for make distcheck of a git tree. 13 | 14 | exit_updated() { 15 | echo "Updated ${srcdir}\regress.gen.c and ${srcdir}\regress.gen.h" 16 | exit 0 17 | } 18 | 19 | exit_reuse() { 20 | echo "event_rpcgen.py failed, ${srcdir}\regress.gen.\[ch\] will be reused." >&2 21 | exit 0 22 | } 23 | 24 | exit_failed() { 25 | echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2 26 | exit 1 27 | } 28 | 29 | if [ -x /usr/bin/python2 ] ; then 30 | PYTHON2=/usr/bin/python2 31 | elif [ "x`which python2`" != x ] ; then 32 | PYTHON2=python2 33 | else 34 | PYTHON2=python 35 | fi 36 | 37 | srcdir=$1 38 | srcdir=${srcdir:-.} 39 | ${PYTHON2} ${srcdir}/../event_rpcgen.py ${srcdir}/regress.rpc 40 | case "$?" in 41 | 0) 42 | exit_updated 43 | ;; 44 | *) 45 | test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \ 46 | exit_reuse 47 | exit_failed 48 | ;; 49 | esac 50 | -------------------------------------------------------------------------------- /deps/libevent2/test/test-init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #include "event2/event-config.h" 28 | 29 | #include 30 | #include 31 | #ifdef _EVENT_HAVE_SYS_TIME_H 32 | #include 33 | #endif 34 | #ifdef _EVENT_HAVE_SYS_SOCKET_H 35 | #include 36 | #endif 37 | #include 38 | #include 39 | #include 40 | #include 41 | #ifndef WIN32 42 | #include 43 | #endif 44 | #include 45 | 46 | #include 47 | 48 | int 49 | main(int argc, char **argv) 50 | { 51 | #ifdef WIN32 52 | WORD wVersionRequested; 53 | WSADATA wsaData; 54 | 55 | wVersionRequested = MAKEWORD(2, 2); 56 | 57 | (void) WSAStartup(wVersionRequested, &wsaData); 58 | #endif 59 | 60 | /* Initalize the event library */ 61 | event_init(); 62 | 63 | return (0); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /deps/libevent2/test/tinytest_local.h: -------------------------------------------------------------------------------- 1 | 2 | #ifdef WIN32 3 | #include 4 | #endif 5 | 6 | #include "event2/util.h" 7 | #include "util-internal.h" 8 | 9 | #ifdef snprintf 10 | #undef snprintf 11 | #endif 12 | #define snprintf evutil_snprintf 13 | -------------------------------------------------------------------------------- /etc/kvproxy.ini: -------------------------------------------------------------------------------- 1 | [kvproxy] 2 | port=55669 3 | thread_count=2 4 | cpu_affinity=on 5 | backlog=10000 6 | ;unit millisecond 7 | recv_timeout=100 8 | ;log_path=/tmp/kvproxy.log 9 | log_level=warn 10 | ;ext_path=../ext 11 | ;unit MB 12 | max_packet=1 13 | failover_threshold = 2 14 | ;unit second 15 | failover_interval = 2 16 | async_size = 50000 17 | 18 | [memcached] 19 | extension=memcached.so 20 | hosts=master 21 | ;hosts_backup=read 22 | hosts_read=master 23 | sync_str = "+" 24 | ;binary or text 25 | proto=binary 26 | 27 | [master] 28 | 127.0.0.1:11211="1:50" 29 | 30 | [read] 31 | 127.0.0.1:11212="2:50" 32 | -------------------------------------------------------------------------------- /sbin/kvproxy: -------------------------------------------------------------------------------- 1 | ROOT_PATH=`dirname $0` 2 | 3 | start(){ 4 | PID=`pgrep kvproxy` 5 | if [ -n "$PID" ]; then 6 | echo "PID[$PID] kvproxy start fail.please kill kvproxy before start." 7 | else 8 | $ROOT_PATH/../bin/kvproxy -d 9 | sleep 1 10 | PID=`pgrep kvproxy` 11 | if [ -n "$PID" ]; then 12 | echo "PID[$PID] kvproxy start success." 13 | else 14 | echo "kvproxy start fail" 15 | fi 16 | fi 17 | } 18 | 19 | stop(){ 20 | PID=`pgrep kvproxy` 21 | if [ -n "$PID" ]; then 22 | kill -2 $PID 23 | sleep 1 24 | echo "PID[$PID] kvproxy stop success." 25 | else 26 | echo "kvproxy stop fail.not find pid of kvproxy" 27 | fi 28 | } 29 | 30 | restart(){ 31 | stop 32 | start 33 | } 34 | 35 | case "$1" in 36 | start) 37 | start 38 | ;; 39 | stop) 40 | stop 41 | ;; 42 | restart) 43 | restart 44 | ;; 45 | *) 46 | echo $"Usage: $0 {start|stop|restart}" 47 | exit 2 48 | esac 49 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | include ../build_config.mk 2 | 3 | SOURCE_FILES=./kvproxy.cpp ./extension.cpp ./hash.cpp ./serv.cpp ./conn_pool.cpp ./log.cpp ./config.cpp ./util.cpp 4 | HEADER_FILES=./kvproxy.h ./extension.h ./hash.h ./serv.h ./conn_pool.h ./log.h ./config.h ./util.h 5 | 6 | all:${SOURCE_FILES} ${HEADER_FILES} 7 | ${CXX} ${SOURCE_FILES} -I ./ ${CFLAGS} ${PLATFORM_CLIBS} ${CLIBS} -o ../bin/kvproxy 8 | clean: 9 | rm -f ../bin/kvproxy 10 | -------------------------------------------------------------------------------- /src/config.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_CONFIG_H 2 | #define KVPROXY_CONFIG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "log.h" 9 | #include "util.h" 10 | 11 | #define PARSE_INIT 0 12 | #define PARSE_SECTION 1 13 | #define PARSE_KEY 2 14 | #define PARSE_VALUE 3 15 | 16 | using namespace std; 17 | 18 | typedef std::map > CONF_T; 19 | 20 | class Config 21 | { 22 | private: 23 | static string conf_path; 24 | static CONF_T conf; 25 | static string ext_name; 26 | 27 | public: 28 | static void setConfFile(string file_path); 29 | static void loadConf(); 30 | static string getConfStr(string section, string key); 31 | static map getConfStr(string section); 32 | static int getConfInt(string section, string key); 33 | static map getConfInt(string section); 34 | static bool getConfBool(string section, string key); 35 | static map getConfBool(string section); 36 | static string getExtName(); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/conn_pool.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_CONN_POOL_H 2 | #define KVPROXY_CONN_POOL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "log.h" 19 | 20 | using namespace std; 21 | 22 | class ConnPool { 23 | private: 24 | 25 | map > > conn_list; 26 | static ConnPool * conn_pool; 27 | pthread_rwlock_t conn_list_lock; 28 | 29 | bool destoryConnPool(); 30 | public: 31 | ConnPool(){ 32 | int res; 33 | res=pthread_rwlock_init(&conn_list_lock,NULL); 34 | if(res != 0){ 35 | cerr << "[error]:rwlock initialization failed" << endl; 36 | log_fatal("rwlock initialization failed "); 37 | exit(EXIT_FAILURE); 38 | } 39 | }; 40 | ~ConnPool(); 41 | static ConnPool * getInstance(); 42 | void initConnection(string host, uint32_t port, uint32_t size); 43 | int getConnection(uint32_t id, string host, uint32_t port); 44 | int createConnection(string host, uint32_t port); 45 | void destoryConnection(int conn); 46 | void closeConnection(int conn); 47 | int getConnectionSize(); 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/ext/memcached/Makefile: -------------------------------------------------------------------------------- 1 | CXX=g++ 2 | 3 | OUTPUT=./ 4 | 5 | LIB_SUFFIX_NAME=so 6 | TARGET=memcached.${LIB_SUFFIX_NAME} 7 | 8 | CPPFLAGS= -g -O2 -fPIC -shared\ 9 | -I../../ 10 | 11 | SOURCE_FILES=./memcached.cpp 12 | HEADER_FILES=./memcached.h ./protocol_binary.h 13 | 14 | all:$(SOURCE_FILES) $(HEADER_FILES) 15 | $(CXX) -o $(TARGET) $(SOURCE_FILES) $(CPPFLAGS) 16 | clean: 17 | rm -rf $(TARGET) 18 | install: 19 | cp $(TARGET) ../../../ext/ 20 | uninstall: 21 | rm -f ../../../ext/$(TARGET) 22 | -------------------------------------------------------------------------------- /src/ext/memcached/memcached.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPROXY_EXT_MEMCACHED_H 2 | #define EXPROXY_EXT_MEMCACHED_H 3 | 4 | #include "extension.h" 5 | #include "util.h" 6 | #include "config.h" 7 | #include 8 | #include "protocol_binary.h" 9 | 10 | extern "C" { 11 | struct memcached_header{ 12 | int keylen; 13 | int extlen; 14 | int bodylen; 15 | int opcode; 16 | }; 17 | PARSE_REQ(memcached); 18 | CREATE_REQ(memcached); 19 | CREATE_REQ_ASYNC(memcached); 20 | PARSE_RESP(memcached); 21 | CREATE_RESP(memcached); 22 | EXT_VERSION(memcached); 23 | 24 | static bool is_binary_protocol(const char * data, int size); 25 | static int try_read_request_binary(const char * req_data, int size, memcached_header * header); 26 | static int try_read_response_binary(const char * resp_data, int size, memcached_header * header); 27 | static int try_read_request_text(const char * req_data, int size, memcached_header * header); 28 | static int try_read_response_text(const char * resp_data, int size, memcached_header * header); 29 | static uint32_t get_opcode(const char * data); 30 | 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /src/hash.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_HASH_H 2 | #define KVPROXY_HASH_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "log.h" 16 | 17 | using namespace std; 18 | 19 | 20 | 21 | class ConsistentHash 22 | { 23 | private: 24 | //the key is crc32 key, the value is a pair, host_port and alias index 25 | typedef map > hash_type; 26 | typedef hash_type::key_type key_type; 27 | typedef hash_type::mapped_type mapped_type; 28 | typedef hash_type::iterator iterator; 29 | hash_type _hash; 30 | hash_type _hash_tmp; 31 | pthread_mutex_t _lock; 32 | 33 | public: 34 | ConsistentHash(); 35 | ~ConsistentHash(); 36 | bool createVNodes(map,pair > hosts); 37 | void setHosts(map,pair > hosts, bool force = false); 38 | bool delHost(uint32_t alias_index); 39 | bool addHost(string host_port, uint32_t alias_index, uint32_t index, uint32_t weight); 40 | pair find(string key); 41 | pair find(const char *key, uint16_t key_len); 42 | map > getAll(); 43 | inline uint32_t getSize(){ 44 | return _hash.size(); 45 | } 46 | }; 47 | 48 | uint32_t crc32(uint32_t crc, const char *buf, uint32_t len); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/log.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_LOG_H 2 | #define KVPROXY_LOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace std; 13 | 14 | class Logger{ 15 | private: 16 | static ofstream log_file; 17 | int log_level; 18 | public: 19 | static const int LEVEL_FATAL = 0; 20 | static const int LEVEL_ERROR = 1; 21 | static const int LEVEL_WARN = 2; 22 | static const int LEVEL_INFO = 3; 23 | static const int LEVEL_DEBUG = 4; 24 | 25 | Logger(); 26 | ~Logger(); 27 | 28 | void setLevel(int level){ 29 | log_level = level; 30 | } 31 | int getLevel(const char *levelname); 32 | void open(const char *filename); 33 | int logx(int level, const char *fmt, va_list ap); 34 | int debug(const char *fmt, ...); 35 | int info(const char *fmt, ...); 36 | int warn(const char *fmt, ...); 37 | int error(const char *fmt, ...); 38 | int fatal(const char *fmt, ...); 39 | }; 40 | 41 | 42 | void log_open(const char *filename); 43 | int get_log_level(const char * levelname); 44 | void set_log_level(int level); 45 | int log_write(int level, const char *fmt, ...); 46 | 47 | #define log_debug(fmt, args...) \ 48 | log_write(Logger::LEVEL_DEBUG, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 49 | #define log_info(fmt, args...) \ 50 | log_write(Logger::LEVEL_INFO, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 51 | #define log_warn(fmt, args...) \ 52 | log_write(Logger::LEVEL_WARN, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 53 | #define log_error(fmt, args...) \ 54 | log_write(Logger::LEVEL_ERROR, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 55 | #define log_fatal(fmt, args...) \ 56 | log_write(Logger::LEVEL_FATAL, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/util.cpp: -------------------------------------------------------------------------------- 1 | #include "util.h" 2 | 3 | string get_cwd(string bin_path){ 4 | string cwd; 5 | int position = bin_path.find_last_of("/"); 6 | if (position == string::npos){ 7 | cout << "error: the command should have seperator / " << endl; 8 | exit(EXIT_FAILURE); 9 | } 10 | cwd = bin_path.substr(0,position) + "/"; 11 | return cwd; 12 | } 13 | -------------------------------------------------------------------------------- /src/util.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_UTIL_H 2 | #define KVPROXY_UTIL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "config.h" 13 | 14 | using namespace std; 15 | 16 | 17 | string get_cwd(string bin_path); 18 | inline int str2int(const char * str){ 19 | int n; 20 | sscanf(str,"%d",&n); 21 | return n; 22 | } 23 | inline string int2str(int n){ 24 | char str[20] = {'\0'}; 25 | sprintf(str,"%d",n); 26 | return str; 27 | } 28 | 29 | inline string bool2str(bool n){ 30 | if(n == true){ 31 | return "yes"; 32 | }else{ 33 | return "no"; 34 | } 35 | } 36 | 37 | inline map split(string content, char chr){ 38 | map ret; 39 | uint32_t i = 0; 40 | for(string::iterator it = content.begin(); it != content.end(); it++){ 41 | if(*it != chr){ 42 | ret[i] += *it; 43 | }else{ 44 | i++; 45 | } 46 | } 47 | return ret; 48 | } 49 | 50 | inline int get_second(){ 51 | struct timeval tv; 52 | struct timezone tz; 53 | gettimeofday(&tv,&tz); 54 | return tv.tv_sec; 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_VER_H 2 | #define KVPROXY_VER_H 3 | 4 | #define KVPROXY_VERSION 0.1 5 | #define KVPROXY_BUILT "2015-01-11" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /test/makefile: -------------------------------------------------------------------------------- 1 | kvproxy:../src/kvproxy.cpp ../src/extension.cpp ../src/extension.h ../src/hash.cpp ../src/hash.h ../src/serv.cpp ../src/serv.h ../src/conn_pool.cpp ../src/conn_pool.h ../src/log.cpp ../src/log.h ../src/config.cpp ../src/config.h ../src/util.cpp ../src/util.h 2 | g++ ../src/kvproxy.cpp ../src/extension.cpp ../src/hash.cpp ../src/serv.cpp ../src/conn_pool.cpp ../src/log.cpp ../src/util.cpp ../src/config.cpp -I ../src/ -I /home/admin/libevent2/include -L /home/admin/libevent2/lib -ldl -levent -Wall -g -O2 -o kvproxy 3 | hash:../src/hash.cpp ../src/hash.h ./test_hash.cpp 4 | g++ ../src/hash.cpp ./test_hash.cpp -I ../src/ -g -o hash 5 | config:../src/config.cpp ../src/config.h ../src/log.h ./test_config.cpp 6 | g++ ../src/config.cpp ../src/log.cpp ./test_config.cpp -I ../src/ -g -o config 7 | serv:../src/serv.cpp ../src/serv.h ./test_serv.cpp 8 | g++ ../src/serv.cpp ./test_serv.cpp -I ../src/ -L /home/admin/libevent2/lib -levent -g -o serv 9 | ext:../src/extension.cpp ../src/extension.h ./test_ext.cpp 10 | g++ ../src/extension.cpp ./test_ext.cpp -I ../src/ -ldl -g -o ext 11 | util:../src/util.cpp ../src/util.h ./test_util.cpp 12 | g++ ../src/util.cpp ./test_util.cpp -I ../src/ -g -o util 13 | conn:../src/conn_pool.cpp ../src/conn_pool.h ./test_conn.cpp 14 | g++ ../src/conn_pool.cpp ./test_conn.cpp ../src/log.cpp -I ../src/ -lpthread -g -o conn 15 | log:../src/log.cpp ../src/log.h ./test_log.cpp 16 | g++ ../src/log.cpp ./test_log.cpp -I ../src/ -g -o log 17 | clean: 18 | rm core.* 19 | -------------------------------------------------------------------------------- /test/test_config.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(){ 9 | map m; 10 | map::iterator it; 11 | Config conf; 12 | conf.setConfFile("../etc/kvproxy.ini"); 13 | conf.loadConf(); 14 | m = conf.getConfStr("master"); 15 | for(it = m.begin(); it != m.end(); it++){ 16 | cout << it->first << " -- " << it->second << endl; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/test_conn.cpp: -------------------------------------------------------------------------------- 1 | #include "conn_pool.h" 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int conn_fd; 7 | string host; 8 | uint32_t port; 9 | int max_size; 10 | host = "127.0.0.1"; 11 | port = 80; 12 | max_size = 10; 13 | ssize_t len; 14 | string cmd; 15 | char buffer[10240] = {'\0'}; 16 | int timeout = 1000000;//毫秒 17 | 18 | cmd = "stats"; 19 | ConnPool *conn_pool = ConnPool::getInstance(); 20 | conn_pool->initConnection(host, port, max_size); 21 | conn_fd = conn_pool->getConnection(1, host, port); 22 | cout << "conn fd is " << conn_fd << endl; 23 | len = send(conn_fd, cmd.c_str(), cmd.size(), MSG_DONTWAIT); 24 | if(len <= 0){ 25 | cout << "send error" << len << endl; 26 | }else{ 27 | cout << "send success " << len << endl; 28 | } 29 | while (1){ 30 | fd_set rdfds; 31 | struct timeval tv; 32 | int ret; /* 保存返回值 */ 33 | FD_ZERO(&rdfds); /* 用select函数之前先把集合清零 */ 34 | FD_SET(conn_fd, &rdfds); /* 把要检测的句柄socket加入到集合里 */ 35 | tv.tv_sec = 0; 36 | tv.tv_usec = timeout; /* 设置select等待的最大时间为1秒加500微秒 */ 37 | cout << "start select " << endl; 38 | ret = select(conn_fd+1, &rdfds, NULL, NULL, &tv); 39 | if(ret < 0){ 40 | cout << "select error " << endl; 41 | return 0; 42 | }else if (ret == 0){ 43 | cout << "select timeout " << endl; 44 | return 0; 45 | }else if (FD_ISSET(conn_fd,&rdfds) <= 0){ 46 | cout << "can not read" << endl; 47 | return 0; 48 | } 49 | 50 | len = recv(conn_fd, &buffer, sizeof(buffer), MSG_WAITALL);//MSG_PEEK MSG_DONTWAIT MSG_WAITALL 51 | if (len > 0) 52 | { 53 | cout << "buffer is " << buffer << endl; 54 | break; 55 | }else if(len == 0){ 56 | cout << "close connection \n" << endl; 57 | close(conn_fd); 58 | }else if (len == -1) 59 | { 60 | if (errno == EAGAIN) 61 | { 62 | break; 63 | }else if (errno == EINTR) 64 | { 65 | continue; 66 | }else{ 67 | break; 68 | } 69 | } 70 | } 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /test/test_ext.cpp: -------------------------------------------------------------------------------- 1 | #include "extension.h" 2 | 3 | int main(){ 4 | Extension ext; 5 | parse_req_t ptr_parse_req; 6 | ext_ret rt; 7 | map data; 8 | char cmd[20] = {'\0'}; 9 | char key[500] = {'\0'}; 10 | uint32_t expires = 0; 11 | bool update = false; 12 | char req_data[1024] = {'\0'}; 13 | ext.setExtPath("../src/ext/demo/"); 14 | ext.load("demo"); 15 | ptr_parse_req = ext.findParseReq("demo"); 16 | if(ptr_parse_req != NULL){ 17 | rt = ptr_parse_req(&data, cmd, key, expires, update, req_data); 18 | cout << "cmd " << cmd << endl; 19 | cout << "data[key] " << data["key"] << endl; 20 | }else{ 21 | cout << "no find parse req" << endl; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/test_hash.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(){ 9 | /* 10 | set s; 11 | string key; 12 | pair p; 13 | ConsistentHash hash; 14 | char port[10]; 15 | s.insert("192.168.1.1:11211"); 16 | s.insert("192.168.1.2:11211"); 17 | s.insert("192.168.1.3:11211"); 18 | s.insert("192.168.1.4:11211"); 19 | hash.setHosts(s); 20 | key = "a"; 21 | p = hash.find(key); 22 | sprintf(port,"%d",p.second); 23 | cout << "host " << p.first << "port " << port << endl; 24 | */ 25 | map, pair > m; 26 | map > h; 27 | map >::iterator it; 28 | pair p; 29 | m[make_pair("192.168.1.1",11211)] = make_pair(1,3); 30 | m[make_pair("192.168.1.2",11212)] = make_pair(2,2); 31 | m[make_pair("192.168.1.3",11213)] = make_pair(3,4); 32 | ConsistentHash hash; 33 | hash.setHosts(m); 34 | h = hash.getAll(); 35 | for(it = h.begin(); it != h.end(); it++){ 36 | cout << it->first << " -- " << it->second.first << ":" << it->second.second << endl; 37 | } 38 | p = hash.find("123"); 39 | cout << p.first << " -- " << p.second << endl; 40 | cout << "hash size is " << hash.getSize() << endl; 41 | } 42 | -------------------------------------------------------------------------------- /test/test_log.cpp: -------------------------------------------------------------------------------- 1 | #include "log.h" 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | string filename; 7 | int level; 8 | filename = "./test.log"; 9 | log_open(filename.c_str()); 10 | level = get_log_level("debug"); 11 | set_log_level(level); 12 | log_error("%s"," some errors"); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/test_serv.cpp: -------------------------------------------------------------------------------- 1 | #include "serv.h" 2 | #include "log.h" 3 | #include "conn_pool.h" 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | #define BUF_SIZE 10240000 9 | 10 | class KvProxy : public Server 11 | { 12 | private: 13 | vector vec; 14 | protected: 15 | void readEvent(Conn *conn); 16 | void writeEvent(Conn *conn); 17 | void connectionEvent(Conn *conn); 18 | void closeEvent(Conn *conn, short events); 19 | public: 20 | KvProxy(int count) : Server(count) { }; 21 | ~KvProxy(); 22 | 23 | static void quitCb(int sig, short events, void *data); 24 | static void timeOutCb(int id, int short events, void *data); 25 | }; 26 | KvProxy::~KvProxy(){ 27 | printf("destruct \n"); 28 | } 29 | void KvProxy::readEvent(Conn *conn) 30 | { 31 | char buf[BUF_SIZE]; 32 | int len = 0; 33 | len = conn->getReadBufLen(); 34 | len = len > BUF_SIZE ? BUF_SIZE: len; 35 | conn->CopyReadBuf(buf, len); 36 | conn->clearReadBuf(len); 37 | conn->addToWriteBuf(buf, strlen(buf)); 38 | 39 | } 40 | 41 | void KvProxy::writeEvent(Conn *conn) 42 | { 43 | 44 | } 45 | 46 | void KvProxy::connectionEvent(Conn *conn) 47 | { 48 | KvProxy *me = (KvProxy*)conn->getThread()->tcp_connect; 49 | printf("new connection: %d\n", conn->getFd()); 50 | me->vec.push_back(conn); 51 | } 52 | 53 | void KvProxy::closeEvent(Conn *conn, short events) 54 | { 55 | printf("connection closed: %d\n", conn->getFd()); 56 | } 57 | 58 | void KvProxy::quitCb(int sig, short events, void *data) 59 | { 60 | printf("Catch the SIGINT signal, quit in one second\n"); 61 | KvProxy *me = (KvProxy*)data; 62 | timeval tv = {1, 0}; 63 | me->stopRun(&tv); 64 | } 65 | 66 | void KvProxy::timeOutCb(int id, short events, void *data) 67 | { 68 | KvProxy *me = (KvProxy*)data; 69 | char temp[33] = "hello, world\n"; 70 | for(int i=0; ivec.size(); i++) 71 | me->vec[i]->addToWriteBuf(temp, strlen(temp)); 72 | } 73 | 74 | int main() 75 | { 76 | #if defined(SIGPIPE) && defined(SIG_IGN) 77 | signal(SIGPIPE, SIG_IGN); 78 | #endif 79 | printf("pid: %d\n", getpid()); 80 | KvProxy server(7); 81 | server.addSignalEvent(SIGINT, KvProxy::quitCb); 82 | timeval tv = {10, 0}; 83 | server.addTimerEvent(KvProxy::timeOutCb, tv, false); 84 | server.setPort(2111); 85 | server.startRun(); 86 | printf("done\n"); 87 | 88 | return 0; 89 | } 90 | -------------------------------------------------------------------------------- /test/test_util.cpp: -------------------------------------------------------------------------------- 1 | #include "util.h" 2 | using namespace std; 3 | 4 | int main(){ 5 | cout << "start func split " << endl; 6 | string str; 7 | str = "abc:def:123"; 8 | map m; 9 | map::iterator m_it; 10 | m = split(str, ':'); 11 | for(m_it = m.begin(); m_it != m.end(); m_it++){ 12 | cout << m_it->first << " -- " << m_it->second << endl; 13 | } 14 | cout << "end func split " << endl; 15 | return 0; 16 | } 17 | --------------------------------------------------------------------------------