Skip to content

Commit bd65fee

Browse files
itaybrephilprime
andauthored
ref: Convert SentrySample to Swift (#7405)
Co-authored-by: Philip Niedertscheider <phil.niedertscheider@sentry.io>
1 parent 0e4a9dc commit bd65fee

12 files changed

+125
-48
lines changed

Sentry.xcodeproj/project.pbxproj

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@
286286
7DB3A687238EA75E00A2D442 /* SentryHttpTransport.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB3A684238EA75E00A2D442 /* SentryHttpTransport.m */; };
287287
840A11122B61E27500650D02 /* SentrySamplerDecision.m in Sources */ = {isa = PBXBuildFile; fileRef = 840A11102B61E27500650D02 /* SentrySamplerDecision.m */; };
288288
84281C432A578E5600EE88F2 /* SentryProfilerState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84281C422A578E5600EE88F2 /* SentryProfilerState.mm */; };
289-
84281C462A57905700EE88F2 /* SentrySample.h in Headers */ = {isa = PBXBuildFile; fileRef = 84281C442A57905700EE88F2 /* SentrySample.h */; };
290-
84281C472A57905700EE88F2 /* SentrySample.m in Sources */ = {isa = PBXBuildFile; fileRef = 84281C452A57905700EE88F2 /* SentrySample.m */; };
291289
84302A812B5767A50027A629 /* SentryLaunchProfiling.m in Sources */ = {isa = PBXBuildFile; fileRef = 84302A7F2B5767A50027A629 /* SentryLaunchProfiling.m */; };
292290
8431D4552BE1745A009EAEC1 /* SentryProfileTestFixture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8431D4522BE1741E009EAEC1 /* SentryProfileTestFixture.swift */; };
293291
8431D4562BE1745F009EAEC1 /* SentryContinuousProfilerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8446F5182BE172290040D57E /* SentryContinuousProfilerTests.swift */; };
@@ -446,7 +444,11 @@
446444
D8CB7417294724CC00A5F964 /* SentryEnvelopeAttachmentHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D8CB7416294724CC00A5F964 /* SentryEnvelopeAttachmentHeader.m */; };
447445
D8CB74192947285A00A5F964 /* SentryEnvelopeItemHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = D8CB74182947285A00A5F964 /* SentryEnvelopeItemHeader.h */; };
448446
D8CB741B2947286500A5F964 /* SentryEnvelopeItemHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = D8CB741A2947286500A5F964 /* SentryEnvelopeItemHeader.m */; };
447+
F400C0CD2F368A8B0042712D /* SentryProfilerSampleCreation.m in Sources */ = {isa = PBXBuildFile; fileRef = F400C0CC2F368A8B0042712D /* SentryProfilerSampleCreation.m */; };
448+
F400C0D42F368A980042712D /* SentryProfilerSampleCreation.h in Headers */ = {isa = PBXBuildFile; fileRef = F400C0D32F368A980042712D /* SentryProfilerSampleCreation.h */; };
449449
F40B7BB52F22E00200771198 /* SentryCoreDataSwizzlingHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = F40B7BB42F22E00200771198 /* SentryCoreDataSwizzlingHelper.m */; };
450+
F40C5EC42F3BC7DE00CAEC02 /* SentryProfileDebugLoggerHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = F40C5EC32F3BC7DE00CAEC02 /* SentryProfileDebugLoggerHelper.m */; };
451+
F40C5EC62F3BC7EE00CAEC02 /* SentryProfileDebugLoggerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F40C5EC52F3BC7EE00CAEC02 /* SentryProfileDebugLoggerHelper.h */; };
450452
F42F49BD2F2903B400903377 /* SentryCoreDataSwizzlingHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F42F49BC2F2903B400903377 /* SentryCoreDataSwizzlingHelper.h */; };
451453
F44858132E03579D0013E63B /* SentryCrashDynamicLinker+Test.h in Headers */ = {isa = PBXBuildFile; fileRef = F44858122E0357940013E63B /* SentryCrashDynamicLinker+Test.h */; };
452454
F44D2B5C2E6B7E8700FF31FA /* SentryProfilingScreenFramesHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F44D2B5A2E6B7E8700FF31FA /* SentryProfilingScreenFramesHelper.h */; };
@@ -910,8 +912,6 @@
910912
840B7EF02BBF2B5F008B8120 /* MIGRATION.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = MIGRATION.md; sourceTree = "<group>"; };
911913
840B7EF22BBF83DF008B8120 /* SentryProfiler+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryProfiler+Private.h"; path = "Sources/Sentry/include/SentryProfiler+Private.h"; sourceTree = SOURCE_ROOT; };
912914
84281C422A578E5600EE88F2 /* SentryProfilerState.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryProfilerState.mm; sourceTree = "<group>"; };
913-
84281C442A57905700EE88F2 /* SentrySample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySample.h; path = ../include/SentrySample.h; sourceTree = "<group>"; };
914-
84281C452A57905700EE88F2 /* SentrySample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySample.m; sourceTree = "<group>"; };
915915
84281C642A57D36100EE88F2 /* SentryProfilerState+ObjCpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryProfilerState+ObjCpp.h"; path = "../include/SentryProfilerState+ObjCpp.h"; sourceTree = "<group>"; };
916916
84302A7F2B5767A50027A629 /* SentryLaunchProfiling.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryLaunchProfiling.m; sourceTree = "<group>"; };
917917
8431D4522BE1741E009EAEC1 /* SentryProfileTestFixture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryProfileTestFixture.swift; sourceTree = "<group>"; };
@@ -931,7 +931,6 @@
931931
844DA80528246D5000E6B62E /* Sentry.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = Sentry.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
932932
844DA80628246D5000E6B62E /* .craft.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .craft.yml; sourceTree = "<group>"; };
933933
844DA80728246D5000E6B62E /* Gemfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = Gemfile; sourceTree = "<group>"; };
934-
844DA80828246D5000E6B62E /* .gitmodules */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitmodules; sourceTree = "<group>"; };
935934
844DA80A28246D5000E6B62E /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
936935
844DA80B28246D5000E6B62E /* Brewfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = Brewfile; sourceTree = "<group>"; };
937936
844DA80C28246D5000E6B62E /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
@@ -1109,7 +1108,11 @@
11091108
D8CB7416294724CC00A5F964 /* SentryEnvelopeAttachmentHeader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryEnvelopeAttachmentHeader.m; sourceTree = "<group>"; };
11101109
D8CB74182947285A00A5F964 /* SentryEnvelopeItemHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryEnvelopeItemHeader.h; path = include/SentryEnvelopeItemHeader.h; sourceTree = "<group>"; };
11111110
D8CB741A2947286500A5F964 /* SentryEnvelopeItemHeader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryEnvelopeItemHeader.m; sourceTree = "<group>"; };
1111+
F400C0CC2F368A8B0042712D /* SentryProfilerSampleCreation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfilerSampleCreation.m; sourceTree = "<group>"; };
1112+
F400C0D32F368A980042712D /* SentryProfilerSampleCreation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilerSampleCreation.h; path = Sources/Sentry/include/SentryProfilerSampleCreation.h; sourceTree = SOURCE_ROOT; };
11121113
F40B7BB42F22E00200771198 /* SentryCoreDataSwizzlingHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCoreDataSwizzlingHelper.m; sourceTree = "<group>"; };
1114+
F40C5EC32F3BC7DE00CAEC02 /* SentryProfileDebugLoggerHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProfileDebugLoggerHelper.m; sourceTree = "<group>"; };
1115+
F40C5EC52F3BC7EE00CAEC02 /* SentryProfileDebugLoggerHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfileDebugLoggerHelper.h; path = Sources/Sentry/include/SentryProfileDebugLoggerHelper.h; sourceTree = SOURCE_ROOT; };
11131116
F42F49BC2F2903B400903377 /* SentryCoreDataSwizzlingHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCoreDataSwizzlingHelper.h; path = include/SentryCoreDataSwizzlingHelper.h; sourceTree = "<group>"; };
11141117
F44858122E0357940013E63B /* SentryCrashDynamicLinker+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryCrashDynamicLinker+Test.h"; sourceTree = "<group>"; };
11151118
F44D2B5A2E6B7E8700FF31FA /* SentryProfilingScreenFramesHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryProfilingScreenFramesHelper.h; sourceTree = "<group>"; };
@@ -1951,12 +1954,12 @@
19511954
848A45182BBF8D33006AAAEC /* SentryContinuousProfiler.mm */,
19521955
0354A22A2A134D9C003C3A04 /* SentryProfilerState.h */,
19531956
84281C422A578E5600EE88F2 /* SentryProfilerState.mm */,
1957+
F400C0D32F368A980042712D /* SentryProfilerSampleCreation.h */,
1958+
F400C0CC2F368A8B0042712D /* SentryProfilerSampleCreation.m */,
19541959
84281C642A57D36100EE88F2 /* SentryProfilerState+ObjCpp.h */,
19551960
84354E0F29BF944900CDBB8B /* SentryProfileTimeseries.h */,
19561961
84354E1029BF944900CDBB8B /* SentryProfileTimeseries.m */,
19571962
03BCC38D27E2A377003232C7 /* SentryProfilingConditionals.h */,
1958-
84281C442A57905700EE88F2 /* SentrySample.h */,
1959-
84281C452A57905700EE88F2 /* SentrySample.m */,
19601963
03F84D3027DD4191008FE43F /* SentrySamplingProfiler.cpp */,
19611964
03F84D1527DD414C008FE43F /* SentrySamplingProfiler.hpp */,
19621965
03F84D1427DD414C008FE43F /* SentryStackBounds.hpp */,
@@ -1970,6 +1973,8 @@
19701973
03BCC38B27E1C01A003232C7 /* SentryTime.mm */,
19711974
84DEE8752B69AD6400A7BC17 /* SentryLaunchProfiling.h */,
19721975
84302A7F2B5767A50027A629 /* SentryLaunchProfiling.m */,
1976+
F40C5EC52F3BC7EE00CAEC02 /* SentryProfileDebugLoggerHelper.h */,
1977+
F40C5EC32F3BC7DE00CAEC02 /* SentryProfileDebugLoggerHelper.m */,
19731978
);
19741979
path = Profiling;
19751980
sourceTree = "<group>";
@@ -2239,7 +2244,6 @@
22392244
844DA80628246D5000E6B62E /* .craft.yml */,
22402245
840B7EEC2BBF2AFE008B8120 /* .gitattributes */,
22412246
844DA81628246D5000E6B62E /* .gitignore */,
2242-
844DA80828246D5000E6B62E /* .gitmodules */,
22432247
840B7EED2BBF2B16008B8120 /* .pre-commit-config.yaml */,
22442248
840B7EEE2BBF2B23008B8120 /* .ruby-version */,
22452249
844A3563282B3C9F00C6D1DF /* .sauce */,
@@ -2325,6 +2329,7 @@
23252329
D851EFA83D0A4BB0B1915646 /* SentryDefaultTelemetryProcessorTransport.h in Headers */,
23262330
63FE717720DA4C1100CDBAE8 /* SentryCrashReportWriter.h in Headers */,
23272331
84DEE86B2B686BD400A7BC17 /* SentrySamplerDecision.h in Headers */,
2332+
F40C5EC62F3BC7EE00CAEC02 /* SentryProfileDebugLoggerHelper.h in Headers */,
23282333
D81A346C291AECC7005A27A9 /* PrivateSentrySDKOnly.h in Headers */,
23292334
D88817DA26D72AB800BF2251 /* SentryTraceContext.h in Headers */,
23302335
63FE708520DA4C1000CDBAE8 /* SentryCrashReportFilter.h in Headers */,
@@ -2439,6 +2444,7 @@
24392444
D452FC732DDB553100AFF56F /* SentryWatchdogTerminationBreadcrumbProcessor.h in Headers */,
24402445
FA914E9B2ED61AA800C54BDD /* SentryFormatterSwift.h in Headers */,
24412446
D456B4382D706BFE007068CB /* SentrySpanDataKey.h in Headers */,
2447+
F400C0D42F368A980042712D /* SentryProfilerSampleCreation.h in Headers */,
24422448
7B77BE3527EC8445003C9020 /* SentryDiscardReasonMapper.h in Headers */,
24432449
7B610D602512390E00B0B5D9 /* SentrySDK+Private.h in Headers */,
24442450
62A456E12B03704A003F19A1 /* SentryUIEventTrackerMode.h in Headers */,
@@ -2464,7 +2470,6 @@
24642470
632331F9240506DF008D91D6 /* SentryScope+Private.h in Headers */,
24652471
D8603DD8284F894C000E1227 /* SentryBaggage.h in Headers */,
24662472
03F84D2127DD414C008FE43F /* SentrySamplingProfiler.hpp in Headers */,
2467-
84281C462A57905700EE88F2 /* SentrySample.h in Headers */,
24682473
63FE712B20DA4C1100CDBAE8 /* SentryCrashStackCursor.h in Headers */,
24692474
7BA61CBF247CEA8100C130A8 /* SentryFormatter.h in Headers */,
24702475
D8370B6C273DF20F00F66E2D /* SentryNSURLSessionTaskSearch.h in Headers */,
@@ -2975,6 +2980,7 @@
29752980
843FB3232D0CD04D00558F18 /* SentryUserAccess.m in Sources */,
29762981
63FE716720DA4C1100CDBAE8 /* SentryCrashCPU.c in Sources */,
29772982
63FE717320DA4C1100CDBAE8 /* SentryCrashC.c in Sources */,
2983+
F40C5EC42F3BC7DE00CAEC02 /* SentryProfileDebugLoggerHelper.m in Sources */,
29782984
63FE70D720DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.c in Sources */,
29792985
7B96572226830D2400C66E25 /* SentryScopeSyncC.c in Sources */,
29802986
F44D2B5D2E6B7E8700FF31FA /* SentryProfilingScreenFramesHelper.m in Sources */,
@@ -2994,6 +3000,7 @@
29943000
7DB3A687238EA75E00A2D442 /* SentryHttpTransport.m in Sources */,
29953001
63FE70D520DA4C1000CDBAE8 /* SentryCrashMonitor_NSException.m in Sources */,
29963002
7BC63F0A28081288009D9E37 /* SentrySwizzleWrapperHelper.m in Sources */,
3003+
F400C0CD2F368A8B0042712D /* SentryProfilerSampleCreation.m in Sources */,
29973004
63295AF71EF3C7DB002D4490 /* SentryNSDictionarySanitize.m in Sources */,
29983005
7B8ECBFC26498958005FE2EF /* SentryDefaultAppStateManager.m in Sources */,
29993006
FA6555162E30182B009917BC /* SentrySDKInternal.m in Sources */,
@@ -3027,7 +3034,6 @@
30273034
63FE717520DA4C1100CDBAE8 /* SentryCrash.m in Sources */,
30283035
7BAF3DCE243DCBFE008A5414 /* SentryTransportFactory.m in Sources */,
30293036
7D65260E237F649E00113EA2 /* SentryScope.m in Sources */,
3030-
84281C472A57905700EE88F2 /* SentrySample.m in Sources */,
30313037
62A456E52B0370E0003F19A1 /* SentryUIEventTrackerTransactionMode.m in Sources */,
30323038
D43A2A122DD47FCE00114724 /* SentryWeakMap.m in Sources */,
30333039
63FE712D20DA4C1100CDBAE8 /* SentryCrashJSONCodecObjC.m in Sources */,

