Merge pull request #2204 from nicolasnoble/completion-queue-refcount-debugging

Adding file and line number to cq debug refcount.
pull/2232/head
Craig Tiller 10 years ago
commit 213ac59069
  1. 16
      src/core/surface/completion_queue.c
  2. 12
      src/core/surface/completion_queue.h

@ -88,9 +88,11 @@ grpc_completion_queue *grpc_completion_queue_create(void) {
}
#ifdef GRPC_CQ_REF_COUNT_DEBUG
void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason) {
gpr_log(GPR_DEBUG, "CQ:%p ref %d -> %d %s", cc, (int)cc->owning_refs.count,
(int)cc->owning_refs.count + 1, reason);
void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason,
const char *file, int line) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p ref %d -> %d %s",
cc, (int)cc->owning_refs.count, (int)cc->owning_refs.count + 1,
reason);
#else
void grpc_cq_internal_ref(grpc_completion_queue *cc) {
#endif
@ -103,9 +105,11 @@ static void on_pollset_destroy_done(void *arg) {
}
#ifdef GRPC_CQ_REF_COUNT_DEBUG
void grpc_cq_internal_unref(grpc_completion_queue *cc, const char *reason) {
gpr_log(GPR_DEBUG, "CQ:%p unref %d -> %d %s", cc, (int)cc->owning_refs.count,
(int)cc->owning_refs.count - 1, reason);
void grpc_cq_internal_unref(grpc_completion_queue *cc, const char *reason,
const char *file, int line) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p unref %d -> %d %s",
cc, (int)cc->owning_refs.count, (int)cc->owning_refs.count - 1,
reason);
#else
void grpc_cq_internal_unref(grpc_completion_queue *cc) {
#endif

@ -40,10 +40,14 @@
#include <grpc/grpc.h>
#ifdef GRPC_CQ_REF_COUNT_DEBUG
void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason);
void grpc_cq_internal_unref(grpc_completion_queue *cc, const char *reason);
#define GRPC_CQ_INTERNAL_REF(cc, reason) grpc_cq_internal_ref(cc, reason)
#define GRPC_CQ_INTERNAL_UNREF(cc, reason) grpc_cq_internal_unref(cc, reason)
void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason,
const char *file, int line);
void grpc_cq_internal_unref(grpc_completion_queue *cc, const char *reason,
const char *file, int line);
#define GRPC_CQ_INTERNAL_REF(cc, reason) \
grpc_cq_internal_ref(cc, reason, __FILE__, __LINE__)
#define GRPC_CQ_INTERNAL_UNREF(cc, reason) \
grpc_cq_internal_unref(cc, reason, __FILE__, __LINE__)
#else
void grpc_cq_internal_ref(grpc_completion_queue *cc);
void grpc_cq_internal_unref(grpc_completion_queue *cc);

Loading…
Cancel
Save