瀏覽代碼

Add some helpful timing markers

Craig Tiller 10 年之前
父節點
當前提交
5096849579
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 3 0
      src/core/surface/call.c
  2. 7 0
      src/core/transport/chttp2_transport.c

+ 3 - 0
src/core/surface/call.c

@@ -34,6 +34,7 @@
 #include "src/core/surface/call.h"
 #include "src/core/surface/call.h"
 #include "src/core/channel/channel_stack.h"
 #include "src/core/channel/channel_stack.h"
 #include "src/core/iomgr/alarm.h"
 #include "src/core/iomgr/alarm.h"
+#include "src/core/profiling/timers.h"
 #include "src/core/support/string.h"
 #include "src/core/support/string.h"
 #include "src/core/surface/byte_buffer_queue.h"
 #include "src/core/surface/byte_buffer_queue.h"
 #include "src/core/surface/channel.h"
 #include "src/core/surface/channel.h"
@@ -701,6 +702,7 @@ static int add_slice_to_message(grpc_call *call, gpr_slice slice) {
 static void call_on_done_recv(void *pc, int success) {
 static void call_on_done_recv(void *pc, int success) {
   grpc_call *call = pc;
   grpc_call *call = pc;
   size_t i;
   size_t i;
+  GRPC_TIMER_MARK(CALL_ON_DONE_RECV_BEGIN, 0);
   lock(call);
   lock(call);
   call->receiving = 0;
   call->receiving = 0;
   if (success) {
   if (success) {
@@ -741,6 +743,7 @@ static void call_on_done_recv(void *pc, int success) {
   unlock(call);
   unlock(call);
 
 
   GRPC_CALL_INTERNAL_UNREF(call, "receiving", 0);
   GRPC_CALL_INTERNAL_UNREF(call, "receiving", 0);
+  GRPC_TIMER_MARK(CALL_ON_DONE_RECV_END, 0);
 }
 }
 
 
 static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count,
 static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count,

+ 7 - 0
src/core/transport/chttp2_transport.c

@@ -37,6 +37,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 
 
+#include "src/core/profiling/timers.h"
 #include "src/core/support/string.h"
 #include "src/core/support/string.h"
 #include "src/core/transport/chttp2/frame_data.h"
 #include "src/core/transport/chttp2/frame_data.h"
 #include "src/core/transport/chttp2/frame_goaway.h"
 #include "src/core/transport/chttp2/frame_goaway.h"
@@ -783,6 +784,8 @@ static void unlock(transport *t) {
   grpc_stream_op_buffer nuke_now;
   grpc_stream_op_buffer nuke_now;
   const grpc_transport_callbacks *cb = t->cb;
   const grpc_transport_callbacks *cb = t->cb;
 
 
+  GRPC_TIMER_MARK(HTTP2_UNLOCK_BEGIN, 0);
+
   grpc_sopb_init(&nuke_now);
   grpc_sopb_init(&nuke_now);
   if (t->nuke_later_sopb.nops) {
   if (t->nuke_later_sopb.nops) {
     grpc_sopb_swap(&nuke_now, &t->nuke_later_sopb);
     grpc_sopb_swap(&nuke_now, &t->nuke_later_sopb);
@@ -831,6 +834,8 @@ static void unlock(transport *t) {
   /* finally unlock */
   /* finally unlock */
   gpr_mu_unlock(&t->mu);
   gpr_mu_unlock(&t->mu);
 
 
+  GRPC_TIMER_MARK(HTTP2_UNLOCK_CLEANUP, 0);
+
   /* perform some callbacks if necessary */
   /* perform some callbacks if necessary */
   for (i = 0; i < num_goaways; i++) {
   for (i = 0; i < num_goaways; i++) {
     cb->goaway(t->cb_user_data, &t->base, goaways[i].status, goaways[i].debug);
     cb->goaway(t->cb_user_data, &t->base, goaways[i].status, goaways[i].debug);
@@ -861,6 +866,8 @@ static void unlock(transport *t) {
   grpc_sopb_destroy(&nuke_now);
   grpc_sopb_destroy(&nuke_now);
 
 
   gpr_free(goaways);
   gpr_free(goaways);
+
+  GRPC_TIMER_MARK(HTTP2_UNLOCK_END, 0);
 }
 }
 
 
 /*
 /*