Commit 01bcd2cf authored by gejun's avatar gejun

remove explicit deps on gperftools/profiler.h to adapt different versions of gperftools better

parent cd4f8ee0
...@@ -201,7 +201,7 @@ libbrpc.a:$(BRPC_PROTOS:.proto=.pb.h) $(OBJS) ...@@ -201,7 +201,7 @@ libbrpc.a:$(BRPC_PROTOS:.proto=.pb.h) $(OBJS)
libbrpc.so:$(BRPC_PROTOS:.proto=.pb.h) $(OBJS) libbrpc.so:$(BRPC_PROTOS:.proto=.pb.h) $(OBJS)
@echo "Linking $@" @echo "Linking $@"
$(CXX) -shared -o $@ $(LIBPATHS) $(SOPATHS) -Xlinker "-(" $(filter %.o,$^) -Xlinker "-)" $(STATIC_LINKINGS) $(DYNAMIC_LINKINGS) @$(CXX) -shared -o $@ $(LIBPATHS) $(SOPATHS) -Xlinker "-(" $(filter %.o,$^) -Xlinker "-)" $(STATIC_LINKINGS) $(DYNAMIC_LINKINGS)
libbvar.dbg.a:$(BVAR_DEBUG_OBJS) libbvar.dbg.a:$(BVAR_DEBUG_OBJS)
@echo "Packing $@" @echo "Packing $@"
......
...@@ -246,8 +246,6 @@ if [ -z "$TCMALLOC_LIB" ]; then ...@@ -246,8 +246,6 @@ if [ -z "$TCMALLOC_LIB" ]; then
append_to_output " \$(error \"Fail to find gperftools\")" append_to_output " \$(error \"Fail to find gperftools\")"
else else
append_to_output_libs "$TCMALLOC_LIB" " " append_to_output_libs "$TCMALLOC_LIB" " "
TCMALLOC_HDR=$(find_dir_of_header_or_die google/profiler.h)
append_to_output_headers "$TCMALLOC_HDR" " "
if [ -f $TCMALLOC_LIB/libtcmalloc_and_profiler.a ]; then if [ -f $TCMALLOC_LIB/libtcmalloc_and_profiler.a ]; then
if [ -f $TCMALLOC_LIB/libtcmalloc.so ]; then if [ -f $TCMALLOC_LIB/libtcmalloc.so ]; then
ldd $TCMALLOC_LIB/libtcmalloc.so > libtcmalloc.deps ldd $TCMALLOC_LIB/libtcmalloc.so > libtcmalloc.deps
......
...@@ -87,9 +87,9 @@ void IndexService::default_method(::google::protobuf::RpcController* controller, ...@@ -87,9 +87,9 @@ void IndexService::default_method(::google::protobuf::RpcController* controller,
} }
os << '\n'; os << '\n';
if (use_html) { if (use_html) {
os << "<a href=\"https://github.com/brpc/brpc/tree/master/\">Repo</a>"; os << "<a href=\"https://github.com/brpc/brpc\">github</a>";
} else { } else {
os << "Repo : https://github.com/brpc/brpc/tree/master/"; os << "github : https://github.com/brpc/brpc";
} }
os << NL << NL; os << NL << NL;
if (!as_more) { if (!as_more) {
......
...@@ -18,16 +18,7 @@ ...@@ -18,16 +18,7 @@
#define BRPC_PROFILER_LINKER_H #define BRPC_PROFILER_LINKER_H
#if defined(BRPC_ENABLE_CPU_PROFILER) || defined(BAIDU_RPC_ENABLE_CPU_PROFILER) #if defined(BRPC_ENABLE_CPU_PROFILER) || defined(BAIDU_RPC_ENABLE_CPU_PROFILER)
#ifdef __cplusplus #include "butil/gperftools_profiler.h"
extern "C" {
#endif
// Suppress warning of `google/profiler.h' which has been deprecated since
// gperftools-2.2
void ProfilerStart(const char*);
void ProfilerStop(const char*);
#ifdef __cplusplus
}
#endif
#endif #endif
namespace brpc { namespace brpc {
......
/* Copyright (c) 2005, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ---
* Author: Sanjay Ghemawat
*
* Module for CPU profiling based on periodic pc-sampling.
*
* These functions are thread-safe.
*/
#ifndef BUTIL_GPERFTOOLS_PROFILER_H_
#define BUTIL_GPERFTOOLS_PROFILER_H_
/* Annoying stuff for windows; makes sure clients can import these functions */
#ifndef BRPC_DLL_DECL
# ifdef _WIN32
# define BRPC_DLL_DECL __declspec(dllimport)
# else
# define BRPC_DLL_DECL
# endif
#endif
/* All this code should be usable from within C apps. */
#ifdef __cplusplus
extern "C" {
#endif
/* Start profiling and write profile info into fname, discarding any
* existing profiling data in that file.
*
* This is equivalent to calling ProfilerStartWithOptions(fname, NULL).
*/
BRPC_DLL_DECL int ProfilerStart(const char* fname);
/* Stop profiling. Can be started again with ProfilerStart(), but
* the currently accumulated profiling data will be cleared.
*/
BRPC_DLL_DECL void ProfilerStop();
/* Flush any currently buffered profiling state to the profile file.
* Has no effect if the profiler has not been started.
*/
BRPC_DLL_DECL void ProfilerFlush();
/* Returns nonzero if profile is currently enabled, zero if it's not. */
BRPC_DLL_DECL int ProfilingIsEnabledForAllThreads();
/* Routine for registering new threads with the profiler.
*/
BRPC_DLL_DECL void ProfilerRegisterThread();
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* BUTIL_GPERFTOOLS_PROFILER_H_ */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include <fstream> #include <fstream>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <gperftools/profiler.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/gperftools_profiler.h"
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "brpc/socket.h" #include "brpc/socket.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <gperftools/profiler.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h> #include "butil/gperftools_profiler.h"
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/fd_utility.h" #include "butil/fd_utility.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/gperftools_profiler.h"
#include "brpc/socket.h" #include "brpc/socket.h"
#include "brpc/acceptor.h" #include "brpc/acceptor.h"
#include "brpc/server.h" #include "brpc/server.h"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netdb.h> // #include <netdb.h> //
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h> #include "butil/gperftools_profiler.h"
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/fd_utility.h" #include "butil/fd_utility.h"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <map> #include <map>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h> #include "butil/gperftools_profiler.h"
#include "butil/time.h" #include "butil/time.h"
#include "butil/containers/doubly_buffered_data.h" #include "butil/containers/doubly_buffered_data.h"
#include "brpc/socket.h" #include "brpc/socket.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
......
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <gperftools/profiler.h>
#include <json2pb/pb_to_json.h>
#include <json2pb/json_to_pb.h>
#include <butil/iobuf.h>
#include <google/protobuf/text_format.h> #include <google/protobuf/text_format.h>
#include <butil/third_party/rapidjson/rapidjson.h> #include "butil/iobuf.h"
#include "butil/third_party/rapidjson/rapidjson.h"
#include "butil/time.h" #include "butil/time.h"
#include "butil/gperftools_profiler.h"
#include "json2pb/pb_to_json.h"
#include "json2pb/json_to_pb.h"
#include "json2pb/encode_decode.h"
#include "message.pb.h" #include "message.pb.h"
#include "addressbook1.pb.h" #include "addressbook1.pb.h"
#include "addressbook.pb.h" #include "addressbook.pb.h"
#include "addressbook_encode_decode.pb.h" #include "addressbook_encode_decode.pb.h"
#include "addressbook_map.pb.h" #include "addressbook_map.pb.h"
#include <json2pb/encode_decode.h>
namespace { // just for coding-style check namespace { // just for coding-style check
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <fstream> #include <fstream>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Date: 2015/01/20 19:01:06 // Date: 2015/01/20 19:01:06
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h> #include "butil/gperftools_profiler.h"
#include "butil/third_party/snappy/snappy.h" #include "butil/third_party/snappy/snappy.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/iobuf.h" #include "butil/iobuf.h"
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <gperftools/profiler.h>
#include "brpc/socket.h" #include "brpc/socket.h"
#include "brpc/socket_map.h" #include "brpc/socket_map.h"
#include "brpc/reloadable_flags.h" #include "brpc/reloadable_flags.h"
......
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <fcntl.h> // F_GETFD #include <fcntl.h> // F_GETFD
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h> #include "butil/gperftools_profiler.h"
#include <bthread/unstable.h>
#include <bthread/task_control.h>
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/fd_utility.h" #include "butil/fd_utility.h"
#include "bthread/unstable.h"
#include "bthread/task_control.h"
#include "brpc/socket.h" #include "brpc/socket.h"
#include "brpc/errno.pb.h" #include "brpc/errno.pb.h"
#include "brpc/acceptor.h" #include "brpc/acceptor.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include "butil/time.h" #include "butil/time.h"
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/scoped_lock.h" #include "butil/scoped_lock.h"
#include "butil/gperftools_profiler.h"
#include "bthread/bthread.h" #include "bthread/bthread.h"
#include "bthread/condition_variable.h" #include "bthread/condition_variable.h"
#include "bthread/stack.h" #include "bthread/stack.h"
...@@ -198,14 +199,6 @@ TEST(CondTest, cpp_wrapper) { ...@@ -198,14 +199,6 @@ TEST(CondTest, cpp_wrapper) {
#undef pthread_create #undef pthread_create
#endif #endif
#define ENABLE_PROFILE
#ifdef ENABLE_PROFILE
# include <gperftools/profiler.h>
#else
# define ProfilerStart(a)
# define ProfilerStop()
#endif
class Signal { class Signal {
protected: protected:
Signal() : _signal(0) {} Signal() : _signal(0) {}
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/scoped_lock.h" #include "butil/scoped_lock.h"
#include "butil/fd_utility.h" #include "butil/fd_utility.h"
#include "butil/logging.h" #include "butil/logging.h"
#include "butil/gperftools_profiler.h"
#include "bthread/bthread.h" #include "bthread/bthread.h"
#include "bthread/task_control.h" #include "bthread/task_control.h"
#include "bthread/task_group.h" #include "bthread/task_group.h"
......
...@@ -9,14 +9,7 @@ ...@@ -9,14 +9,7 @@
#include <bthread/countdown_event.h> #include <bthread/countdown_event.h>
#include "butil/time.h" #include "butil/time.h"
#include "butil/fast_rand.h" #include "butil/fast_rand.h"
#include "butil/gperftools_profiler.h"
#define ENABLE_PROFILE
#ifdef ENABLE_PROFILE
# include <gperftools/profiler.h>
#else
# define ProfilerStart(a)
# define ProfilerStop()
#endif
namespace { namespace {
bool stopped = false; bool stopped = false;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <sys/utsname.h> // uname #include <sys/utsname.h> // uname
#include <fcntl.h> #include <fcntl.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h> #include "butil/gperftools_profiler.h"
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/fd_utility.h" #include "butil/fd_utility.h"
......
...@@ -11,14 +11,7 @@ ...@@ -11,14 +11,7 @@
#include "bthread/butex.h" #include "bthread/butex.h"
#include "bthread/task_control.h" #include "bthread/task_control.h"
#include "bthread/mutex.h" #include "bthread/mutex.h"
#include "butil/gperftools_profiler.h"
//#define ENABLE_PROFILE
#ifdef ENABLE_PROFILE
# include <gperftools/profiler.h>
#else
# define ProfilerStart(a)
# define ProfilerStop()
#endif
namespace { namespace {
inline unsigned* get_butex(bthread_mutex_t & m) { inline unsigned* get_butex(bthread_mutex_t & m) {
......
...@@ -7,18 +7,11 @@ ...@@ -7,18 +7,11 @@
#include "butil/time.h" #include "butil/time.h"
#include "butil/macros.h" #include "butil/macros.h"
#include "butil/logging.h" #include "butil/logging.h"
#include <bthread/task_meta.h>
#include "butil/logging.h" #include "butil/logging.h"
#include "butil/gperftools_profiler.h"
#include "bthread/bthread.h" #include "bthread/bthread.h"
#include "bthread/unstable.h" #include "bthread/unstable.h"
#include "bthread/task_meta.h"
#define ENABLE_PROFILE
#ifdef ENABLE_PROFILE
# include <gperftools/profiler.h>
#else
# define ProfilerStart(a)
# define ProfilerStop()
#endif
namespace { namespace {
class BthreadTest : public ::testing::Test{ class BthreadTest : public ::testing::Test{
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <condition_variable> #include <condition_variable>
#endif #endif
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h> #include "butil/gperftools_profiler.h"
#include "bvar/utils/lock_timer.h" #include "bvar/utils/lock_timer.h"
namespace { namespace {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "bvar/detail/percentile.h" #include "bvar/detail/percentile.h"
#include "butil/logging.h" #include "butil/logging.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gperftools/profiler.h>
#include <fstream> #include <fstream>
class PercentileTest : public testing::Test { class PercentileTest : public testing::Test {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment