Skip to content

Commit 26ddd89

Browse files
authored
Upgrade to asyncProfiler 4.4 (#5418)
1 parent 85fd8b1 commit 26ddd89

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
- Reduce boxing to improve performance ([#5523](https://github.com/getsentry/sentry-java/pull/5523), [#5527](https://github.com/getsentry/sentry-java/pull/5527))
1616

17+
### Dependencies
18+
19+
- Upgrade to asyncProfiler 4.4 ([#5418](https://github.com/getsentry/sentry-java/pull/5418))
20+
1721
### Fixes
1822

1923
- Fix performance collector scheduling many tasks in a row ([#5524](https://github.com/getsentry/sentry-java/pull/5524))

‎gradle/libs.versions.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ androidxLifecycle = "2.2.0"
44
androidxNavigation = "2.4.2"
55
androidxTestCore = "1.7.0"
66
androidxCompose = "1.6.3"
7-
asyncProfiler = "4.2"
7+
asyncProfiler = "4.4"
88
composeCompiler = "1.5.14"
99
coroutines = "1.6.1"
1010
espresso = "3.7.0"

‎sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/convert/JfrAsyncProfilerToSentryProfileConverter.java‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
@ApiStatus.Internal
2828
public final class JfrAsyncProfilerToSentryProfileConverter extends JfrConverter {
29-
private static final double NANOS_PER_SECOND = 1_000_000_000.0;
3029
private static final long UNKNOWN_THREAD_ID = -1;
3130

3231
private final @NotNull SentryProfile sentryProfile = new SentryProfile();
@@ -83,7 +82,6 @@ private class ProfileEventVisitor implements EventCollector.Visitor {
8382
private final @NotNull SentryStackTraceFactory stackTraceFactory;
8483
private final @NotNull JfrReader jfr;
8584
private final @NotNull Arguments args;
86-
private final double ticksPerNanosecond;
8785

8886
public ProfileEventVisitor(
8987
@NotNull SentryProfile sentryProfile,
@@ -94,7 +92,6 @@ public ProfileEventVisitor(
9492
this.stackTraceFactory = stackTraceFactory;
9593
this.jfr = jfr;
9694
this.args = args;
97-
ticksPerNanosecond = jfr.ticksPerSec / NANOS_PER_SECOND;
9895
}
9996

10097
@Override
@@ -150,11 +147,7 @@ private void processSampleWithStack(Event event, long threadId, StackTrace stack
150147
}
151148

152149
private double calculateTimestamp(Event event) {
153-
long nanosFromStart = (long) ((event.time - jfr.chunkStartTicks) / ticksPerNanosecond);
154-
155-
long timeNs = jfr.chunkStartNanos + nanosFromStart;
156-
157-
return DateUtils.nanosToSeconds(timeNs);
150+
return DateUtils.nanosToSeconds(jfr.eventTimeToNanos(event.time));
158151
}
159152

160153
private int addStackTrace(StackTrace stackTrace) {

0 commit comments

Comments
 (0)