Sources/Sentry/Profiling/SentryContinuousProfiler.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# import "SentryProfilingScreenFramesHelper.h"
1313
# import "SentryProfilingSwiftHelpers.h"
1414
# import "SentrySDK+Private.h"
15-
# import "SentrySample.h"
1615
# include <mutex>
1716

1817
# if SENTRY_HAS_UIKIT
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#import "SentryProfileDebugLoggerHelper.h"
2+
3+
#if SENTRY_TARGET_PROFILING_SUPPORTED && defined(DEBUG)
4+
5+
# import "SentrySwift.h"
6+
7+
@implementation SentryProfileDebugLoggerHelper
8+
9+
+ (uint64_t)getAbsoluteTimeStampFromSample:(SentrySample *)sample
10+
{
11+
return sample.absoluteTimestamp;
12+
}
13+
14+
@end
15+
16+
#endif
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#import "SentryProfilerSampleCreation.h"
2+
#if SENTRY_TARGET_PROFILING_SUPPORTED
3+
# import "SentryInternalDefines.h"
4+
# import "SentrySwift.h"
5+
6+
SentrySample *
7+
sentry_profilerSampleWithStack(NSArray<NSNumber *> *stack, uint64_t absoluteTimestamp,
8+
NSTimeInterval absoluteNSDateInterval, uint64_t threadID, SentryProfilerMutableState *state)
9+
{
10+
SentrySample *sample = [[SentrySample alloc] init];
11+
sample.absoluteTimestamp = absoluteTimestamp;
12+
sample.absoluteNSDateInterval = absoluteNSDateInterval;
13+
sample.threadID = threadID;
14+
15+
NSString *stackKey = [stack componentsJoinedByString:@"|"];
16+
NSNumber *_Nullable stackIndex = state.stackIndexLookup[stackKey];
17+
if (stackIndex) {
18+
sample.stackIndex = SENTRY_UNWRAP_NULLABLE(NSNumber, stackIndex);
19+
} else {
20+
NSNumber *nextStackIndex = @(state.stacks.count);
21+
sample.stackIndex = nextStackIndex;
22+
state.stackIndexLookup[stackKey] = nextStackIndex;
23+
[state.stacks addObject:stack];
24+
}
25+
26+
return sample;
27+
}
28+
29+
#endif // SENTRY_TARGET_PROFILING_SUPPORTED

