Skip to content

Fixes derive_duration calculation bug introduced by the adding of STOP_PERFORMANCE_TRACKING event#70

Merged
nv-alicheng merged 4 commits intomainfrom
fix/alicheng-duration-calc
Dec 23, 2025
Merged

Fixes derive_duration calculation bug introduced by the adding of STOP_PERFORMANCE_TRACKING event#70
nv-alicheng merged 4 commits intomainfrom
fix/alicheng-duration-calc

Conversation

@nv-alicheng
Copy link
Copy Markdown
Collaborator

What does this PR do?

When STOP_PERFORMANCE_TRACKING was implemented, the algorithm for derive_duration incorrectly assumed that the event would only be recorded after all performance samples were completed. This change fixes the algorithm to correctly search for the timestamp of the final SampleEvent.COMPLETE among the sample_uuids issued before STOP_PERFORMANCE_TRACKING.

In addition, also adds a minor bugfix to remove calls to no longer existing methods in performance tests, which were not caught by CICD.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor/cleanup

Related issues

Testing

  • Tests added/updated
  • All tests pass locally
  • Manual testing completed

Checklist

  • Code follows project style
  • Pre-commit hooks pass
  • Documentation updated (if needed)

@nv-alicheng nv-alicheng requested a review from a team as a code owner December 23, 2025 03:19
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 23, 2025

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @nv-alicheng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug in the derive_duration metric calculation within the MetricsReporter, which previously miscalculated test durations when a STOP_PERFORMANCE_TRACKING event was involved. The core issue stemmed from an incorrect assumption about sample completion times relative to the stop event. The updated algorithm now correctly identifies the duration based on the completion of performance samples that were initiated before the tracking stopped. Additionally, the PR includes a minor fix to update performance tests by removing calls to deprecated methods, ensuring test stability and accuracy.

Highlights

  • Corrected Duration Calculation: The derive_duration method now accurately calculates test duration when a STOP_PERFORMANCE_TRACKING event is present, by considering only performance samples issued before the stop event and finding the latest COMPLETE timestamp among them.
  • Performance Test Cleanup: Removed calls to no longer existing methods (client.start(), sample_issuer.start(), sample_issuer.wait_for_all_complete()) in performance tests, addressing a bug not caught by CI/CD.
  • Removed E2E Latency Metric: The e2e_sample_latency_sec property and its related logic have been removed from the MetricsReporter class and its JSON/display output.
  • Improved Duration Reporting: The derive_duration method can now return None if no performance samples were issued, and the display method will reflect this as "Duration: N/A".
  • Enhanced Test Coverage: New unit tests were added for derive_duration to validate its behavior under various conditions, including malformed event data (with an option to bypass strict checks) and complex STOP_PERFORMANCE_TRACKING scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses a bug in the derive_duration calculation by correctly identifying the final performance sample completion time, rather than relying on the STOP_PERFORMANCE_TRACKING event's timestamp. The new logic is more robust, and the detailed docstring is very helpful. The addition of comprehensive unit tests, including those for the new check_malformed parameter, is excellent and significantly improves confidence in the change. The cleanup of obsolete method calls in the performance tests is also a welcome improvement. I've identified one potential edge case that could lead to a TypeError and a minor style issue in the tests.

Copy link
Copy Markdown
Collaborator

@arekay-nv arekay-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix and the comprehensive tests!

@nv-alicheng nv-alicheng merged commit 849fa2e into main Dec 23, 2025
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2025
@arekay-nv arekay-nv deleted the fix/alicheng-duration-calc branch April 2, 2026 03:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants