1 #ifndef AWS_HTTP_STATISTICS_H
2 #define AWS_HTTP_STATISTICS_H
3 
4 /**
5  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6  * SPDX-License-Identifier: Apache-2.0.
7  */
8 
9 #include <aws/http/http.h>
10 
11 #include <aws/common/statistics.h>
12 
13 enum aws_crt_http_statistics_category {
14     AWSCRT_STAT_CAT_HTTP1_CHANNEL = AWS_CRT_STATISTICS_CATEGORY_BEGIN_RANGE(AWS_C_HTTP_PACKAGE_ID),
15 };
16 
17 /**
18  * A statistics struct for http handlers.  Tracks the actual amount of time that incoming and outgoing requests are
19  * waiting for their IO to complete.
20  */
21 struct aws_crt_statistics_http1_channel {
22     aws_crt_statistics_category_t category;
23 
24     uint64_t pending_outgoing_stream_ms;
25     uint64_t pending_incoming_stream_ms;
26 
27     uint32_t current_outgoing_stream_id;
28     uint32_t current_incoming_stream_id;
29 };
30 
31 AWS_EXTERN_C_BEGIN
32 
33 /**
34  * Initializes a http channel handler statistics struct
35  */
36 AWS_HTTP_API
37 int aws_crt_statistics_http1_channel_init(struct aws_crt_statistics_http1_channel *stats);
38 
39 /**
40  * Cleans up a http channel handler statistics struct
41  */
42 AWS_HTTP_API
43 void aws_crt_statistics_http1_channel_cleanup(struct aws_crt_statistics_http1_channel *stats);
44 
45 /**
46  * Resets a http channel handler statistics struct's statistics
47  */
48 AWS_HTTP_API
49 void aws_crt_statistics_http1_channel_reset(struct aws_crt_statistics_http1_channel *stats);
50 
51 AWS_EXTERN_C_END
52 
53 #endif /* AWS_HTTP_STATISTICS_H */
54