File tree Expand file tree Collapse file tree 5 files changed +14
-12
lines changed
Expand file tree Collapse file tree 5 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,8 @@ struct aws_s3_request_metrics {
122122 int error_code ;
123123 /* Retry attempt. */
124124 uint32_t retry_attempt ;
125+ /* Is the memory for the request allocated from the buffer pool or not. */
126+ bool memory_allocated_from_pool ;
125127 } crt_info_metrics ;
126128
127129 struct {
Original file line number Diff line number Diff line change @@ -1615,6 +1615,10 @@ int aws_s3_request_metrics_get_error_code(const struct aws_s3_request_metrics *m
16151615AWS_S3_API
16161616uint32_t aws_s3_request_metrics_get_retry_attempt (const struct aws_s3_request_metrics * metrics );
16171617
1618+ /* Get the memory for the request allocated from the pool or not. Cannot fail */
1619+ AWS_S3_API
1620+ bool aws_s3_request_metrics_get_memory_allocated_from_pool (const struct aws_s3_request_metrics * metrics );
1621+
16181622/* Get the beginning range of this part from request metrics. */
16191623AWS_S3_API
16201624void aws_s3_request_metrics_get_part_range_start (
Original file line number Diff line number Diff line change @@ -1984,6 +1984,7 @@ void s_acquire_mem_and_prepare_request(
19841984
19851985 if (request -> send_data .metrics ) {
19861986 struct aws_s3_request_metrics * metric = request -> send_data .metrics ;
1987+ metric -> crt_info_metrics .memory_allocated_from_pool = true;
19871988 aws_high_res_clock_get_ticks ((uint64_t * )& metric -> time_metrics .mem_acquire_start_timestamp_ns );
19881989 }
19891990
Original file line number Diff line number Diff line change @@ -596,3 +596,8 @@ void aws_s3_request_metrics_get_part_number(const struct aws_s3_request_metrics
596596 AWS_PRECONDITION (out_part_number );
597597 * out_part_number = metrics -> part_info_metrics .part_number ;
598598}
599+
600+ bool aws_s3_request_metrics_get_memory_allocated_from_pool (const struct aws_s3_request_metrics * metrics ) {
601+ AWS_PRECONDITION (metrics );
602+ return metrics -> crt_info_metrics .memory_allocated_from_pool ;
603+ }
Original file line number Diff line number Diff line change @@ -247,12 +247,7 @@ static void s_s3_test_meta_request_telemetry(
247247 AWS_FATAL_ASSERT (during_time == (end_time - start_time ));
248248 }
249249
250- enum aws_s3_request_type request_type ;
251- aws_s3_request_metrics_get_request_type (metrics , & request_type );
252- uint32_t retry_attempt = aws_s3_request_metrics_get_retry_attempt (metrics );
253-
254- if (aws_s3_request_metrics_get_error_code (metrics ) == AWS_ERROR_SUCCESS && retry_attempt == 0 &&
255- (request_type == AWS_S3_REQUEST_TYPE_GET_OBJECT || request_type == AWS_S3_REQUEST_TYPE_UPLOAD_PART )) {
250+ if (aws_s3_request_metrics_get_memory_allocated_from_pool (metrics )) {
256251 uint64_t start_time = 0 ;
257252 uint64_t end_time = 0 ;
258253 uint64_t duration_time = 0 ;
@@ -582,12 +577,7 @@ void aws_s3_meta_request_test_results_clean_up(struct aws_s3_meta_request_test_r
582577 aws_s3_request_metrics_release (metrics );
583578 }
584579 aws_array_list_clean_up (& test_meta_request -> synced_data .metrics );
585- while (aws_array_list_length (& test_meta_request -> synced_data .succeed_metrics ) > 0 ) {
586- struct aws_s3_request_metrics * metrics = NULL ;
587- aws_array_list_back (& test_meta_request -> synced_data .succeed_metrics , (void * * )& metrics );
588- aws_array_list_pop_back (& test_meta_request -> synced_data .succeed_metrics );
589- aws_s3_request_metrics_release (metrics );
590- }
580+ /* We don't need to release the metrics from the succeed list, since it's already released from the main list. */
591581 aws_array_list_clean_up (& test_meta_request -> synced_data .succeed_metrics );
592582
593583 for (size_t i = 0 ; i < test_meta_request -> upload_review .part_count ; ++ i ) {
You can’t perform that action at this time.
0 commit comments