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

Benchmark activity Android #1850

Merged
merged 2 commits into from Dec 1, 2023
Merged

Conversation

louwers
Copy link
Collaborator

@louwers louwers commented Nov 8, 2023

Add Benchmark activity for Android. I used the existing Java / Kotlin API for FPS measurement and a TextureView.

The World Tour Benchmark activity is available as a menu item in the test app.

You can add styles to developer-config.xml like so:

 <array name="benchmark_style_names">
   <item>Americana</item>
 </array>
 <array name="benchmark_style_urls">
   <item>https://zelonewolf.github.io/openstreetmap-americana/style.json</item>
</array>

The time it takes to call

is measured. Which is this method:

Here is where the timing happens.

protected void onDrawFrame(GL10 gl) {
long startTime = System.nanoTime();
try {
nativeRender();
} catch (java.lang.Error error) {
Logger.e(TAG, error.getMessage());
}
long renderTime = System.nanoTime() - startTime;
if (renderTime < expectedRenderTime) {
try {
Thread.sleep((long) ((expectedRenderTime - renderTime) / 1E6));
} catch (InterruptedException ex) {
Logger.e(TAG, ex.getMessage());
}
}
if (onFpsChangedListener != null) {
updateFps();
}
}

@mwilsnd
Copy link
Collaborator

mwilsnd commented Nov 27, 2023

We should go ahead and merge this as is, it's already very useful.

@louwers
Copy link
Collaborator Author

louwers commented Nov 30, 2023

@mwilsnd OK, let's merge then I will make a follow-up PR.

@louwers louwers marked this pull request as ready for review November 30, 2023 19:59
@louwers louwers enabled auto-merge (squash) November 30, 2023 19:59
@louwers louwers mentioned this pull request Nov 30, 2023
@louwers louwers merged commit 454efb6 into maplibre:main Dec 1, 2023
28 checks passed
@louwers louwers deleted the benchmark-activity-android branch December 1, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants