Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg.time now supports aggregating sub-timers with the same name. #347

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jan 14, 2025

pg.time now supports aggregating sub-timers with the same name.

With this change, the following code is valid, and the reported elapsed time for the 'task' status will be aggregated accordingly.

  with pg.timeit() as t:
    with pg.timeit('task'):
      time.sleep(1)
    time.sleep(1)
    with pg.timeit('task'):
      time.sleep(1)
  print(t.status()['task'].elapse)
  # Will print a number around 2.

@copybara-service copybara-service bot force-pushed the test_715536323 branch 2 times, most recently from cfc0436 to c97fe39 Compare January 14, 2025 22:49
With this change, the following code is valid, and the reported elapsed time for the 'task' status will be aggregated accordingly.

```
  with pg.timeit() as t:
    with pg.timeit('task'):
      time.sleep(1)
    time.sleep(1)
    with pg.timeit('task'):
      time.sleep(1)
  print(t.status()['task'].elapse)
  # Will print a number around 2.
```

PiperOrigin-RevId: 715540752
@copybara-service copybara-service bot merged commit 264cfa1 into main Jan 14, 2025
@copybara-service copybara-service bot deleted the test_715536323 branch January 14, 2025 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant