|
|
|
@ -38,38 +38,41 @@ namespace grpc_core { |
|
|
|
|
// sent over the wire. A data chunk being written over the wire is multiplexed
|
|
|
|
|
// with bytes from multiple RPCs. If one such RPC is traced, we store the
|
|
|
|
|
// following information about the traced RPC:
|
|
|
|
|
// - byte_offset_in_stream: Number of bytes belonging to that traced RPC which
|
|
|
|
|
// have been sent so far from the start of the RPC stream.
|
|
|
|
|
// - relative_start_pos_in_chunk: Starting offset of the traced RPC within
|
|
|
|
|
// the current chunk that is being sent.
|
|
|
|
|
// - num_traced_bytes_in_chunk: Number of bytes belonging to the traced RPC
|
|
|
|
|
// within the current chunk.
|
|
|
|
|
class ContextListEntry { |
|
|
|
|
public: |
|
|
|
|
ContextListEntry(void* context, int64_t relative_start_pos, |
|
|
|
|
ContextListEntry(void* context, int64_t outbuf_offset, |
|
|
|
|
int64_t num_traced_bytes, size_t byte_offset, |
|
|
|
|
size_t stream_index, |
|
|
|
|
std::shared_ptr<TcpTracerInterface> tcp_tracer) |
|
|
|
|
: trace_context_(context), |
|
|
|
|
relative_start_pos_in_chunk_(relative_start_pos), |
|
|
|
|
outbuf_offset_(outbuf_offset), |
|
|
|
|
num_traced_bytes_in_chunk_(num_traced_bytes), |
|
|
|
|
byte_offset_in_stream_(byte_offset), |
|
|
|
|
stream_index_(stream_index), |
|
|
|
|
tcp_tracer_(std::move(tcp_tracer)) {} |
|
|
|
|
|
|
|
|
|
ContextListEntry() = delete; |
|
|
|
|
|
|
|
|
|
void* TraceContext() { return trace_context_; } |
|
|
|
|
int64_t RelativeStartPosInChunk() { return relative_start_pos_in_chunk_; } |
|
|
|
|
int64_t OutbufOffset() { return outbuf_offset_; } |
|
|
|
|
int64_t NumTracedBytesInChunk() { return num_traced_bytes_in_chunk_; } |
|
|
|
|
size_t ByteOffsetInStream() { return byte_offset_in_stream_; } |
|
|
|
|
size_t StreamIndex() { return stream_index_; } |
|
|
|
|
std::shared_ptr<TcpTracerInterface> ReleaseTcpTracer() { |
|
|
|
|
return std::move(tcp_tracer_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
void* trace_context_; |
|
|
|
|
int64_t relative_start_pos_in_chunk_; |
|
|
|
|
// Offset of the head of the current chunk in the output buffer.
|
|
|
|
|
int64_t outbuf_offset_; |
|
|
|
|
// Number of bytes traced in the current chunk.
|
|
|
|
|
int64_t num_traced_bytes_in_chunk_; |
|
|
|
|
// Offset of the head of the current chunk in the RPC stream.
|
|
|
|
|
size_t byte_offset_in_stream_; |
|
|
|
|
// Index of the current chunk in the RPC stream.
|
|
|
|
|
// Set to zero for the first chunk of the RPC stream.
|
|
|
|
|
size_t stream_index_; |
|
|
|
|
std::shared_ptr<TcpTracerInterface> tcp_tracer_; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|