From 504ed5997a09006a525af921f2969a096bfd3f44 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 8 Oct 2015 07:38:43 -0700 Subject: Get basic profiler working again --- build.yaml | 1 + 1 file changed, 1 insertion(+) (limited to 'build.yaml') diff --git a/build.yaml b/build.yaml index 98fb0348ca..503d7a80c7 100644 --- a/build.yaml +++ b/build.yaml @@ -437,6 +437,7 @@ libs: - src/core/support/thd_win32.c - src/core/support/time.c - src/core/support/time_posix.c + - src/core/support/time_precise.c - src/core/support/time_win32.c - src/core/support/tls_pthread.c secure: false -- cgit v1.2.3 From 0c331880d0062f39f434ba8ad2341252e38bed79 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 8 Oct 2015 14:51:54 -0700 Subject: Hid test-only functions from surface/call.h --- BUILD | 3 + build.yaml | 1 + gRPC.podspec | 2 + src/core/surface/call.c | 12 ++-- src/core/surface/call.h | 10 ---- src/core/surface/call_test_only.h | 65 ++++++++++++++++++++++ test/core/end2end/tests/compressed_payload.c | 11 ++-- test/cpp/interop/client_helper.h | 6 +- test/cpp/interop/server_helper.cc | 6 +- tools/doxygen/Doxyfile.core.internal | 1 + tools/run_tests/sources_and_headers.json | 4 ++ vsprojects/vcxproj/grpc/grpc.vcxproj | 1 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 3 + .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 1 + .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 3 + 15 files changed, 104 insertions(+), 25 deletions(-) create mode 100644 src/core/surface/call_test_only.h (limited to 'build.yaml') diff --git a/BUILD b/BUILD index 3e2a45b8a0..ffeb31e424 100644 --- a/BUILD +++ b/BUILD @@ -223,6 +223,7 @@ cc_library( "src/core/surface/api_trace.h", "src/core/surface/byte_buffer_queue.h", "src/core/surface/call.h", + "src/core/surface/call_test_only.h", "src/core/surface/channel.h", "src/core/surface/completion_queue.h", "src/core/surface/event_string.h", @@ -509,6 +510,7 @@ cc_library( "src/core/surface/api_trace.h", "src/core/surface/byte_buffer_queue.h", "src/core/surface/call.h", + "src/core/surface/call_test_only.h", "src/core/surface/channel.h", "src/core/surface/completion_queue.h", "src/core/surface/event_string.h", @@ -1296,6 +1298,7 @@ objc_library( "src/core/surface/api_trace.h", "src/core/surface/byte_buffer_queue.h", "src/core/surface/call.h", + "src/core/surface/call_test_only.h", "src/core/surface/channel.h", "src/core/surface/completion_queue.h", "src/core/surface/event_string.h", diff --git a/build.yaml b/build.yaml index 98fb0348ca..e277b60b77 100644 --- a/build.yaml +++ b/build.yaml @@ -183,6 +183,7 @@ filegroups: - src/core/surface/api_trace.h - src/core/surface/byte_buffer_queue.h - src/core/surface/call.h + - src/core/surface/call_test_only.h - src/core/surface/channel.h - src/core/surface/completion_queue.h - src/core/surface/event_string.h diff --git a/gRPC.podspec b/gRPC.podspec index 717e7005ee..6378cf0413 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -227,6 +227,7 @@ Pod::Spec.new do |s| 'src/core/surface/api_trace.h', 'src/core/surface/byte_buffer_queue.h', 'src/core/surface/call.h', + 'src/core/surface/call_test_only.h', 'src/core/surface/channel.h', 'src/core/surface/completion_queue.h', 'src/core/surface/event_string.h', @@ -518,6 +519,7 @@ Pod::Spec.new do |s| 'src/core/surface/api_trace.h', 'src/core/surface/byte_buffer_queue.h', 'src/core/surface/call.h', + 'src/core/surface/call_test_only.h', 'src/core/surface/channel.h', 'src/core/surface/completion_queue.h', 'src/core/surface/event_string.h', diff --git a/src/core/surface/call.c b/src/core/surface/call.c index c8b880b0ad..630be2f73a 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -521,7 +521,7 @@ static void set_compression_algorithm(grpc_call *call, call->compression_algorithm = algo; } -grpc_compression_algorithm grpc_call_get_compression_algorithm( +grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm( grpc_call *call) { grpc_compression_algorithm algorithm; gpr_mu_lock(&call->mu); @@ -561,11 +561,15 @@ static void set_encodings_accepted_by_peer( } } -gpr_uint32 grpc_call_get_encodings_accepted_by_peer(grpc_call *call) { - return call->encodings_accepted_by_peer; +gpr_uint32 grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call) { + gpr_uint32 encodings_accepted_by_peer; + gpr_mu_lock(&call->mu); + encodings_accepted_by_peer = call->encodings_accepted_by_peer; + gpr_mu_unlock(&call->mu); + return encodings_accepted_by_peer; } -gpr_uint32 grpc_call_get_message_flags(grpc_call *call) { +gpr_uint32 grpc_call_test_only_get_message_flags(grpc_call *call) { gpr_uint32 flags; gpr_mu_lock(&call->mu); flags = call->incoming_message_flags; diff --git a/src/core/surface/call.h b/src/core/surface/call.h index cd1db3d417..9b7c6f9bfb 100644 --- a/src/core/surface/call.h +++ b/src/core/surface/call.h @@ -169,16 +169,6 @@ void *grpc_call_context_get(grpc_call *call, grpc_context_index elem); gpr_uint8 grpc_call_is_client(grpc_call *call); -grpc_compression_algorithm grpc_call_get_compression_algorithm(grpc_call *call); - -gpr_uint32 grpc_call_get_message_flags(grpc_call *call); - -/** Returns a bitset for the encodings (compression algorithms) supported by \a - * call's peer. - * - * To be indexed by grpc_compression_algorithm enum values. */ -gpr_uint32 grpc_call_get_encodings_accepted_by_peer(grpc_call *call); - #ifdef __cplusplus } #endif diff --git a/src/core/surface/call_test_only.h b/src/core/surface/call_test_only.h new file mode 100644 index 0000000000..df4be3248b --- /dev/null +++ b/src/core/surface/call_test_only.h @@ -0,0 +1,65 @@ +/* + * + * Copyright 2015, 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. + * + */ + +#ifndef GRPC_INTERNAL_CORE_SURFACE_CALL_TEST_ONLY_H +#define GRPC_INTERNAL_CORE_SURFACE_CALL_TEST_ONLY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Return the compression algorithm from \a call. + * + * \warning This function should \b only be used in test code. */ +grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm( + grpc_call *call); + +/** Return the message flags from \a call. + * + * \warning This function should \b only be used in test code. */ +gpr_uint32 grpc_call_test_only_get_message_flags(grpc_call *call); + +/** Returns a bitset for the encodings (compression algorithms) supported by \a + * call's peer. + * + * To be indexed by grpc_compression_algorithm enum values. */ +gpr_uint32 grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call); + + +#ifdef __cplusplus +} +#endif + +#endif /* GRPC_INTERNAL_CORE_SURFACE_CALL_TEST_ONLY_H */ diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index a4614a2aba..f321fe1e7c 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -46,7 +46,7 @@ #include "test/core/end2end/cq_verifier.h" #include "src/core/channel/channel_args.h" #include "src/core/channel/compress_filter.h" -#include "src/core/surface/call.h" +#include "src/core/surface/call_test_only.h" enum { TIMEOUT = 200000 }; @@ -196,12 +196,13 @@ static void request_with_payload_template( cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); - GPR_ASSERT(GPR_BITCOUNT(grpc_call_get_encodings_accepted_by_peer(s)) == 3); - GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s), + GPR_ASSERT( + GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer(s)) == 3); + GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), GRPC_COMPRESS_NONE) != 0); - GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s), + GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), GRPC_COMPRESS_DEFLATE) != 0); - GPR_ASSERT(GPR_BITGET(grpc_call_get_encodings_accepted_by_peer(s), + GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), GRPC_COMPRESS_GZIP) != 0); op = ops; diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h index 0221df93db..ace193042e 100644 --- a/test/cpp/interop/client_helper.h +++ b/test/cpp/interop/client_helper.h @@ -38,7 +38,7 @@ #include -#include "src/core/surface/call.h" +#include "src/core/surface/call_test_only.h" namespace grpc { namespace testing { @@ -57,11 +57,11 @@ class InteropClientContextInspector { // Inspector methods, able to peek inside ClientContext, follow. grpc_compression_algorithm GetCallCompressionAlgorithm() const { - return grpc_call_get_compression_algorithm(context_.call_); + return grpc_call_test_only_get_compression_algorithm(context_.call_); } gpr_uint32 GetMessageFlags() const { - return grpc_call_get_message_flags(context_.call_); + return grpc_call_test_only_get_message_flags(context_.call_); } private: diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc index 4570750846..5138a38170 100644 --- a/test/cpp/interop/server_helper.cc +++ b/test/cpp/interop/server_helper.cc @@ -38,7 +38,7 @@ #include #include -#include "src/core/surface/call.h" +#include "src/core/surface/call_test_only.h" #include "test/core/end2end/data/ssl_test_data.h" DECLARE_bool(use_tls); @@ -65,11 +65,11 @@ InteropServerContextInspector::InteropServerContextInspector( grpc_compression_algorithm InteropServerContextInspector::GetCallCompressionAlgorithm() const { - return grpc_call_get_compression_algorithm(context_.call_); + return grpc_call_test_only_get_compression_algorithm(context_.call_); } gpr_uint32 InteropServerContextInspector::GetEncodingsAcceptedByClient() const { - return grpc_call_get_encodings_accepted_by_peer(context_.call_); + return grpc_call_test_only_get_encodings_accepted_by_peer(context_.call_); } std::shared_ptr diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 5658a102d7..5fd3ee70d6 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -858,6 +858,7 @@ src/core/statistics/census_rpc_stats.h \ src/core/surface/api_trace.h \ src/core/surface/byte_buffer_queue.h \ src/core/surface/call.h \ +src/core/surface/call_test_only.h \ src/core/surface/channel.h \ src/core/surface/completion_queue.h \ src/core/surface/event_string.h \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 1ceff15a3b..76d66ed7a0 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -12365,6 +12365,7 @@ "src/core/surface/api_trace.h", "src/core/surface/byte_buffer_queue.h", "src/core/surface/call.h", + "src/core/surface/call_test_only.h", "src/core/surface/channel.h", "src/core/surface/completion_queue.h", "src/core/surface/event_string.h", @@ -12607,6 +12608,7 @@ "src/core/surface/call.h", "src/core/surface/call_details.c", "src/core/surface/call_log_batch.c", + "src/core/surface/call_test_only.h", "src/core/surface/channel.c", "src/core/surface/channel.h", "src/core/surface/channel_connectivity.c", @@ -12861,6 +12863,7 @@ "src/core/surface/api_trace.h", "src/core/surface/byte_buffer_queue.h", "src/core/surface/call.h", + "src/core/surface/call_test_only.h", "src/core/surface/channel.h", "src/core/surface/completion_queue.h", "src/core/surface/event_string.h", @@ -13073,6 +13076,7 @@ "src/core/surface/call.h", "src/core/surface/call_details.c", "src/core/surface/call_log_batch.c", + "src/core/surface/call_test_only.h", "src/core/surface/channel.c", "src/core/surface/channel.h", "src/core/surface/channel_connectivity.c", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 183edbc05b..88b883f67c 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -344,6 +344,7 @@ + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 66ce9ca05b..1a46ac8e34 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -743,6 +743,9 @@ src\core\surface + + src\core\surface + src\core\surface diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index b527179f9f..cddd00374b 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -323,6 +323,7 @@ + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 7be3c9ec93..01e0d8dadd 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -641,6 +641,9 @@ src\core\surface + + src\core\surface + src\core\surface -- cgit v1.2.3 From 0ba432d445b6415e04b8b9f20cb093b0a22a4361 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 9 Oct 2015 16:57:11 -0700 Subject: Move profiling system to gpr --- BUILD | 15 ++--- Makefile | 6 +- build.yaml | 6 +- gRPC.podspec | 12 ++-- grpc.gyp | 4 +- src/core/channel/client_channel.c | 8 +-- src/core/channel/compress_filter.c | 4 +- src/core/channel/http_client_filter.c | 4 +- src/core/channel/http_server_filter.c | 4 +- src/core/iomgr/exec_ctx.c | 8 +-- src/core/iomgr/pollset_multipoller_with_epoll.c | 4 +- src/core/iomgr/pollset_posix.c | 32 +++++------ src/core/iomgr/tcp_posix.c | 22 ++++---- src/core/iomgr/wakeup_fd_eventfd.c | 6 +- src/core/profiling/basic_timers.c | 42 +++++++------- src/core/profiling/stap_timers.c | 16 +++--- src/core/profiling/timers.h | 48 ++++++++-------- src/core/support/alloc.c | 12 ++-- src/core/support/sync_posix.c | 8 +-- src/core/surface/call.c | 64 +++++++++++----------- src/core/surface/completion_queue.c | 12 ++-- src/core/surface/init.c | 4 +- src/core/transport/chttp2/parsing.c | 4 +- src/core/transport/chttp2/writing.c | 4 +- src/core/transport/chttp2_transport.c | 24 ++++---- src/core/transport/stream_op.c | 4 +- src/cpp/proto/proto_utils.cc | 4 +- src/cpp/server/server.cc | 4 +- test/core/profiling/timers_test.c | 10 ++-- test/cpp/qps/client_sync.cc | 4 +- tools/doxygen/Doxyfile.core.internal | 6 +- tools/run_tests/sources_and_headers.json | 12 ++-- vsprojects/vcxproj/gpr/gpr.vcxproj | 5 ++ vsprojects/vcxproj/gpr/gpr.vcxproj.filters | 12 ++++ vsprojects/vcxproj/grpc/grpc.vcxproj | 5 -- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 12 ---- .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 5 -- .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 12 ---- 38 files changed, 223 insertions(+), 245 deletions(-) (limited to 'build.yaml') diff --git a/BUILD b/BUILD index 7c01d6b0bb..146e0b3864 100644 --- a/BUILD +++ b/BUILD @@ -44,6 +44,7 @@ package(default_visibility = ["//visibility:public"]) cc_library( name = "gpr", srcs = [ + "src/core/profiling/timers.h", "src/core/support/block_annotate.h", "src/core/support/env.h", "src/core/support/file.h", @@ -53,6 +54,8 @@ cc_library( "src/core/support/string_win32.h", "src/core/support/thd_internal.h", "src/core/support/time_precise.h", + "src/core/profiling/basic_timers.c", + "src/core/profiling/stap_timers.c", "src/core/support/alloc.c", "src/core/support/cmdline.c", "src/core/support/cpu_iphone.c", @@ -218,7 +221,6 @@ cc_library( "src/core/json/json_common.h", "src/core/json/json_reader.h", "src/core/json/json_writer.h", - "src/core/profiling/timers.h", "src/core/statistics/census_interface.h", "src/core/statistics/census_rpc_stats.h", "src/core/surface/api_trace.h", @@ -356,8 +358,6 @@ cc_library( "src/core/json/json_reader.c", "src/core/json/json_string.c", "src/core/json/json_writer.c", - "src/core/profiling/basic_timers.c", - "src/core/profiling/stap_timers.c", "src/core/surface/api_trace.c", "src/core/surface/byte_buffer.c", "src/core/surface/byte_buffer_queue.c", @@ -504,7 +504,6 @@ cc_library( "src/core/json/json_common.h", "src/core/json/json_reader.h", "src/core/json/json_writer.h", - "src/core/profiling/timers.h", "src/core/statistics/census_interface.h", "src/core/statistics/census_rpc_stats.h", "src/core/surface/api_trace.h", @@ -622,8 +621,6 @@ cc_library( "src/core/json/json_reader.c", "src/core/json/json_string.c", "src/core/json/json_writer.c", - "src/core/profiling/basic_timers.c", - "src/core/profiling/stap_timers.c", "src/core/surface/api_trace.c", "src/core/surface/byte_buffer.c", "src/core/surface/byte_buffer_queue.c", @@ -961,6 +958,8 @@ cc_library( objc_library( name = "gpr_objc", srcs = [ + "src/core/profiling/basic_timers.c", + "src/core/profiling/stap_timers.c", "src/core/support/alloc.c", "src/core/support/cmdline.c", "src/core/support/cpu_iphone.c", @@ -1028,6 +1027,7 @@ objc_library( "include/grpc/support/tls_msvc.h", "include/grpc/support/tls_pthread.h", "include/grpc/support/useful.h", + "src/core/profiling/timers.h", "src/core/support/block_annotate.h", "src/core/support/env.h", "src/core/support/file.h", @@ -1147,8 +1147,6 @@ objc_library( "src/core/json/json_reader.c", "src/core/json/json_string.c", "src/core/json/json_writer.c", - "src/core/profiling/basic_timers.c", - "src/core/profiling/stap_timers.c", "src/core/surface/api_trace.c", "src/core/surface/byte_buffer.c", "src/core/surface/byte_buffer_queue.c", @@ -1292,7 +1290,6 @@ objc_library( "src/core/json/json_common.h", "src/core/json/json_reader.h", "src/core/json/json_writer.h", - "src/core/profiling/timers.h", "src/core/statistics/census_interface.h", "src/core/statistics/census_rpc_stats.h", "src/core/surface/api_trace.h", diff --git a/Makefile b/Makefile index 6d6dc71acc..788fdb5215 100644 --- a/Makefile +++ b/Makefile @@ -3893,6 +3893,8 @@ clean: LIBGPR_SRC = \ + src/core/profiling/basic_timers.c \ + src/core/profiling/stap_timers.c \ src/core/support/alloc.c \ src/core/support/cmdline.c \ src/core/support/cpu_iphone.c \ @@ -4118,8 +4120,6 @@ LIBGRPC_SRC = \ src/core/json/json_reader.c \ src/core/json/json_string.c \ src/core/json/json_writer.c \ - src/core/profiling/basic_timers.c \ - src/core/profiling/stap_timers.c \ src/core/surface/api_trace.c \ src/core/surface/byte_buffer.c \ src/core/surface/byte_buffer_queue.c \ @@ -4400,8 +4400,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/json/json_reader.c \ src/core/json/json_string.c \ src/core/json/json_writer.c \ - src/core/profiling/basic_timers.c \ - src/core/profiling/stap_timers.c \ src/core/surface/api_trace.c \ src/core/surface/byte_buffer.c \ src/core/surface/byte_buffer_queue.c \ diff --git a/build.yaml b/build.yaml index 503d7a80c7..0cba1730d1 100644 --- a/build.yaml +++ b/build.yaml @@ -177,7 +177,6 @@ filegroups: - src/core/json/json_common.h - src/core/json/json_reader.h - src/core/json/json_writer.h - - src/core/profiling/timers.h - src/core/statistics/census_interface.h - src/core/statistics/census_rpc_stats.h - src/core/surface/api_trace.h @@ -292,8 +291,6 @@ filegroups: - src/core/json/json_reader.c - src/core/json/json_string.c - src/core/json/json_writer.c - - src/core/profiling/basic_timers.c - - src/core/profiling/stap_timers.c - src/core/surface/api_trace.c - src/core/surface/byte_buffer.c - src/core/surface/byte_buffer_queue.c @@ -392,6 +389,7 @@ libs: - include/grpc/support/tls_pthread.h - include/grpc/support/useful.h headers: + - src/core/profiling/timers.h - src/core/support/block_annotate.h - src/core/support/env.h - src/core/support/file.h @@ -402,6 +400,8 @@ libs: - src/core/support/thd_internal.h - src/core/support/time_precise.h src: + - src/core/profiling/basic_timers.c + - src/core/profiling/stap_timers.c - src/core/support/alloc.c - src/core/support/cmdline.c - src/core/support/cpu_iphone.c diff --git a/gRPC.podspec b/gRPC.podspec index 5b93281b41..12642b5869 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -63,7 +63,8 @@ Pod::Spec.new do |s| # Core cross-platform gRPC library, written in C. s.subspec 'C-Core' do |ss| - ss.source_files = 'src/core/support/block_annotate.h', + ss.source_files = 'src/core/profiling/timers.h', + 'src/core/support/block_annotate.h', 'src/core/support/env.h', 'src/core/support/file.h', 'src/core/support/murmur_hash.h', @@ -99,6 +100,8 @@ Pod::Spec.new do |s| 'grpc/support/tls_msvc.h', 'grpc/support/tls_pthread.h', 'grpc/support/useful.h', + 'src/core/profiling/basic_timers.c', + 'src/core/profiling/stap_timers.c', 'src/core/support/alloc.c', 'src/core/support/cmdline.c', 'src/core/support/cpu_iphone.c', @@ -222,7 +225,6 @@ Pod::Spec.new do |s| 'src/core/json/json_common.h', 'src/core/json/json_reader.h', 'src/core/json/json_writer.h', - 'src/core/profiling/timers.h', 'src/core/statistics/census_interface.h', 'src/core/statistics/census_rpc_stats.h', 'src/core/surface/api_trace.h', @@ -367,8 +369,6 @@ Pod::Spec.new do |s| 'src/core/json/json_reader.c', 'src/core/json/json_string.c', 'src/core/json/json_writer.c', - 'src/core/profiling/basic_timers.c', - 'src/core/profiling/stap_timers.c', 'src/core/surface/api_trace.c', 'src/core/surface/byte_buffer.c', 'src/core/surface/byte_buffer_queue.c', @@ -419,7 +419,8 @@ Pod::Spec.new do |s| 'src/core/census/operation.c', 'src/core/census/tracing.c' - ss.private_header_files = 'src/core/support/block_annotate.h', + ss.private_header_files = 'src/core/profiling/timers.h', + 'src/core/support/block_annotate.h', 'src/core/support/env.h', 'src/core/support/file.h', 'src/core/support/murmur_hash.h', @@ -513,7 +514,6 @@ Pod::Spec.new do |s| 'src/core/json/json_common.h', 'src/core/json/json_reader.h', 'src/core/json/json_writer.h', - 'src/core/profiling/timers.h', 'src/core/statistics/census_interface.h', 'src/core/statistics/census_rpc_stats.h', 'src/core/surface/api_trace.h', diff --git a/grpc.gyp b/grpc.gyp index 668a6e12f3..8bb148d57d 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -94,6 +94,8 @@ 'dependencies': [ ], 'sources': [ + 'src/core/profiling/basic_timers.c', + 'src/core/profiling/stap_timers.c', 'src/core/support/alloc.c', 'src/core/support/cmdline.c', 'src/core/support/cpu_iphone.c', @@ -239,8 +241,6 @@ 'src/core/json/json_reader.c', 'src/core/json/json_string.c', 'src/core/json/json_writer.c', - 'src/core/profiling/basic_timers.c', - 'src/core/profiling/stap_timers.c', 'src/core/surface/api_trace.c', 'src/core/surface/byte_buffer.c', 'src/core/surface/byte_buffer_queue.c', diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index 79c5658084..1bdba5b3c0 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -237,7 +237,7 @@ static void picked_target(grpc_exec_ctx *exec_ctx, void *arg, call_data *calld = arg; grpc_pollset *pollset; - GRPC_TIMER_BEGIN("picked_target", 0); + GPR_TIMER_BEGIN("picked_target", 0); if (calld->picked_channel == NULL) { /* treat this like a cancellation */ @@ -260,7 +260,7 @@ static void picked_target(grpc_exec_ctx *exec_ctx, void *arg, } } - GRPC_TIMER_END("picked_target", 0); + GPR_TIMER_END("picked_target", 0); } static grpc_closure *merge_into_waiting_op(grpc_call_element *elem, @@ -321,7 +321,7 @@ static void perform_transport_stream_op(grpc_exec_ctx *exec_ctx, grpc_subchannel_call *subchannel_call; grpc_lb_policy *lb_policy; grpc_transport_stream_op op2; - GRPC_TIMER_BEGIN("perform_transport_stream_op", 0); + GPR_TIMER_BEGIN("perform_transport_stream_op", 0); GPR_ASSERT(elem->filter == &grpc_client_channel_filter); GRPC_CALL_LOG_OP(GPR_INFO, elem, op); @@ -434,7 +434,7 @@ static void perform_transport_stream_op(grpc_exec_ctx *exec_ctx, break; } - GRPC_TIMER_END("perform_transport_stream_op", 0); + GPR_TIMER_END("perform_transport_stream_op", 0); } static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, diff --git a/src/core/channel/compress_filter.c b/src/core/channel/compress_filter.c index 6c1ed2931f..477e607596 100644 --- a/src/core/channel/compress_filter.c +++ b/src/core/channel/compress_filter.c @@ -272,13 +272,13 @@ static void process_send_ops(grpc_call_element *elem, static void compress_start_transport_stream_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op *op) { - GRPC_TIMER_BEGIN("compress_start_transport_stream_op", 0); + GPR_TIMER_BEGIN("compress_start_transport_stream_op", 0); if (op->send_ops && op->send_ops->nops > 0) { process_send_ops(elem, op->send_ops); } - GRPC_TIMER_END("compress_start_transport_stream_op", 0); + GPR_TIMER_END("compress_start_transport_stream_op", 0); /* pass control down the stack */ grpc_call_next_op(exec_ctx, elem, op); diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index 9a7f8c45be..f78a5cc315 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -163,10 +163,10 @@ static void hc_mutate_op(grpc_call_element *elem, static void hc_start_transport_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op *op) { - GRPC_TIMER_BEGIN("hc_start_transport_op", 0); + GPR_TIMER_BEGIN("hc_start_transport_op", 0); GRPC_CALL_LOG_OP(GPR_INFO, elem, op); hc_mutate_op(elem, op); - GRPC_TIMER_END("hc_start_transport_op", 0); + GPR_TIMER_END("hc_start_transport_op", 0); grpc_call_next_op(exec_ctx, elem, op); } diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 16a0c1d3ac..99e5066a4e 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -231,10 +231,10 @@ static void hs_start_transport_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op *op) { GRPC_CALL_LOG_OP(GPR_INFO, elem, op); - GRPC_TIMER_BEGIN("hs_start_transport_op", 0); + GPR_TIMER_BEGIN("hs_start_transport_op", 0); hs_mutate_op(elem, op); grpc_call_next_op(exec_ctx, elem, op); - GRPC_TIMER_END("hs_start_transport_op", 0); + GPR_TIMER_END("hs_start_transport_op", 0); } /* Constructor for call_data */ diff --git a/src/core/iomgr/exec_ctx.c b/src/core/iomgr/exec_ctx.c index 1ad39885e4..410b34c521 100644 --- a/src/core/iomgr/exec_ctx.c +++ b/src/core/iomgr/exec_ctx.c @@ -39,20 +39,20 @@ int grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) { int did_something = 0; - GRPC_TIMER_BEGIN("grpc_exec_ctx_flush", 0); + GPR_TIMER_BEGIN("grpc_exec_ctx_flush", 0); while (!grpc_closure_list_empty(exec_ctx->closure_list)) { grpc_closure *c = exec_ctx->closure_list.head; exec_ctx->closure_list.head = exec_ctx->closure_list.tail = NULL; while (c != NULL) { grpc_closure *next = c->next; did_something++; - GRPC_TIMER_BEGIN("grpc_exec_ctx_flush.cb", 0); + GPR_TIMER_BEGIN("grpc_exec_ctx_flush.cb", 0); c->cb(exec_ctx, c->cb_arg, c->success); - GRPC_TIMER_END("grpc_exec_ctx_flush.cb", 0); + GPR_TIMER_END("grpc_exec_ctx_flush.cb", 0); c = next; } } - GRPC_TIMER_END("grpc_exec_ctx_flush", 0); + GPR_TIMER_END("grpc_exec_ctx_flush", 0); return did_something; } diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index e874391895..2aafd21dfb 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -183,11 +183,11 @@ static void multipoll_with_epoll_pollset_maybe_work_and_unlock( /* TODO(vpai): Consider first doing a 0 timeout poll here to avoid even going into the blocking annotation if possible */ - GRPC_TIMER_BEGIN("poll", 0); + GPR_TIMER_BEGIN("poll", 0); GRPC_SCHEDULING_START_BLOCKING_REGION; poll_rv = grpc_poll_function(pfds, 2, timeout_ms); GRPC_SCHEDULING_END_BLOCKING_REGION; - GRPC_TIMER_END("poll", 0); + GPR_TIMER_END("poll", 0); if (poll_rv < 0) { if (errno != EINTR) { diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index 6c813bf27a..4d8bc5374f 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -101,12 +101,12 @@ static void push_front_worker(grpc_pollset *p, grpc_pollset_worker *worker) { void grpc_pollset_kick_ext(grpc_pollset *p, grpc_pollset_worker *specific_worker, gpr_uint32 flags) { - GRPC_TIMER_BEGIN("grpc_pollset_kick_ext", 0); + GPR_TIMER_BEGIN("grpc_pollset_kick_ext", 0); /* pollset->mu already held */ if (specific_worker != NULL) { if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) { - GRPC_TIMER_BEGIN("grpc_pollset_kick_ext.broadcast", 0); + GPR_TIMER_BEGIN("grpc_pollset_kick_ext.broadcast", 0); GPR_ASSERT((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) == 0); for (specific_worker = p->root_worker.next; specific_worker != &p->root_worker; @@ -114,16 +114,16 @@ void grpc_pollset_kick_ext(grpc_pollset *p, grpc_wakeup_fd_wakeup(&specific_worker->wakeup_fd); } p->kicked_without_pollers = 1; - GRPC_TIMER_END("grpc_pollset_kick_ext.broadcast", 0); + GPR_TIMER_END("grpc_pollset_kick_ext.broadcast", 0); } else if (gpr_tls_get(&g_current_thread_worker) != (gpr_intptr)specific_worker) { - GRPC_TIMER_MARK("different_thread_worker", 0); + GPR_TIMER_MARK("different_thread_worker", 0); if ((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) != 0) { specific_worker->reevaluate_polling_on_wakeup = 1; } grpc_wakeup_fd_wakeup(&specific_worker->wakeup_fd); } else if ((flags & GRPC_POLLSET_CAN_KICK_SELF) != 0) { - GRPC_TIMER_MARK("kick_yoself", 0); + GPR_TIMER_MARK("kick_yoself", 0); if ((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) != 0) { specific_worker->reevaluate_polling_on_wakeup = 1; } @@ -131,12 +131,12 @@ void grpc_pollset_kick_ext(grpc_pollset *p, } } else if (gpr_tls_get(&g_current_thread_poller) != (gpr_intptr)p) { GPR_ASSERT((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) == 0); - GRPC_TIMER_MARK("kick_anonymous", 0); + GPR_TIMER_MARK("kick_anonymous", 0); specific_worker = pop_front_worker(p); if (specific_worker != NULL) { if (gpr_tls_get(&g_current_thread_worker) == (gpr_intptr)specific_worker) { - GRPC_TIMER_MARK("kick_anonymous_not_self", 0); + GPR_TIMER_MARK("kick_anonymous_not_self", 0); push_back_worker(p, specific_worker); specific_worker = pop_front_worker(p); if ((flags & GRPC_POLLSET_CAN_KICK_SELF) == 0 && @@ -147,17 +147,17 @@ void grpc_pollset_kick_ext(grpc_pollset *p, } } if (specific_worker != NULL) { - GRPC_TIMER_MARK("finally_kick", 0); + GPR_TIMER_MARK("finally_kick", 0); push_back_worker(p, specific_worker); grpc_wakeup_fd_wakeup(&specific_worker->wakeup_fd); } } else { - GRPC_TIMER_MARK("kicked_no_pollers", 0); + GPR_TIMER_MARK("kicked_no_pollers", 0); p->kicked_without_pollers = 1; } } - GRPC_TIMER_END("grpc_pollset_kick_ext", 0); + GPR_TIMER_END("grpc_pollset_kick_ext", 0); } void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) { @@ -238,7 +238,7 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, int locked = 1; int queued_work = 0; int keep_polling = 0; - GRPC_TIMER_BEGIN("grpc_pollset_work", 0); + GPR_TIMER_BEGIN("grpc_pollset_work", 0); /* this must happen before we (potentially) drop pollset->mu */ worker->next = worker->prev = NULL; worker->reevaluate_polling_on_wakeup = 0; @@ -283,10 +283,10 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, } gpr_tls_set(&g_current_thread_poller, (gpr_intptr)pollset); gpr_tls_set(&g_current_thread_worker, (gpr_intptr)worker); - GRPC_TIMER_BEGIN("maybe_work_and_unlock", 0); + GPR_TIMER_BEGIN("maybe_work_and_unlock", 0); pollset->vtable->maybe_work_and_unlock(exec_ctx, pollset, worker, deadline, now); - GRPC_TIMER_END("maybe_work_and_unlock", 0); + GPR_TIMER_END("maybe_work_and_unlock", 0); locked = 0; gpr_tls_set(&g_current_thread_poller, 0); gpr_tls_set(&g_current_thread_worker, 0); @@ -341,7 +341,7 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, gpr_mu_lock(&pollset->mu); } } - GRPC_TIMER_END("grpc_pollset_work", 0); + GPR_TIMER_END("grpc_pollset_work", 0); } void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, @@ -576,11 +576,11 @@ static void basic_pollset_maybe_work_and_unlock(grpc_exec_ctx *exec_ctx, even going into the blocking annotation if possible */ /* poll fd count (argument 2) is shortened by one if we have no events to poll on - such that it only includes the kicker */ - GRPC_TIMER_BEGIN("poll", 0); + GPR_TIMER_BEGIN("poll", 0); GRPC_SCHEDULING_START_BLOCKING_REGION; r = grpc_poll_function(pfd, nfds, timeout); GRPC_SCHEDULING_END_BLOCKING_REGION; - GRPC_TIMER_END("poll", 0); + GPR_TIMER_END("poll", 0); if (r < 0) { gpr_log(GPR_ERROR, "poll() failed: %s", strerror(errno)); diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c index 9e3773bcd4..915553d509 100644 --- a/src/core/iomgr/tcp_posix.c +++ b/src/core/iomgr/tcp_posix.c @@ -180,7 +180,7 @@ static void tcp_continue_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { GPR_ASSERT(!tcp->finished_edge); GPR_ASSERT(tcp->iov_size <= MAX_READ_IOVEC); GPR_ASSERT(tcp->incoming_buffer->count <= MAX_READ_IOVEC); - GRPC_TIMER_BEGIN("tcp_continue_read", 0); + GPR_TIMER_BEGIN("tcp_continue_read", 0); while (tcp->incoming_buffer->count < (size_t)tcp->iov_size) { gpr_slice_buffer_add_indexed(tcp->incoming_buffer, @@ -199,11 +199,11 @@ static void tcp_continue_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { msg.msg_controllen = 0; msg.msg_flags = 0; - GRPC_TIMER_BEGIN("recvmsg", 1); + GPR_TIMER_BEGIN("recvmsg", 1); do { read_bytes = recvmsg(tcp->fd, &msg, 0); } while (read_bytes < 0 && errno == EINTR); - GRPC_TIMER_END("recvmsg", 0); + GPR_TIMER_END("recvmsg", 0); if (read_bytes < 0) { /* NB: After calling call_read_cb a parallel call of the read handler may @@ -240,7 +240,7 @@ static void tcp_continue_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { TCP_UNREF(exec_ctx, tcp, "read"); } - GRPC_TIMER_END("tcp_continue_read", 0); + GPR_TIMER_END("tcp_continue_read", 0); } static void tcp_handle_read(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, @@ -316,12 +316,12 @@ static flush_result tcp_flush(grpc_tcp *tcp) { msg.msg_controllen = 0; msg.msg_flags = 0; - GRPC_TIMER_BEGIN("sendmsg", 1); + GPR_TIMER_BEGIN("sendmsg", 1); do { /* TODO(klempner): Cork if this is a partial write */ sent_length = sendmsg(tcp->fd, &msg, SENDMSG_FLAGS); } while (sent_length < 0 && errno == EINTR); - GRPC_TIMER_END("sendmsg", 0); + GPR_TIMER_END("sendmsg", 0); if (sent_length < 0) { if (errno == EAGAIN) { @@ -376,9 +376,9 @@ static void tcp_handle_write(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, } else { cb = tcp->write_cb; tcp->write_cb = NULL; - GRPC_TIMER_BEGIN("tcp_handle_write.cb", 0); + GPR_TIMER_BEGIN("tcp_handle_write.cb", 0); cb->cb(exec_ctx, cb->cb_arg, status == FLUSH_DONE); - GRPC_TIMER_END("tcp_handle_write.cb", 0); + GPR_TIMER_END("tcp_handle_write.cb", 0); TCP_UNREF(exec_ctx, tcp, "write"); } } @@ -399,11 +399,11 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, } } - GRPC_TIMER_BEGIN("tcp_write", 0); + GPR_TIMER_BEGIN("tcp_write", 0); GPR_ASSERT(tcp->write_cb == NULL); if (buf->length == 0) { - GRPC_TIMER_END("tcp_write", 0); + GPR_TIMER_END("tcp_write", 0); grpc_exec_ctx_enqueue(exec_ctx, cb, 1); return; } @@ -420,7 +420,7 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_exec_ctx_enqueue(exec_ctx, cb, status == FLUSH_DONE); } - GRPC_TIMER_END("tcp_write", 0); + GPR_TIMER_END("tcp_write", 0); } static void tcp_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, diff --git a/src/core/iomgr/wakeup_fd_eventfd.c b/src/core/iomgr/wakeup_fd_eventfd.c index 48eb1afb3d..f67379e4fc 100644 --- a/src/core/iomgr/wakeup_fd_eventfd.c +++ b/src/core/iomgr/wakeup_fd_eventfd.c @@ -39,9 +39,11 @@ #include #include -#include "src/core/iomgr/wakeup_fd_posix.h" #include +#include "src/core/iomgr/wakeup_fd_posix.h" +#include "src/core/profiling/timers.h" + static void eventfd_create(grpc_wakeup_fd* fd_info) { int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); /* TODO(klempner): Handle failure more gracefully */ @@ -60,9 +62,11 @@ static void eventfd_consume(grpc_wakeup_fd* fd_info) { static void eventfd_wakeup(grpc_wakeup_fd* fd_info) { int err; + GPR_TIMER_BEGIN("eventfd_wakeup", 0); do { err = eventfd_write(fd_info->read_fd, 1); } while (err < 0 && errno == EINTR); + GPR_TIMER_END("eventfd_wakeup", 0); } static void eventfd_destroy(grpc_wakeup_fd* fd_info) { diff --git a/src/core/profiling/basic_timers.c b/src/core/profiling/basic_timers.c index 8a68277cca..b49cdd07b3 100644 --- a/src/core/profiling/basic_timers.c +++ b/src/core/profiling/basic_timers.c @@ -46,18 +46,18 @@ typedef enum { BEGIN = '{', END = '}', MARK = '.' } marker_type; -typedef struct grpc_timer_entry { +typedef struct gpr_timer_entry { gpr_timespec tm; const char *tagstr; const char *file; int line; char type; gpr_uint8 important; -} grpc_timer_entry; +} gpr_timer_entry; -#define MAX_COUNT (1024 * 1024 / sizeof(grpc_timer_entry)) +#define MAX_COUNT (1024 * 1024 / sizeof(gpr_timer_entry)) -static __thread grpc_timer_entry g_log[MAX_COUNT]; +static __thread gpr_timer_entry g_log[MAX_COUNT]; static __thread int g_count; static gpr_once g_once_init = GPR_ONCE_INIT; static FILE *output_file; @@ -74,7 +74,7 @@ static void log_report() { int i; gpr_once_init(&g_once_init, init_output); for (i = 0; i < g_count; i++) { - grpc_timer_entry *entry = &(g_log[i]); + gpr_timer_entry *entry = &(g_log[i]); fprintf(output_file, "{\"t\": %ld.%09d, \"thd\": \"%p\", \"type\": \"%c\", \"tag\": " "\"%s\", \"file\": \"%s\", \"line\": %d, \"imp\": %d}\n", @@ -87,9 +87,9 @@ static void log_report() { g_count = 0; } -static void grpc_timers_log_add(const char *tagstr, marker_type type, - int important, const char *file, int line) { - grpc_timer_entry *entry; +static void gpr_timers_log_add(const char *tagstr, marker_type type, + int important, const char *file, int line) { + gpr_timer_entry *entry; /* TODO (vpai) : Improve concurrency */ if (g_count == MAX_COUNT) { @@ -107,28 +107,28 @@ static void grpc_timers_log_add(const char *tagstr, marker_type type, } /* Latency profiler API implementation. */ -void grpc_timer_add_mark(const char *tagstr, int important, const char *file, - int line) { - grpc_timers_log_add(tagstr, MARK, important, file, line); +void gpr_timer_add_mark(const char *tagstr, int important, const char *file, + int line) { + gpr_timers_log_add(tagstr, MARK, important, file, line); } -void grpc_timer_begin(const char *tagstr, int important, const char *file, - int line) { - grpc_timers_log_add(tagstr, BEGIN, important, file, line); +void gpr_timer_begin(const char *tagstr, int important, const char *file, + int line) { + gpr_timers_log_add(tagstr, BEGIN, important, file, line); } -void grpc_timer_end(const char *tagstr, int important, const char *file, - int line) { - grpc_timers_log_add(tagstr, END, important, file, line); +void gpr_timer_end(const char *tagstr, int important, const char *file, + int line) { + gpr_timers_log_add(tagstr, END, important, file, line); } /* Basic profiler specific API functions. */ -void grpc_timers_global_init(void) {} +void gpr_timers_global_init(void) {} -void grpc_timers_global_destroy(void) {} +void gpr_timers_global_destroy(void) {} #else /* !GRPC_BASIC_PROFILER */ -void grpc_timers_global_init(void) {} +void gpr_timers_global_init(void) {} -void grpc_timers_global_destroy(void) {} +void gpr_timers_global_destroy(void) {} #endif /* GRPC_BASIC_PROFILER */ diff --git a/src/core/profiling/stap_timers.c b/src/core/profiling/stap_timers.c index 6868a674a9..efcd1af4a1 100644 --- a/src/core/profiling/stap_timers.c +++ b/src/core/profiling/stap_timers.c @@ -42,23 +42,23 @@ #include "src/core/profiling/stap_probes.h" /* Latency profiler API implementation. */ -void grpc_timer_add_mark(int tag, const char *tagstr, void *id, - const char *file, int line) { +void gpr_timer_add_mark(int tag, const char *tagstr, void *id, const char *file, + int line) { _STAP_ADD_MARK(tag); } -void grpc_timer_add_important_mark(int tag, const char *tagstr, void *id, - const char *file, int line) { +void gpr_timer_add_important_mark(int tag, const char *tagstr, void *id, + const char *file, int line) { _STAP_ADD_IMPORTANT_MARK(tag); } -void grpc_timer_begin(int tag, const char *tagstr, void *id, const char *file, - int line) { +void gpr_timer_begin(int tag, const char *tagstr, void *id, const char *file, + int line) { _STAP_TIMING_NS_BEGIN(tag); } -void grpc_timer_end(int tag, const char *tagstr, void *id, const char *file, - int line) { +void gpr_timer_end(int tag, const char *tagstr, void *id, const char *file, + int line) { _STAP_TIMING_NS_END(tag); } diff --git a/src/core/profiling/timers.h b/src/core/profiling/timers.h index 94251fbcf5..1ea7f71dc3 100644 --- a/src/core/profiling/timers.h +++ b/src/core/profiling/timers.h @@ -38,28 +38,28 @@ extern "C" { #endif -void grpc_timers_global_init(void); -void grpc_timers_global_destroy(void); +void gpr_timers_global_init(void); +void gpr_timers_global_destroy(void); -void grpc_timer_add_mark(const char *tagstr, int important, const char *file, - int line); -void grpc_timer_begin(const char *tagstr, int important, const char *file, - int line); -void grpc_timer_end(const char *tagstr, int important, const char *file, - int line); +void gpr_timer_add_mark(const char *tagstr, int important, const char *file, + int line); +void gpr_timer_begin(const char *tagstr, int important, const char *file, + int line); +void gpr_timer_end(const char *tagstr, int important, const char *file, + int line); #if !(defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER)) /* No profiling. No-op all the things. */ -#define GRPC_TIMER_MARK(tag, important) \ - do { \ +#define GPR_TIMER_MARK(tag, important) \ + do { \ } while (0) -#define GRPC_TIMER_BEGIN(tag, important) \ - do { \ +#define GPR_TIMER_BEGIN(tag, important) \ + do { \ } while (0) -#define GRPC_TIMER_END(tag, important) \ - do { \ +#define GPR_TIMER_END(tag, important) \ + do { \ } while (0) #else /* at least one profiler requested... */ @@ -69,14 +69,14 @@ void grpc_timer_end(const char *tagstr, int important, const char *file, #endif /* Generic profiling interface. */ -#define GRPC_TIMER_MARK(tag, important) \ - grpc_timer_add_mark(tag, important, __FILE__, __LINE__); +#define GPR_TIMER_MARK(tag, important) \ + gpr_timer_add_mark(tag, important, __FILE__, __LINE__); -#define GRPC_TIMER_BEGIN(tag, important) \ - grpc_timer_begin(tag, important, __FILE__, __LINE__); +#define GPR_TIMER_BEGIN(tag, important) \ + gpr_timer_begin(tag, important, __FILE__, __LINE__); -#define GRPC_TIMER_END(tag, important) \ - grpc_timer_end(tag, important, __FILE__, __LINE__); +#define GPR_TIMER_END(tag, important) \ + gpr_timer_end(tag, important, __FILE__, __LINE__); #ifdef GRPC_STAP_PROFILER /* Empty placeholder for now. */ @@ -95,17 +95,17 @@ namespace grpc { class ProfileScope { public: ProfileScope(const char *desc, bool important) : desc_(desc) { - GRPC_TIMER_BEGIN(desc_, important ? 1 : 0); + GPR_TIMER_BEGIN(desc_, important ? 1 : 0); } - ~ProfileScope() { GRPC_TIMER_END(desc_, 0); } + ~ProfileScope() { GPR_TIMER_END(desc_, 0); } private: const char *const desc_; }; } -#define GRPC_TIMER_SCOPE(tag, important) \ - ProfileScope _profile_scope_##__LINE__((tag), (important)) +#define GPR_TIMER_SCOPE(tag, important) \ + ::grpc::ProfileScope _profile_scope_##__LINE__((tag), (important)) #endif #endif /* GRPC_CORE_PROFILING_TIMERS_H */ diff --git a/src/core/support/alloc.c b/src/core/support/alloc.c index beb0e780d0..bfcb77956b 100644 --- a/src/core/support/alloc.c +++ b/src/core/support/alloc.c @@ -39,28 +39,28 @@ void *gpr_malloc(size_t size) { void *p; - GRPC_TIMER_BEGIN("gpr_malloc", 0); + GPR_TIMER_BEGIN("gpr_malloc", 0); p = malloc(size); if (!p) { abort(); } - GRPC_TIMER_END("gpr_malloc", 0); + GPR_TIMER_END("gpr_malloc", 0); return p; } void gpr_free(void *p) { - GRPC_TIMER_BEGIN("gpr_free", 0); + GPR_TIMER_BEGIN("gpr_free", 0); free(p); - GRPC_TIMER_END("gpr_free", 0); + GPR_TIMER_END("gpr_free", 0); } void *gpr_realloc(void *p, size_t size) { - GRPC_TIMER_BEGIN("gpr_realloc", 0); + GPR_TIMER_BEGIN("gpr_realloc", 0); p = realloc(p, size); if (!p) { abort(); } - GRPC_TIMER_END("gpr_realloc", 0); + GPR_TIMER_END("gpr_realloc", 0); return p; } diff --git a/src/core/support/sync_posix.c b/src/core/support/sync_posix.c index f356bec984..39c96feb13 100644 --- a/src/core/support/sync_posix.c +++ b/src/core/support/sync_posix.c @@ -47,15 +47,15 @@ void gpr_mu_init(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_init(mu, NULL) == 0); } void gpr_mu_destroy(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_destroy(mu) == 0); } void gpr_mu_lock(gpr_mu* mu) { - GRPC_TIMER_BEGIN("gpr_mu_lock", 0); + GPR_TIMER_BEGIN("gpr_mu_lock", 0); GPR_ASSERT(pthread_mutex_lock(mu) == 0); - GRPC_TIMER_END("gpr_mu_lock", 0); + GPR_TIMER_END("gpr_mu_lock", 0); } void gpr_mu_unlock(gpr_mu* mu) { - GRPC_TIMER_BEGIN("gpr_mu_unlock", 0); + GPR_TIMER_BEGIN("gpr_mu_unlock", 0); GPR_ASSERT(pthread_mutex_unlock(mu) == 0); - GRPC_TIMER_END("gpr_mu_unlock", 0); + GPR_TIMER_END("gpr_mu_unlock", 0); } int gpr_mu_trylock(gpr_mu* mu) { diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 73c526022d..9efcb90a56 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -307,7 +307,7 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call, grpc_channel_stack *channel_stack = grpc_channel_get_channel_stack(channel); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_call *call; - GRPC_TIMER_BEGIN("grpc_call_create", 0); + GPR_TIMER_BEGIN("grpc_call_create", 0); call = gpr_malloc(sizeof(grpc_call) + channel_stack->call_stack_size); memset(call, 0, sizeof(grpc_call)); gpr_mu_init(&call->mu); @@ -402,7 +402,7 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call, set_deadline_alarm(&exec_ctx, call, send_deadline); } grpc_exec_ctx_finish(&exec_ctx); - GRPC_TIMER_END("grpc_call_create", 0); + GPR_TIMER_END("grpc_call_create", 0); return call; } @@ -464,7 +464,7 @@ void grpc_call_internal_ref(grpc_call *c) { static void destroy_call(grpc_exec_ctx *exec_ctx, grpc_call *call) { size_t i; grpc_call *c = call; - GRPC_TIMER_BEGIN("destroy_call", 0); + GPR_TIMER_BEGIN("destroy_call", 0); grpc_call_stack_destroy(exec_ctx, CALL_STACK_FROM_CALL(c)); GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, c->channel, "call"); gpr_mu_destroy(&c->mu); @@ -497,7 +497,7 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, grpc_call *call) { GRPC_CQ_INTERNAL_UNREF(c->cq, "bind"); } gpr_free(c); - GRPC_TIMER_END("destroy_call", 0); + GPR_TIMER_END("destroy_call", 0); } #ifdef GRPC_CALL_REF_COUNT_DEBUG @@ -617,7 +617,7 @@ static void unlock(grpc_exec_ctx *exec_ctx, grpc_call *call) { const size_t MAX_RECV_PEEK_AHEAD = 65536; size_t buffered_bytes; - GRPC_TIMER_BEGIN("unlock", 0); + GPR_TIMER_BEGIN("unlock", 0); memset(&op, 0, sizeof(op)); @@ -690,7 +690,7 @@ static void unlock(grpc_exec_ctx *exec_ctx, grpc_call *call) { GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "completing"); } - GRPC_TIMER_END("unlock", 0); + GPR_TIMER_END("unlock", 0); } static void get_final_status(grpc_call *call, grpc_ioreq_data out) { @@ -840,7 +840,7 @@ static void early_out_write_ops(grpc_call *call) { static void call_on_done_send(grpc_exec_ctx *exec_ctx, void *pc, int success) { grpc_call *call = pc; - GRPC_TIMER_BEGIN("call_on_done_send", 0); + GPR_TIMER_BEGIN("call_on_done_send", 0); lock(call); if (call->last_send_contains & (1 << GRPC_IOREQ_SEND_INITIAL_METADATA)) { finish_ioreq_op(call, GRPC_IOREQ_SEND_INITIAL_METADATA, success); @@ -864,11 +864,11 @@ static void call_on_done_send(grpc_exec_ctx *exec_ctx, void *pc, int success) { call->sending = 0; unlock(exec_ctx, call); GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "sending"); - GRPC_TIMER_END("call_on_done_send", 0); + GPR_TIMER_END("call_on_done_send", 0); } static void finish_message(grpc_call *call) { - GRPC_TIMER_BEGIN("finish_message", 0); + GPR_TIMER_BEGIN("finish_message", 0); if (call->error_status_set == 0) { /* TODO(ctiller): this could be a lot faster if coded directly */ grpc_byte_buffer *byte_buffer; @@ -888,7 +888,7 @@ static void finish_message(grpc_call *call) { gpr_slice_buffer_reset_and_unref(&call->incoming_message); GPR_ASSERT(call->incoming_message.count == 0); call->reading_message = 0; - GRPC_TIMER_END("finish_message", 0); + GPR_TIMER_END("finish_message", 0); } static int begin_message(grpc_call *call, grpc_begin_message msg) { @@ -978,7 +978,7 @@ static void call_on_done_recv(grpc_exec_ctx *exec_ctx, void *pc, int success) { grpc_call *child_call; grpc_call *next_child_call; size_t i; - GRPC_TIMER_BEGIN("call_on_done_recv", 0); + GPR_TIMER_BEGIN("call_on_done_recv", 0); lock(call); call->receiving = 0; if (success) { @@ -988,19 +988,19 @@ static void call_on_done_recv(grpc_exec_ctx *exec_ctx, void *pc, int success) { case GRPC_NO_OP: break; case GRPC_OP_METADATA: - GRPC_TIMER_BEGIN("recv_metadata", 0); + GPR_TIMER_BEGIN("recv_metadata", 0); recv_metadata(exec_ctx, call, &op->data.metadata); - GRPC_TIMER_END("recv_metadata", 0); + GPR_TIMER_END("recv_metadata", 0); break; case GRPC_OP_BEGIN_MESSAGE: - GRPC_TIMER_BEGIN("begin_message", 0); + GPR_TIMER_BEGIN("begin_message", 0); success = begin_message(call, op->data.begin_message); - GRPC_TIMER_END("begin_message", 0); + GPR_TIMER_END("begin_message", 0); break; case GRPC_OP_SLICE: - GRPC_TIMER_BEGIN("add_slice_to_message", 0); + GPR_TIMER_BEGIN("add_slice_to_message", 0); success = add_slice_to_message(call, op->data.slice); - GRPC_TIMER_END("add_slice_to_message", 0); + GPR_TIMER_END("add_slice_to_message", 0); break; } } @@ -1046,7 +1046,7 @@ static void call_on_done_recv(grpc_exec_ctx *exec_ctx, void *pc, int success) { unlock(exec_ctx, call); GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "receiving"); - GRPC_TIMER_END("call_on_done_recv", 0); + GPR_TIMER_END("call_on_done_recv", 0); } static int prepare_application_metadata(grpc_call *call, size_t count, @@ -1524,25 +1524,25 @@ static void recv_metadata(grpc_exec_ctx *exec_ctx, grpc_call *call, grpc_mdelem *mdel = l->md; grpc_mdstr *key = mdel->key; if (key == grpc_channel_get_status_string(call->channel)) { - GRPC_TIMER_BEGIN("status", 0); + GPR_TIMER_BEGIN("status", 0); set_status_code(call, STATUS_FROM_WIRE, decode_status(mdel)); - GRPC_TIMER_END("status", 0); + GPR_TIMER_END("status", 0); } else if (key == grpc_channel_get_message_string(call->channel)) { - GRPC_TIMER_BEGIN("status-details", 0); + GPR_TIMER_BEGIN("status-details", 0); set_status_details(call, STATUS_FROM_WIRE, GRPC_MDSTR_REF(mdel->value)); - GRPC_TIMER_END("status-details", 0); + GPR_TIMER_END("status-details", 0); } else if (key == grpc_channel_get_compression_algorithm_string(call->channel)) { - GRPC_TIMER_BEGIN("compression_algorithm", 0); + GPR_TIMER_BEGIN("compression_algorithm", 0); set_compression_algorithm(call, decode_compression(mdel)); - GRPC_TIMER_END("compression_algorithm", 0); + GPR_TIMER_END("compression_algorithm", 0); } else if (key == grpc_channel_get_encodings_accepted_by_peer_string( call->channel)) { - GRPC_TIMER_BEGIN("encodings_accepted_by_peer", 0); + GPR_TIMER_BEGIN("encodings_accepted_by_peer", 0); set_encodings_accepted_by_peer(call, mdel->value->slice); - GRPC_TIMER_END("encodings_accepted_by_peer", 0); + GPR_TIMER_END("encodings_accepted_by_peer", 0); } else { - GRPC_TIMER_BEGIN("report_up", 0); + GPR_TIMER_BEGIN("report_up", 0); dest = &call->buffered_metadata[is_trailing]; if (dest->count == dest->capacity) { dest->capacity = GPR_MAX(dest->capacity + 8, dest->capacity * 2); @@ -1563,15 +1563,15 @@ static void recv_metadata(grpc_exec_ctx *exec_ctx, grpc_call *call, } call->owned_metadata[call->owned_metadata_count++] = mdel; l->md = NULL; - GRPC_TIMER_END("report_up", 0); + GPR_TIMER_END("report_up", 0); } } if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) != 0 && !call->is_client) { - GRPC_TIMER_BEGIN("set_deadline_alarm", 0); + GPR_TIMER_BEGIN("set_deadline_alarm", 0); set_deadline_alarm(exec_ctx, call, md->deadline); - GRPC_TIMER_END("set_deadline_alarm", 0); + GPR_TIMER_END("set_deadline_alarm", 0); } if (!is_trailing) { call->read_state = READ_STATE_GOT_INITIAL_METADATA; @@ -1634,7 +1634,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, grpc_call_error error; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GRPC_TIMER_BEGIN("grpc_call_start_batch", 0); + GPR_TIMER_BEGIN("grpc_call_start_batch", 0); GRPC_API_TRACE( "grpc_call_start_batch(call=%p, ops=%p, nops=%lu, tag=%p, reserved=%p)", @@ -1873,7 +1873,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, finish_func, tag); done: grpc_exec_ctx_finish(&exec_ctx); - GRPC_TIMER_END("grpc_call_start_batch", 0); + GPR_TIMER_END("grpc_call_start_batch", 0); return error; } diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c index 7c0183257c..bc32f55473 100644 --- a/src/core/surface/completion_queue.c +++ b/src/core/surface/completion_queue.c @@ -144,7 +144,7 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, int i; grpc_pollset_worker *pluck_worker; - GRPC_TIMER_BEGIN("grpc_cq_end_op", 0); + GPR_TIMER_BEGIN("grpc_cq_end_op", 0); storage->tag = tag; storage->done = done; @@ -178,7 +178,7 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc, grpc_pollset_shutdown(exec_ctx, &cc->pollset, &cc->pollset_destroy_done); } - GRPC_TIMER_END("grpc_cq_end_op", 0); + GPR_TIMER_END("grpc_cq_end_op", 0); } grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, @@ -189,7 +189,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, gpr_timespec now; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GRPC_TIMER_BEGIN("grpc_completion_queue_next", 0); + GPR_TIMER_BEGIN("grpc_completion_queue_next", 0); GRPC_API_TRACE( "grpc_completion_queue_next(" @@ -238,7 +238,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, GRPC_CQ_INTERNAL_UNREF(cc, "next"); grpc_exec_ctx_finish(&exec_ctx); - GRPC_TIMER_END("grpc_completion_queue_next", 0); + GPR_TIMER_END("grpc_completion_queue_next", 0); return ret; } @@ -278,7 +278,7 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, int first_loop = 1; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GRPC_TIMER_BEGIN("grpc_completion_queue_pluck", 0); + GPR_TIMER_BEGIN("grpc_completion_queue_pluck", 0); GRPC_API_TRACE( "grpc_completion_queue_pluck(" @@ -346,7 +346,7 @@ done: GRPC_CQ_INTERNAL_UNREF(cc, "pluck"); grpc_exec_ctx_finish(&exec_ctx); - GRPC_TIMER_END("grpc_completion_queue_pluck", 0); + GPR_TIMER_END("grpc_completion_queue_pluck", 0); return ret; } diff --git a/src/core/surface/init.c b/src/core/surface/init.c index 95011cab17..715c90a5e1 100644 --- a/src/core/surface/init.c +++ b/src/core/surface/init.c @@ -115,7 +115,7 @@ void grpc_init(void) { gpr_log(GPR_ERROR, "Could not initialize census."); } } - grpc_timers_global_init(); + gpr_timers_global_init(); for (i = 0; i < g_number_of_plugins; i++) { if (g_all_of_the_plugins[i].init != NULL) { g_all_of_the_plugins[i].init(); @@ -133,7 +133,7 @@ void grpc_shutdown(void) { if (--g_initializations == 0) { grpc_iomgr_shutdown(); census_shutdown(); - grpc_timers_global_destroy(); + gpr_timers_global_destroy(); grpc_tracer_shutdown(); grpc_resolver_registry_shutdown(); for (i = 0; i < g_number_of_plugins; i++) { diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c index e71d4fc87a..04e4803227 100644 --- a/src/core/transport/chttp2/parsing.c +++ b/src/core/transport/chttp2/parsing.c @@ -69,7 +69,7 @@ void grpc_chttp2_prepare_to_read( grpc_chttp2_stream_global *stream_global; grpc_chttp2_stream_parsing *stream_parsing; - GRPC_TIMER_BEGIN("grpc_chttp2_prepare_to_read", 0); + GPR_TIMER_BEGIN("grpc_chttp2_prepare_to_read", 0); transport_parsing->next_stream_id = transport_global->next_stream_id; @@ -93,7 +93,7 @@ void grpc_chttp2_prepare_to_read( } } - GRPC_TIMER_END("grpc_chttp2_prepare_to_read", 0); + GPR_TIMER_END("grpc_chttp2_prepare_to_read", 0); } void grpc_chttp2_publish_reads( diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c index 4abe00bb7c..69ad8854ba 100644 --- a/src/core/transport/chttp2/writing.c +++ b/src/core/transport/chttp2/writing.c @@ -181,7 +181,7 @@ void grpc_chttp2_perform_writes( static void finalize_outbuf(grpc_chttp2_transport_writing *transport_writing) { grpc_chttp2_stream_writing *stream_writing; - GRPC_TIMER_BEGIN("finalize_outbuf", 0); + GPR_TIMER_BEGIN("finalize_outbuf", 0); while ( grpc_chttp2_list_pop_writing_stream(transport_writing, &stream_writing)) { @@ -212,7 +212,7 @@ static void finalize_outbuf(grpc_chttp2_transport_writing *transport_writing) { grpc_chttp2_list_add_written_stream(transport_writing, stream_writing); } - GRPC_TIMER_END("finalize_outbuf", 0); + GPR_TIMER_END("finalize_outbuf", 0); } void grpc_chttp2_cleanup_writing( diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index d39816b011..effc3c4b3b 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -510,7 +510,7 @@ grpc_chttp2_stream_parsing *grpc_chttp2_parsing_accept_stream( static void lock(grpc_chttp2_transport *t) { gpr_mu_lock(&t->mu); } static void unlock(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { - GRPC_TIMER_BEGIN("unlock", 0); + GPR_TIMER_BEGIN("unlock", 0); unlock_check_read_write_state(exec_ctx, t); if (!t->writing_active && !t->closed && grpc_chttp2_unlocking_check_writes(&t->global, &t->writing)) { @@ -521,7 +521,7 @@ static void unlock(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { } gpr_mu_unlock(&t->mu); - GRPC_TIMER_END("unlock", 0); + GPR_TIMER_END("unlock", 0); } /* @@ -548,7 +548,7 @@ void grpc_chttp2_terminate_writing(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_writing *transport_writing = transport_writing_ptr; grpc_chttp2_transport *t = TRANSPORT_FROM_WRITING(transport_writing); - GRPC_TIMER_BEGIN("grpc_chttp2_terminate_writing", 0); + GPR_TIMER_BEGIN("grpc_chttp2_terminate_writing", 0); lock(t); @@ -572,15 +572,15 @@ void grpc_chttp2_terminate_writing(grpc_exec_ctx *exec_ctx, UNREF_TRANSPORT(exec_ctx, t, "writing"); - GRPC_TIMER_END("grpc_chttp2_terminate_writing", 0); + GPR_TIMER_END("grpc_chttp2_terminate_writing", 0); } static void writing_action(grpc_exec_ctx *exec_ctx, void *gt, int iomgr_success_ignored) { grpc_chttp2_transport *t = gt; - GRPC_TIMER_BEGIN("writing_action", 0); + GPR_TIMER_BEGIN("writing_action", 0); grpc_chttp2_perform_writes(exec_ctx, &t->writing, t->ep); - GRPC_TIMER_END("writing_action", 0); + GPR_TIMER_END("writing_action", 0); } void grpc_chttp2_add_incoming_goaway( @@ -650,7 +650,7 @@ static void maybe_start_some_streams( static void perform_stream_op_locked( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, grpc_chttp2_stream_global *stream_global, grpc_transport_stream_op *op) { - GRPC_TIMER_BEGIN("perform_stream_op_locked", 0); + GPR_TIMER_BEGIN("perform_stream_op_locked", 0); if (op->cancel_with_status != GRPC_STATUS_OK) { cancel_from_api(transport_global, stream_global, op->cancel_with_status); } @@ -722,7 +722,7 @@ static void perform_stream_op_locked( } grpc_exec_ctx_enqueue(exec_ctx, op->on_consumed, 1); - GRPC_TIMER_END("perform_stream_op_locked", 0); + GPR_TIMER_END("perform_stream_op_locked", 0); } static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, @@ -1113,7 +1113,7 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, int success) { int keep_reading = 0; grpc_chttp2_transport *t = tp; - GRPC_TIMER_BEGIN("recv_data", 0); + GPR_TIMER_BEGIN("recv_data", 0); lock(t); i = 0; @@ -1125,13 +1125,13 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, int success) { &t->parsing_stream_map); grpc_chttp2_prepare_to_read(&t->global, &t->parsing); gpr_mu_unlock(&t->mu); - GRPC_TIMER_BEGIN("recv_data.parse", 0); + GPR_TIMER_BEGIN("recv_data.parse", 0); for (; i < t->read_buffer.count && grpc_chttp2_perform_read(exec_ctx, &t->parsing, t->read_buffer.slices[i]); i++) ; - GRPC_TIMER_END("recv_data.parse", 0); + GPR_TIMER_END("recv_data.parse", 0); gpr_mu_lock(&t->mu); if (i != t->read_buffer.count) { drop_connection(exec_ctx, t); @@ -1169,7 +1169,7 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, int success) { UNREF_TRANSPORT(exec_ctx, t, "recv_data"); } - GRPC_TIMER_END("recv_data", 0); + GPR_TIMER_END("recv_data", 0); } /* diff --git a/src/core/transport/stream_op.c b/src/core/transport/stream_op.c index 5c3c90b054..6493e77bc5 100644 --- a/src/core/transport/stream_op.c +++ b/src/core/transport/stream_op.c @@ -302,7 +302,7 @@ void grpc_metadata_batch_filter(grpc_metadata_batch *batch, grpc_linked_mdelem *l; grpc_linked_mdelem *next; - GRPC_TIMER_BEGIN("grpc_metadata_batch_filter", 0); + GPR_TIMER_BEGIN("grpc_metadata_batch_filter", 0); assert_valid_list(&batch->list); assert_valid_list(&batch->garbage); @@ -333,5 +333,5 @@ void grpc_metadata_batch_filter(grpc_metadata_batch *batch, assert_valid_list(&batch->list); assert_valid_list(&batch->garbage); - GRPC_TIMER_END("grpc_metadata_batch_filter", 0); + GPR_TIMER_END("grpc_metadata_batch_filter", 0); } diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index a7b6fd241b..b1330fde7f 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -160,7 +160,7 @@ namespace grpc { Status SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) { - GRPC_TIMER_SCOPE("SerializeProto", 0); + GPR_TIMER_SCOPE("SerializeProto", 0); int byte_size = msg.ByteSize(); if (byte_size <= kMaxBufferLength) { gpr_slice slice = gpr_slice_malloc(byte_size); @@ -179,7 +179,7 @@ Status SerializeProto(const grpc::protobuf::Message& msg, Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, int max_message_size) { - GRPC_TIMER_SCOPE("DeserializeProto", 0); + GPR_TIMER_SCOPE("DeserializeProto", 0); if (!buffer) { return Status(StatusCode::INTERNAL, "No payload"); } diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 2cd1905a97..aacc5c7387 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -541,7 +541,7 @@ void Server::ScheduleCallback() { void Server::RunRpc() { // Wait for one more incoming rpc. bool ok; - GRPC_TIMER_SCOPE("Server::RunRpc", 0); + GPR_TIMER_SCOPE("Server::RunRpc", 0); auto* mrd = SyncRequest::Wait(&cq_, &ok); if (mrd) { ScheduleCallback(); @@ -557,7 +557,7 @@ void Server::RunRpc() { mrd->TeardownRequest(); } } - GRPC_TIMER_SCOPE("cd.Run()", 0); + GPR_TIMER_SCOPE("cd.Run()", 0); cd.Run(); } } diff --git a/test/core/profiling/timers_test.c b/test/core/profiling/timers_test.c index b79cde64bd..7070fe465f 100644 --- a/test/core/profiling/timers_test.c +++ b/test/core/profiling/timers_test.c @@ -54,15 +54,15 @@ void test_log_events(size_t num_seqs) { for (j = 0; j < advance; j++) { switch (state[i]) { case 0: - GRPC_TIMER_MARK(STATE_0, i); + GPR_TIMER_MARK(STATE_0, i); state[i]++; break; case 1: - GRPC_TIMER_MARK(STATE_1, i); + GPR_TIMER_MARK(STATE_1, i); state[i]++; break; case 2: - GRPC_TIMER_MARK(STATE_2, i); + GPR_TIMER_MARK(STATE_2, i); state[i]++; break; case 3: @@ -76,8 +76,8 @@ void test_log_events(size_t num_seqs) { int main(int argc, char **argv) { grpc_test_init(argc, argv); - grpc_timers_global_init(); + gpr_timers_global_init(); test_log_events(1000000); - grpc_timers_global_destroy(); + gpr_timers_global_destroy(); return 0; } diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 6adf92a005..3c33a1c5de 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -101,7 +101,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { WaitToIssue(thread_idx); auto* stub = channels_[thread_idx % channels_.size()].get_stub(); double start = Timer::Now(); - GRPC_TIMER_SCOPE("SynchronousUnaryClient::ThreadFunc", 0); + GPR_TIMER_SCOPE("SynchronousUnaryClient::ThreadFunc", 0); grpc::ClientContext context; grpc::Status s = stub->UnaryCall(&context, request_, &responses_[thread_idx]); @@ -138,7 +138,7 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { WaitToIssue(thread_idx); - GRPC_TIMER_SCOPE("SynchronousStreamingClient::ThreadFunc", 0); + GPR_TIMER_SCOPE("SynchronousStreamingClient::ThreadFunc", 0); double start = Timer::Now(); if (stream_[thread_idx]->Write(request_) && stream_[thread_idx]->Read(&responses_[thread_idx])) { diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 98d56f21ee..e742ec2571 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -852,7 +852,6 @@ src/core/json/json.h \ src/core/json/json_common.h \ src/core/json/json_reader.h \ src/core/json/json_writer.h \ -src/core/profiling/timers.h \ src/core/statistics/census_interface.h \ src/core/statistics/census_rpc_stats.h \ src/core/surface/api_trace.h \ @@ -990,8 +989,6 @@ src/core/json/json.c \ src/core/json/json_reader.c \ src/core/json/json_string.c \ src/core/json/json_writer.c \ -src/core/profiling/basic_timers.c \ -src/core/profiling/stap_timers.c \ src/core/surface/api_trace.c \ src/core/surface/byte_buffer.c \ src/core/surface/byte_buffer_queue.c \ @@ -1068,6 +1065,7 @@ include/grpc/support/tls_gcc.h \ include/grpc/support/tls_msvc.h \ include/grpc/support/tls_pthread.h \ include/grpc/support/useful.h \ +src/core/profiling/timers.h \ src/core/support/block_annotate.h \ src/core/support/env.h \ src/core/support/file.h \ @@ -1077,6 +1075,8 @@ src/core/support/string.h \ src/core/support/string_win32.h \ src/core/support/thd_internal.h \ src/core/support/time_precise.h \ +src/core/profiling/basic_timers.c \ +src/core/profiling/stap_timers.c \ src/core/support/alloc.c \ src/core/support/cmdline.c \ src/core/support/cpu_iphone.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index f2237e0fef..c16477ccf8 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -12161,6 +12161,7 @@ "include/grpc/support/tls_msvc.h", "include/grpc/support/tls_pthread.h", "include/grpc/support/useful.h", + "src/core/profiling/timers.h", "src/core/support/block_annotate.h", "src/core/support/env.h", "src/core/support/file.h", @@ -12201,6 +12202,9 @@ "include/grpc/support/tls_msvc.h", "include/grpc/support/tls_pthread.h", "include/grpc/support/useful.h", + "src/core/profiling/basic_timers.c", + "src/core/profiling/stap_timers.c", + "src/core/profiling/timers.h", "src/core/support/alloc.c", "src/core/support/block_annotate.h", "src/core/support/cmdline.c", @@ -12351,7 +12355,6 @@ "src/core/json/json_common.h", "src/core/json/json_reader.h", "src/core/json/json_writer.h", - "src/core/profiling/timers.h", "src/core/security/auth_filters.h", "src/core/security/base64.h", "src/core/security/credentials.h", @@ -12569,9 +12572,6 @@ "src/core/json/json_string.c", "src/core/json/json_writer.c", "src/core/json/json_writer.h", - "src/core/profiling/basic_timers.c", - "src/core/profiling/stap_timers.c", - "src/core/profiling/timers.h", "src/core/security/auth_filters.h", "src/core/security/base64.c", "src/core/security/base64.h", @@ -12856,7 +12856,6 @@ "src/core/json/json_common.h", "src/core/json/json_reader.h", "src/core/json/json_writer.h", - "src/core/profiling/timers.h", "src/core/statistics/census_interface.h", "src/core/statistics/census_rpc_stats.h", "src/core/surface/api_trace.h", @@ -13059,9 +13058,6 @@ "src/core/json/json_string.c", "src/core/json/json_writer.c", "src/core/json/json_writer.h", - "src/core/profiling/basic_timers.c", - "src/core/profiling/stap_timers.c", - "src/core/profiling/timers.h", "src/core/statistics/census_interface.h", "src/core/statistics/census_rpc_stats.h", "src/core/surface/api_trace.c", diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj b/vsprojects/vcxproj/gpr/gpr.vcxproj index 4c3b36abdc..fa495db07b 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj @@ -163,6 +163,7 @@ + @@ -174,6 +175,10 @@ + + + + diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters index 69391b4f99..ee03e45453 100644 --- a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters +++ b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters @@ -1,6 +1,12 @@ + + src\core\profiling + + + src\core\profiling + src\core\support @@ -200,6 +206,9 @@ + + src\core\profiling + src\core\support @@ -245,6 +254,9 @@ {c5e1baa7-de77-beb1-9675-942261648f79} + + {93b7086c-8c8a-6bbf-fb14-1f166bf0146a} + {bb116f2a-ea2a-c233-82da-0c54e3cbfec1} diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 183edbc05b..28e38f65be 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -338,7 +338,6 @@ - @@ -575,10 +574,6 @@ - - - - diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 66ce9ca05b..7ae7eca522 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -292,12 +292,6 @@ src\core\json - - src\core\profiling - - - src\core\profiling - src\core\surface @@ -725,9 +719,6 @@ src\core\json - - src\core\profiling - src\core\statistics @@ -896,9 +887,6 @@ {e665cc0e-b994-d7c5-cc18-2007392019f0} - - {87674b72-0f05-0469-481a-bd8c7af9ad80} - {1d850ac6-e639-4eab-5338-4ba40272fcc9} diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index b527179f9f..3fde42b90a 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -317,7 +317,6 @@ - @@ -514,10 +513,6 @@ - - - - diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 7be3c9ec93..6e9b169669 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -232,12 +232,6 @@ src\core\json - - src\core\profiling - - - src\core\profiling - src\core\surface @@ -623,9 +617,6 @@ src\core\json - - src\core\profiling - src\core\statistics @@ -794,9 +785,6 @@ {443ffc61-1bea-2477-6e54-1ddf8c139264} - - {7f91d9bf-c9de-835a-d74d-b16f843b89a9} - {e084164c-a069-00e3-db35-4e0b1cd6f0b7} -- cgit v1.2.3