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

Add collectors and background service for measurements #2239

Closed
wants to merge 7 commits into from

Conversation

adinauer
Copy link
Member

📜 Description

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2022

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Add collectors and background service for measurements ([#2239](https://github.com/getsentry/sentry-java/pull/2239))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 2f01147

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

I just gave this a quick glance as it's a big PR. @adinauer, what's the current state of this PR?

@adinauer
Copy link
Member Author

@philipphofmann the exact measurements we collect are still in flux but the code around it could be given a high level review regarding its concept.

Long clockTicks = parseClockTicks(stat);

// TODO 2-4 ms on first read, then cached 4 - 20 μs
List<Integer> maxFrequencies = CpuInfoUtils.getInstance().readMaxFrequencies();
Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't seem to return useful data on my emulator, need to wait for new device to arrive to retest.

&& startRealtimeNanos != null
&& startElapsedTimeMs != null) {
// TODO SystemClock.elapsedRealtimeNanos() + Process.getElapsedCpuTime() take 9 - 15 μs
Long diffRealtimeNanos = SystemClock.elapsedRealtimeNanos() - startRealtimeNanos;
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems like our best bet as it's very fast and can be done synchronously. Probably also less risk of being taken away than reading /proc/self/stat

NOTE: The difference for Process.getElapsedCpuTime() might be higher than for SystemClock.elapsedRealtimeNanos() if multiple cores are under load.

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 278.02 ms 341.94 ms 63.92 ms
Size 1.74 MiB 2.34 MiB 613.94 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3d89dea 322.38 ms 350.82 ms 28.45 ms
3d89dea 345.59 ms 364.06 ms 18.47 ms

App size

Revision Plain With Sentry Diff
3d89dea 1.74 MiB 2.33 MiB 604.92 KiB
3d89dea 1.74 MiB 2.33 MiB 604.92 KiB

@romtsn
Copy link
Member

romtsn commented Jan 9, 2023

superseded by #2445

@romtsn romtsn closed this Jan 9, 2023
@romtsn romtsn deleted the feat/measurements-expansion branch July 19, 2023 09:54
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