• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FINAL_INFO_H
16 #define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FINAL_INFO_H
17 
18 #include <grpc/status.h>
19 #include <grpc/support/port_platform.h>
20 #include <grpc/support/time.h>
21 
22 #include <cstdint>
23 
24 struct grpc_transport_one_way_stats {
25   uint64_t framing_bytes = 0;
26   uint64_t data_bytes = 0;
27   uint64_t header_bytes = 0;
28 };
29 
30 struct grpc_transport_stream_stats {
31   grpc_transport_one_way_stats incoming;
32   grpc_transport_one_way_stats outgoing;
33   gpr_timespec latency = gpr_inf_future(GPR_TIMESPAN);
34 };
35 
36 void grpc_transport_move_one_way_stats(grpc_transport_one_way_stats* from,
37                                        grpc_transport_one_way_stats* to);
38 
39 void grpc_transport_move_stats(grpc_transport_stream_stats* from,
40                                grpc_transport_stream_stats* to);
41 
42 struct grpc_call_stats {
43   grpc_transport_stream_stats transport_stream_stats;
44   gpr_timespec latency;  // From call creating to enqueuing of received status
45 };
46 /// Information about the call upon completion.
47 struct grpc_call_final_info {
48   grpc_call_stats stats;
49   grpc_status_code final_status = GRPC_STATUS_OK;
50   const char* error_string = nullptr;
51 };
52 
53 #endif  // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FINAL_INFO_H
54