aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/client/channel.cc
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-04-24 00:12:30 +0200
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-04-24 00:38:19 +0200
commit23be2803662c19f73a66c82c9d5dbd62b537515f (patch)
tree9d8afeb18c21cddcbfb9bb014f08f1474021db98 /src/cpp/client/channel.cc
parentb7c2035e83a9b3e346f1fd37f9ad55c2070fb02e (diff)
parent3afd92ff511f52db3ecf892d9af65053323c89cb (diff)
Merge branch 'master' of github.com:grpc/grpc into the-purge-2
Conflicts: src/cpp/client/channel.cc vsprojects/vs2010/grpc++.vcxproj vsprojects/vs2013/grpc++.vcxproj.filters
Diffstat (limited to 'src/cpp/client/channel.cc')
-rw-r--r--src/cpp/client/channel.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index aaad042026..ba8882278f 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -40,6 +40,7 @@
#include <grpc/support/log.h>
#include <grpc/support/slice.h>
+#include "src/core/profiling/timers.h"
#include "src/cpp/proto/proto_utils.h"
#include <grpc++/channel_arguments.h>
#include <grpc++/client_context.h>
@@ -59,11 +60,17 @@ Channel::~Channel() { grpc_channel_destroy(c_channel_); }
Call Channel::CreateCall(const RpcMethod& method, ClientContext* context,
CompletionQueue* cq) {
- auto c_call = grpc_channel_create_call(c_channel_, cq->cq(), method.name(),
- context->authority().empty()
- ? target_.c_str()
- : context->authority().c_str(),
- context->raw_deadline());
+ auto c_call =
+ method.channel_tag()
+ ? grpc_channel_create_registered_call(c_channel_, cq->cq(),
+ method.channel_tag(),
+ context->raw_deadline())
+ : grpc_channel_create_call(c_channel_, cq->cq(), method.name(),
+ context->authority().empty()
+ ? target_.c_str()
+ : context->authority().c_str(),
+ context->raw_deadline());
+ GRPC_TIMER_MARK(CALL_CREATED, c_call);
context->set_call(c_call);
return Call(c_call, this, cq);
}
@@ -72,9 +79,15 @@ void Channel::PerformOpsOnCall(CallOpBuffer* buf, Call* call) {
static const size_t MAX_OPS = 8;
size_t nops = MAX_OPS;
grpc_op ops[MAX_OPS];
+ GRPC_TIMER_MARK(PERFORM_OPS_BEGIN, call->call());
buf->FillOps(ops, &nops);
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call->call(), ops, nops, buf));
+ GRPC_TIMER_MARK(PERFORM_OPS_END, call->call());
+}
+
+void* Channel::RegisterMethod(const char* method) {
+ return grpc_channel_register_call(c_channel_, method, target_.c_str());
}
} // namespace grpc