alamb commented on code in PR #16911:
URL: https://github.com/apache/datafusion/pull/16911#discussion_r2231870480


##########
datafusion/physical-plan/src/metrics/value.rs:
##########
@@ -331,6 +341,20 @@ impl ScopedTimerGuard<'_> {
     pub fn done(mut self) {
         self.stop()
     }
+
+    /// Stop the timer timing and record the time taken with the given 
endpoint.
+    pub fn stop_with(&mut self, end_time: Instant) {
+        if let Some(start) = self.start.take() {
+            let elapsed = end_time - start;
+            self.inner.add_duration(elapsed)
+        }
+    }
+
+    /// Stop the timer, record the time taken with the given endpoint, and
+    /// consume self.

Review Comment:
   ```suggestion
       /// Stop the timer, record the time taken since `end_time` endpoint, and
       /// consume self.
   ```



##########
datafusion/physical-plan/src/metrics/value.rs:
##########
@@ -331,6 +341,20 @@ impl ScopedTimerGuard<'_> {
     pub fn done(mut self) {
         self.stop()
     }
+
+    /// Stop the timer timing and record the time taken with the given 
endpoint.

Review Comment:
   ```suggestion
       /// Stop the timer timing and record the time taken since the given 
endpoint.
   ```



##########
datafusion/physical-plan/src/metrics/value.rs:
##########
@@ -222,6 +222,16 @@ impl Time {
     pub fn value(&self) -> usize {
         self.nanos.load(Ordering::Relaxed)
     }
+
+    /// Return a scoped guard that adds the amount of time elapsed between its
+    /// creation and its drop (or the call to `stop`) to the underlying metric
+    /// according to the given instant.

Review Comment:
   ```suggestion
       /// Return a scoped guard that adds the amount of time elapsed between 
the
       /// given instant and its drop (or the call to `stop`) to the underlying 
metric
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to