-
-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
359 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
sentry-android-core/src/main/java/io/sentry/android/core/AndroidMemoryCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...ry-android-core/src/main/java/io/sentry/android/core/AndroidSlowFrozenFrameCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package io.sentry.android.core; | ||
|
||
import io.sentry.FrameMetrics; | ||
import io.sentry.IPerformanceContinuousCollector; | ||
import io.sentry.ISpan; | ||
import io.sentry.SpanId; | ||
import io.sentry.android.core.internal.util.SentryFrameMetricsCollector; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class AndroidSlowFrozenFrameCollector | ||
implements IPerformanceContinuousCollector, | ||
SentryFrameMetricsCollector.FrameMetricsCollectorListener { | ||
private @NotNull final Object lock = new Object(); | ||
private @Nullable final SentryFrameMetricsCollector frameMetricsCollector; | ||
private @Nullable volatile String listenerId; | ||
private @NotNull final ConcurrentHashMap<SpanId, FrameMetrics> metricsPerSpan; | ||
|
||
public AndroidSlowFrozenFrameCollector(@NotNull SentryAndroidOptions options) { | ||
frameMetricsCollector = options.getFrameMetricsCollector(); | ||
metricsPerSpan = new ConcurrentHashMap<>(); | ||
} | ||
|
||
@Override | ||
public void onSpanStarted(@NotNull ISpan span) { | ||
metricsPerSpan.put(span.getSpanContext().getSpanId(), new FrameMetrics()); | ||
|
||
synchronized (lock) { | ||
if (listenerId == null) { | ||
if (frameMetricsCollector != null) { | ||
listenerId = frameMetricsCollector.startCollection(this); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onSpanFinished(@NotNull ISpan span) { | ||
final FrameMetrics metrics = metricsPerSpan.remove(span.getSpanContext().getSpanId()); | ||
// TODO add data to span | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
synchronized (lock) { | ||
if (listenerId != null) { | ||
if (frameMetricsCollector != null) { | ||
frameMetricsCollector.stopCollection(listenerId); | ||
} | ||
listenerId = null; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onFrameMetricCollected( | ||
long frameEndNanos, long durationNanos, long delayNanos, float refreshRate) { | ||
for (final @NotNull FrameMetrics metrics : metricsPerSpan.values()) { | ||
// TODO aggregate metrics for every running span | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.