Sources/Sentry/Profiling/SentryProfilerSerialization.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# import "SentryProfilerState.h"
2222
# import "SentryProfilerTestHelpers.h"
2323
# import "SentrySDK+Private.h"
24-
# import "SentrySample.h"
2524
# import "SentryScope+Private.h"
2625
# import "SentryScope+PrivateSwift.h"
2726
# import "SentrySerialization.h"

Sources/Sentry/Profiling/SentryProfilerState.mm

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
# import "SentryDependencyContainerSwiftHelper.h"
66
# import "SentryFormatter.h"
77
# import "SentryInternalDefines.h"
8+
# import "SentryProfileDebugLoggerHelper.h"
89
# import "SentryProfileTimeseries.h"
10+
# import "SentryProfilerSampleCreation.h"
911
# import "SentryProfilingSwiftHelpers.h"
10-
# import "SentrySample.h"
1112
# import <mach/mach_types.h>
1213
# import <mach/port.h>
1314
# import <mutex>
@@ -158,26 +159,14 @@ - (void)appendBacktrace:(const Backtrace &)backtrace
158159
free(symbols);
159160
# endif // defined(DEBUG)
160161

161-
const auto sample = [[SentrySample alloc] init];
162-
sample.absoluteTimestamp = backtrace.absoluteTimestamp;
163-
sample.absoluteNSDateInterval = sentry_getDate().timeIntervalSince1970;
164-
sample.threadID = backtrace.threadMetadata.threadID;
165-
166-
const auto stackKey = [stack componentsJoinedByString:@"|"];
167-
NSNumber *_Nullable stackIndex = state.stackIndexLookup[stackKey];
168-
if (stackIndex) {
169-
sample.stackIndex = SENTRY_UNWRAP_NULLABLE(NSNumber, stackIndex);
170-
} else {
171-
const auto nextStackIndex = @(state.stacks.count);
172-
sample.stackIndex = nextStackIndex;
173-
state.stackIndexLookup[stackKey] = nextStackIndex;
174-
[state.stacks addObject:stack];
175-
}
162+
const auto sample = sentry_profilerSampleWithStack(stack, backtrace.absoluteTimestamp,
163+
sentry_getDate().timeIntervalSince1970, backtrace.threadMetadata.threadID, state);
176164

