diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-11-28 19:02:23 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-11-28 19:02:23 -0800 |
commit | 7cd7ecc941e921e02a280cb358001076d4469610 (patch) | |
tree | b232449c40eacabbaf5ac433bca9edc5ef320442 /src/core/lib | |
parent | 6697496a1dca9012375c8a00ac6acedaa42449d9 (diff) |
Add the length of the buffer that is traced
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/iomgr/buffer_list.cc | 3 | ||||
-rw-r--r-- | src/core/lib/iomgr/buffer_list.h | 6 | ||||
-rw-r--r-- | src/core/lib/iomgr/tcp_posix.cc | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/core/lib/iomgr/buffer_list.cc b/src/core/lib/iomgr/buffer_list.cc index e20dab15b1..b9e38f7dd2 100644 --- a/src/core/lib/iomgr/buffer_list.cc +++ b/src/core/lib/iomgr/buffer_list.cc @@ -30,9 +30,10 @@ namespace grpc_core { void TracedBuffer::AddNewEntry(TracedBuffer** head, uint32_t seq_no, - void* arg) { + uint32_t length, void* arg) { GPR_DEBUG_ASSERT(head != nullptr); TracedBuffer* new_elem = New<TracedBuffer>(seq_no, arg); + new_elem->ts_.length = length; /* Store the current time as the sendmsg time. */ new_elem->ts_.sendmsg_time = gpr_now(GPR_CLOCK_REALTIME); if (*head == nullptr) { diff --git a/src/core/lib/iomgr/buffer_list.h b/src/core/lib/iomgr/buffer_list.h index 87d74f9ce2..9e2c1dcb24 100644 --- a/src/core/lib/iomgr/buffer_list.h +++ b/src/core/lib/iomgr/buffer_list.h @@ -37,6 +37,8 @@ struct Timestamps { gpr_timespec scheduled_time; gpr_timespec sent_time; gpr_timespec acked_time; + + uint32_t length; /* The length of the buffer traced */ }; /** TracedBuffer is a class to keep track of timestamps for a specific buffer in @@ -56,7 +58,7 @@ class TracedBuffer { /** Add a new entry in the TracedBuffer list pointed to by head. Also saves * sendmsg_time with the current timestamp. */ static void AddNewEntry(grpc_core::TracedBuffer** head, uint32_t seq_no, - void* arg); + uint32_t length, void* arg); /** Processes a received timestamp based on sock_extended_err and * scm_timestamping structures. It will invoke the timestamps callback if the @@ -73,7 +75,7 @@ class TracedBuffer { private: GPRC_ALLOW_CLASS_TO_USE_NON_PUBLIC_NEW - TracedBuffer(int seq_no, void* arg) + TracedBuffer(uint32_t seq_no, void* arg) : seq_no_(seq_no), arg_(arg), next_(nullptr) {} uint32_t seq_no_; /* The sequence number for the last byte in the buffer */ diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 606bfce6e7..8f3403473e 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -634,8 +634,8 @@ static bool tcp_write_with_timestamps(grpc_tcp* tcp, struct msghdr* msg, if (sending_length == static_cast<size_t>(length)) { gpr_mu_lock(&tcp->tb_mu); grpc_core::TracedBuffer::AddNewEntry( - &tcp->tb_head, static_cast<int>(tcp->bytes_counter + length), - tcp->outgoing_buffer_arg); + &tcp->tb_head, static_cast<uint32_t>(tcp->bytes_counter + length), + static_cast<uint32_t>(length), tcp->outgoing_buffer_arg); gpr_mu_unlock(&tcp->tb_mu); tcp->outgoing_buffer_arg = nullptr; } |