Skip to content

Conversation

@zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Aug 5, 2025

What does this PR do?:
Avoid IllegalStateException exception due to double stop, which can result no output from jmh profiler.

Motivation:
Cleanup and make benchmark more robust.

Additional Notes:

How to test the change?:
Run the benchmark, ThreadFilterBenchmark no longer throws IllegalStateException exception.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.
  • JIRA: PROF-12247

Unsure? Have a question? Request a review!

@dd-octo-sts
Copy link

dd-octo-sts bot commented Aug 5, 2025

CppCheck Report

Errors (2)

Warnings (8)

Style Violations (300)

}

// Stop the profiler if it's active
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

better to stop in tear down or setup in case it is still running ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not against that, but the framework (WhiteboxProfiler) handles it already.

Copy link
Contributor

@r1viollet r1viollet left a comment

Choose a reason for hiding this comment

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

I had both in case one was not called for some reason.
I'm not sure which makes more sense to remove.
I don't think the exception is a huge deal, though I'm fine removing either stops.

@zhengyu123
Copy link
Contributor Author

I had both in case one was not called for some reason. I'm not sure which makes more sense to remove. I don't think the exception is a huge deal, though I'm fine removing either stops.

The exception prevents jmh profiler (e.g. prefasm) from generating output.

@zhengyu123 zhengyu123 merged commit 6ac5c92 into main Aug 7, 2025
97 checks passed
@zhengyu123 zhengyu123 deleted the zgu/fix_threadfilter_benchmark branch August 7, 2025 12:08
@github-actions github-actions bot added this to the 1.30.0 milestone Aug 7, 2025
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.

3 participants