177165
# if defined(DEBUG)
178166
if (backtraceFunctionNames.count > 0) {
179167
SENTRY_ASYNC_SAFE_LOG_DEBUG("Recorded backtrace for thread %s at %llu: %s",
180-
threadID.UTF8String, sample.absoluteTimestamp,
168+
threadID.UTF8String,
169+
[SentryProfileDebugLoggerHelper getAbsoluteTimeStampFromSample:sample],
181170
backtraceFunctionNames.description.UTF8String);
182171
}
183172
# endif // defined(DEBUG)

Sources/Sentry/Profiling/SentrySample.m

Lines changed: 0 additions & 4 deletions
This file was deleted.

Sources/Sentry/SentryProfileTimeseries.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# import "SentryEvent+Private.h"
77
# import "SentryInternalDefines.h"
88
# import "SentryLogC.h"
9-
# import "SentrySample.h"
109
# import "SentryTransaction.h"
1110
# if SENTRY_HAS_UIKIT
1211
# import "SentryFormatter.h"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#import "SentryProfilingConditionals.h"
2+
#import <Foundation/Foundation.h>
3+
4+
#if SENTRY_TARGET_PROFILING_SUPPORTED && defined(DEBUG)
5+
6+
@class SentrySample;
7+
8+
NS_ASSUME_NONNULL_BEGIN
9+
10+
@interface SentryProfileDebugLoggerHelper : NSObject
11+
12+
+ (uint64_t)getAbsoluteTimeStampFromSample:(SentrySample *)sample;
13+
14+
@end
15+
16+
NS_ASSUME_NONNULL_END
17+
18+
#endif // SENTRY_TARGET_PROFILING_SUPPORTED && defined(DEBUG)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#import "SentryProfilingConditionals.h"
2+
3+
#if SENTRY_TARGET_PROFILING_SUPPORTED
4+
5+
# import "SentryProfilerState.h"
6+
# import <Foundation/Foundation.h>
7+
8+
NS_ASSUME_NONNULL_BEGIN
9+
10+
/**
11+
* Creates a profiler sample from a stack of frame indices and appends the stack to state if new.
12+
* Used so that SentrySample (Swift) is only referenced from Objective-C, not from Objective-C++.
13+
*/
14+
# if defined(__cplusplus)
15+
extern "C" {
16+
# endif
17+
SentrySample *sentry_profilerSampleWithStack(NSArray<NSNumber *> *stack, uint64_t absoluteTimestamp,
18+
NSTimeInterval absoluteNSDateInterval, uint64_t threadID, SentryProfilerMutableState *state);
19+
# if defined(__cplusplus)
20+
}
21+
# endif
22+
23+
NS_ASSUME_NONNULL_END
24+
25+
#endif // SENTRY_TARGET_PROFILING_SUPPORTED

0 commit comments

Comments
 (0)