Add rendering info reports to ActionJournal (#3545)

This commit is contained in:
Adrian Cojocaru
2025-07-29 19:46:46 +03:00
committed by GitHub
parent 2077df9a2c
commit 8011fa51be
15 changed files with 244 additions and 10 deletions

View File

@@ -98,6 +98,7 @@ public class MapLibreMapOptions implements Parcelable {
private String actionJournalPath = "";
private long actionJournalLogFileSize = 1024 * 1024;
private long actionJournalLogFileCount = 5;
private int actionJournalRenderingReportInterval = 60;
/**
* Creates a new MapLibreMapOptions object.
@@ -161,6 +162,7 @@ public class MapLibreMapOptions implements Parcelable {
actionJournalPath = in.readString();
actionJournalLogFileSize = in.readLong();
actionJournalLogFileCount = in.readLong();
actionJournalRenderingReportInterval = in.readInt();
}
/**
@@ -327,6 +329,9 @@ public class MapLibreMapOptions implements Parcelable {
maplibreMapOptions.actionJournalLogFileCount(
typedArray.getInteger(R.styleable.maplibre_MapView_maplibre_actionJournalLogFileCount, 5)
);
maplibreMapOptions.actionJournalRenderingReportInterval(
typedArray.getInteger(R.styleable.maplibre_MapView_maplibre_actionJournalRenderingReportInterval, 60)
);
} finally {
typedArray.recycle();
}
@@ -811,6 +816,18 @@ public class MapLibreMapOptions implements Parcelable {
return this;
}
/**
* Set the number of seconds to wait between rendering stats reports.
*
* @param actionJournalRenderingReportInterval time interval in seconds
* @return This
*/
@NonNull
public MapLibreMapOptions actionJournalRenderingReportInterval(int actionJournalRenderingReportInterval) {
this.actionJournalRenderingReportInterval = actionJournalRenderingReportInterval;
return this;
}
/**
* Enable local ideograph font family, defaults to true.
*
@@ -940,6 +957,15 @@ public class MapLibreMapOptions implements Parcelable {
return actionJournalLogFileCount;
}
/**
* Get the current configured action journal rendering stats report time interval.
*
* @return time interval in seconds
*/
public int getActionJournalRenderingReportInterval() {
return actionJournalRenderingReportInterval;
}
/**
* Set the flag to render the map surface on top of another surface.
*
@@ -1329,6 +1355,7 @@ public class MapLibreMapOptions implements Parcelable {
dest.writeString(actionJournalPath);
dest.writeLong(actionJournalLogFileSize);
dest.writeLong(actionJournalLogFileCount);
dest.writeInt(actionJournalRenderingReportInterval);
}
@Override
@@ -1465,6 +1492,10 @@ public class MapLibreMapOptions implements Parcelable {
return false;
}
if (actionJournalRenderingReportInterval != options.actionJournalRenderingReportInterval) {
return false;
}
return false;
}
@@ -1516,6 +1547,7 @@ public class MapLibreMapOptions implements Parcelable {
result = 31 * result + (actionJournalPath != null ? actionJournalPath.hashCode() : 0);
result = 31 * result + (int) actionJournalLogFileSize;
result = 31 * result + (int) actionJournalLogFileCount;
result = 31 * result + (int) actionJournalRenderingReportInterval;
return result;
}
}

View File

@@ -9,6 +9,7 @@ public class NativeMapOptions {
private final String actionJournalPath;
private final long actionJournalLogFileSize;
private final long actionJournalLogFileCount;
private final int actionJournalRenderingReportInterval;
public NativeMapOptions(MapLibreMapOptions options) {
pixelRatio = options.getPixelRatio();
@@ -18,6 +19,7 @@ public class NativeMapOptions {
actionJournalPath = options.getActionJournalPath();
actionJournalLogFileSize = options.getActionJournalLogFileSize();
actionJournalLogFileCount = options.getActionJournalLogFileCount();
actionJournalRenderingReportInterval = options.getActionJournalRenderingReportInterval();
}
public NativeMapOptions(float pixelRatio, boolean crossSourceCollisions) {
@@ -28,6 +30,7 @@ public class NativeMapOptions {
actionJournalPath = "";
actionJournalLogFileSize = 0;
actionJournalLogFileCount = 0;
actionJournalRenderingReportInterval = 0;
}
public float pixelRatio() {
@@ -53,4 +56,8 @@ public class NativeMapOptions {
public long actionJournalLogFileCount() {
return actionJournalLogFileCount;
}
public int actionJournalRenderingReportInterval() {
return actionJournalRenderingReportInterval;
}
}

View File

@@ -1,9 +1,9 @@
package org.maplibre.android.maps;
public class RenderingStats {
/// Frame CPU encoding time (milliseconds)
/// Frame CPU encoding time (seconds)
public double encodingTime = 0.0;
/// Frame CPU rendering time (milliseconds)
/// Frame CPU rendering time (seconds)
public double renderingTime = 0.0;
/// Number of frames rendered