Allow disabling traces, add trace variables for pluck and timeout events

pull/6920/head
murgatroid99 9 years ago
parent fa9b7c1bc6
commit 9f6a805977
  1. 4
      BUILD
  2. 1
      build.yaml
  3. 2
      gRPC.podspec
  4. 1
      grpc.gemspec
  5. 1
      package.xml
  6. 8
      src/core/lib/debug/trace.c
  7. 1
      src/core/lib/surface/call.h
  8. 29
      src/core/lib/surface/completion_queue.c
  9. 3
      src/core/lib/surface/completion_queue.h
  10. 7
      src/core/lib/surface/init.c
  11. 48
      src/core/lib/surface/surface_trace.h
  12. 1
      tools/doxygen/Doxyfile.core.internal
  13. 2
      tools/run_tests/sources_and_headers.json
  14. 1
      vsprojects/vcxproj/grpc/grpc.vcxproj
  15. 3
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  16. 1
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  17. 3
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters

@ -228,7 +228,6 @@ cc_library(
"src/core/lib/surface/init.h",
"src/core/lib/surface/lame_client.h",
"src/core/lib/surface/server.h",
"src/core/lib/surface/surface_trace.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/metadata.h",
@ -606,7 +605,6 @@ cc_library(
"src/core/lib/surface/init.h",
"src/core/lib/surface/lame_client.h",
"src/core/lib/surface/server.h",
"src/core/lib/surface/surface_trace.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/metadata.h",
@ -949,7 +947,6 @@ cc_library(
"src/core/lib/surface/init.h",
"src/core/lib/surface/lame_client.h",
"src/core/lib/surface/server.h",
"src/core/lib/surface/surface_trace.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/metadata.h",
@ -2061,7 +2058,6 @@ objc_library(
"src/core/lib/surface/init.h",
"src/core/lib/surface/lame_client.h",
"src/core/lib/surface/server.h",
"src/core/lib/surface/surface_trace.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/metadata.h",

@ -224,7 +224,6 @@ filegroups:
- src/core/lib/surface/init.h
- src/core/lib/surface/lame_client.h
- src/core/lib/surface/server.h
- src/core/lib/surface/surface_trace.h
- src/core/lib/transport/byte_stream.h
- src/core/lib/transport/connectivity_state.h
- src/core/lib/transport/metadata.h

@ -231,7 +231,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/init.h',
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/surface_trace.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/metadata.h',
@ -606,7 +605,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/init.h',
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/surface_trace.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/metadata.h',

@ -240,7 +240,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/init.h )
s.files += %w( src/core/lib/surface/lame_client.h )
s.files += %w( src/core/lib/surface/server.h )
s.files += %w( src/core/lib/surface/surface_trace.h )
s.files += %w( src/core/lib/transport/byte_stream.h )
s.files += %w( src/core/lib/transport/connectivity_state.h )
s.files += %w( src/core/lib/transport/metadata.h )

@ -247,7 +247,6 @@
<file baseinstalldir="/" name="src/core/lib/surface/init.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/lame_client.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/server.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/surface_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/byte_stream.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata.h" role="src" />

@ -88,7 +88,11 @@ static void parse(const char *s) {
split(s, &strings, &nstrings);
for (i = 0; i < nstrings; i++) {
grpc_tracer_set_enabled(strings[i], 1);
if (strings[i][0] == '-') {
grpc_tracer_set_enabled(strings[i] + 1, 0);
} else {
grpc_tracer_set_enabled(strings[i], 1);
}
}
for (i = 0; i < nstrings; i++) {
@ -117,7 +121,7 @@ int grpc_tracer_set_enabled(const char *name, int enabled) {
tracer *t;
if (0 == strcmp(name, "all")) {
for (t = tracers; t; t = t->next) {
*t->flag = 1;
*t->flag = enabled;
}
} else {
int found = 0;

@ -37,7 +37,6 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/surface_trace.h"
#include <grpc/grpc.h>
#include <grpc/impl/codegen/compression_types.h>

@ -48,7 +48,6 @@
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/event_string.h"
#include "src/core/lib/surface/surface_trace.h"
typedef struct {
grpc_pollset_worker **worker;
@ -91,6 +90,18 @@ struct grpc_completion_queue {
static gpr_mu g_freelist_mu;
static grpc_completion_queue *g_freelist;
int grpc_cq_pluck_trace;
int grpc_cq_event_timeout_trace;
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (grpc_api_trace && \
(grpc_cq_pluck_trace || (event)->type != GRPC_QUEUE_TIMEOUT)) { \
char *_ev = grpc_event_string(event); \
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
gpr_free(_ev); \
}
static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *cc,
bool success);
@ -396,13 +407,15 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
GPR_TIMER_BEGIN("grpc_completion_queue_pluck", 0);
GRPC_API_TRACE(
"grpc_completion_queue_pluck("
"cc=%p, tag=%p, "
"deadline=gpr_timespec { tv_sec: %lld, tv_nsec: %d, clock_type: %d }, "
"reserved=%p)",
6, (cc, tag, (long long)deadline.tv_sec, (int)deadline.tv_nsec,
(int)deadline.clock_type, reserved));
if (grpc_cq_pluck_trace) {
GRPC_API_TRACE(
"grpc_completion_queue_pluck("
"cc=%p, tag=%p, "
"deadline=gpr_timespec { tv_sec: %lld, tv_nsec: %d, clock_type: %d }, "
"reserved=%p)",
6, (cc, tag, (long long)deadline.tv_sec, (int)deadline.tv_nsec,
(int)deadline.clock_type, reserved));
}
GPR_ASSERT(!reserved);
deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);

@ -39,6 +39,9 @@
#include <grpc/grpc.h>
#include "src/core/lib/iomgr/pollset.h"
extern int grpc_cq_pluck_trace;
extern int grpc_cq_event_timeout_trace;
typedef struct grpc_cq_completion {
/** user supplied tag */
void *tag;

@ -57,7 +57,6 @@
#include "src/core/lib/surface/init.h"
#include "src/core/lib/surface/lame_client.h"
#include "src/core/lib/surface/server.h"
#include "src/core/lib/surface/surface_trace.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/transport_impl.h"
@ -165,6 +164,12 @@ void grpc_init(void) {
&grpc_trace_channel_stack_builder);
grpc_register_tracer("http1", &grpc_http1_trace);
grpc_register_tracer("compression", &grpc_compression_trace);
grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace);
// Default pluck trace to 1
grpc_cq_pluck_trace = 1;
grpc_register_tracer("queue_timeout", &grpc_cq_event_timeout_trace);
// Default timeout trace to 1
grpc_cq_event_timeout_trace = 1;
grpc_security_pre_init();
grpc_iomgr_init();
grpc_executor_init();

@ -1,48 +0,0 @@
/*
*
* 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_CORE_LIB_SURFACE_SURFACE_TRACE_H
#define GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H
#include <grpc/support/log.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/surface/api_trace.h"
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (grpc_api_trace) { \
char *_ev = grpc_event_string(event); \
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
gpr_free(_ev); \
}
#endif /* GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H */

@ -857,7 +857,6 @@ src/core/lib/surface/event_string.h \
src/core/lib/surface/init.h \
src/core/lib/surface/lame_client.h \
src/core/lib/surface/server.h \
src/core/lib/surface/surface_trace.h \
src/core/lib/transport/byte_stream.h \
src/core/lib/transport/connectivity_state.h \
src/core/lib/transport/metadata.h \

@ -5762,7 +5762,6 @@
"src/core/lib/surface/init.h",
"src/core/lib/surface/lame_client.h",
"src/core/lib/surface/server.h",
"src/core/lib/surface/surface_trace.h",
"src/core/lib/transport/byte_stream.h",
"src/core/lib/transport/connectivity_state.h",
"src/core/lib/transport/metadata.h",
@ -5921,7 +5920,6 @@
"src/core/lib/surface/metadata_array.c",
"src/core/lib/surface/server.c",
"src/core/lib/surface/server.h",
"src/core/lib/surface/surface_trace.h",
"src/core/lib/surface/validate_metadata.c",
"src/core/lib/surface/version.c",
"src/core/lib/transport/byte_stream.c",

@ -366,7 +366,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\init.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\server.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\surface_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\byte_stream.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h" />

@ -839,9 +839,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\server.h">
<Filter>src\core\lib\surface</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\surface_trace.h">
<Filter>src\core\lib\surface</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\byte_stream.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>

@ -355,7 +355,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\init.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\lame_client.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\server.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\surface_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\byte_stream.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\connectivity_state.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\metadata.h" />

@ -749,9 +749,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\server.h">
<Filter>src\core\lib\surface</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\surface_trace.h">
<Filter>src\core\lib\surface</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\transport\byte_stream.h">
<Filter>src\core\lib\transport</Filter>
</ClInclude>

Loading…
Cancel
Save