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

ref(profiling): rename SentryLegacyProfiler -> SentryTraceProfiler #3952

Merged
Show file tree
Hide file tree
Changes from 107 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
00ea22c
ref: move functions meant for non-prod test scenarios to separate cod…
armcknight Apr 5, 2024
724dcb4
ref: move functions for slicing data to SentryProfilerTimeseries
armcknight Apr 5, 2024
57118b8
WIP: ref: move functions that serialize profile payloads to envelopes…
armcknight Apr 5, 2024
9565260
fix: gate declarations the same as their implementations; move commen…
armcknight Apr 5, 2024
75ba78e
remove unused imports
armcknight Apr 5, 2024
b38a895
move logic from SentrySDK to SentryProfiler; remove unnecessary expos…
armcknight Apr 9, 2024
8b85d33
put import in profiling gate
armcknight Apr 9, 2024
13c8c2d
remove debugImageProvider property from profiler and just access dire…
armcknight Apr 12, 2024
332cf8e
remove leading _
armcknight Apr 12, 2024
dc92a25
remove leading _
armcknight Apr 12, 2024
a2252c7
remove leading _
armcknight Apr 12, 2024
0593ae7
whitespace
armcknight Apr 12, 2024
425c62e
remove leading _
armcknight Apr 12, 2024
07862d1
move exposures to test header
armcknight Apr 12, 2024
bb57c80
whitespace and headerdoc
armcknight Apr 12, 2024
4b0eff8
more headerdoc
armcknight Apr 12, 2024
2f7d66e
feat: add continuous profiler implementation under basic start/stop
armcknight Apr 12, 2024
64dcad8
fixup! feat: add continuous profiler implementation under basic start…
armcknight Apr 12, 2024
a02dbb4
ref: split SentryProfiler+Test into SentryProfilerSerialization+Test …
armcknight Apr 12, 2024
390a859
ref: move sliceGPUData to timeseries code unit; prefix C functions
armcknight Apr 23, 2024
9d0cb71
ref: move test helpers to separate code unit; prefix with _sentry
armcknight Apr 23, 2024
08e4e6a
ref: rename more functions to prefix with sentry_ or to remove leadin…
armcknight Apr 23, 2024
86bce30
ref(profiling): extract function to handle SDK startup tasks
armcknight Apr 23, 2024
cc1debd
ref(profiling): extract methods related to profile serialization
armcknight Apr 23, 2024
034fb4b
uncomment gates
armcknight Apr 23, 2024
e9147d5
remove unused imports
armcknight Apr 23, 2024
60e45a7
dead code
armcknight Apr 23, 2024
a129273
fix macos build
armcknight Apr 23, 2024
33639a8
fix xcframework build
armcknight Apr 23, 2024
e4893c2
Merge remote-tracking branch 'origin/main' into armcknight/feat/3555-…
armcknight Apr 23, 2024
2b9b637
Merge branch 'armcknight/feat/3555-continuous-profiling/4-refactoring…
armcknight Apr 23, 2024
ee1deb9
Merge branch 'armcknight/feat/3555-continuous-profiling/4-refactoring…
armcknight Apr 23, 2024
7c7aaf7
Merge remote-tracking branch 'origin/main' into armcknight/feat/3555-…
armcknight Apr 23, 2024
9a9d689
move to test util target
armcknight Apr 23, 2024
56b831e
put back some unnecessarily prefixed functions
armcknight Apr 23, 2024
e7a9688
fixup! put back some unnecessarily prefixed functions
armcknight Apr 23, 2024
0b3796f
Revert "move to test util target"
armcknight Apr 23, 2024
d2d5e03
Merge branch 'armcknight/feat/3555-continuous-profiling/4-refactoring…
armcknight Apr 23, 2024
4864579
move some C declarations to static scope
armcknight Apr 23, 2024
6b5ab63
Merge branch 'armcknight/feat/3555-continuous-profiling/4-refactoring…
armcknight Apr 23, 2024
02ad5be
wip fixing merge on top of new refactors
armcknight Apr 23, 2024
7df3801
fixes after merge
armcknight Apr 24, 2024
108c4ce
wip: test plans
armcknight Apr 24, 2024
1e63dfa
Merge remote-tracking branch 'origin/main' into armcknight/feat/3555-…
armcknight Apr 27, 2024
1875215
merge fix
armcknight Apr 27, 2024
fc52345
wip testing continuous profiling implemenation so far
armcknight Apr 30, 2024
d5b4bdc
fix todo so it doesnt trip swiftlint
armcknight Apr 30, 2024
e3ffd1c
add basic assertions to basic test
armcknight Apr 30, 2024
341e1d9
WIP: implementing new schema
armcknight Apr 30, 2024
82d51ba
add test for continuous serialization format
armcknight May 2, 2024
810a665
combine separate functions
armcknight May 3, 2024
328e105
fix most failing tests; only transmit chunks from stop method for con…
armcknight May 3, 2024
c819702
fix remaining failing tests
armcknight May 3, 2024
f51cd24
Format code
getsentry-bot May 3, 2024
a1a811e
wip adding more tests
armcknight May 3, 2024
e912d6c
test with multiple completed continuous profile chunks
armcknight May 4, 2024
27b355d
rename some functions
armcknight May 4, 2024
a9a9a21
Format code
getsentry-bot May 4, 2024
a1abc0c
stop the continuous profiler automatically when ending a session or c…
armcknight Apr 9, 2024
b18db1c
automatically start continuous profile from startWithOptions if not a…
armcknight Apr 9, 2024
be06979
only start trace-managed profiles when not continuously profiling
armcknight Apr 11, 2024
81f2238
format
armcknight Apr 12, 2024
adf082e
feat: implement starting continuous profiling from launch
armcknight Apr 9, 2024
40256dc
wip: test case description for all option combinations
armcknight Apr 9, 2024
69613aa
WIP: bdd test all option combinations
armcknight Apr 10, 2024
cf76dcd
WIP: writing app launch profiling option tests
armcknight May 5, 2024
98e1da2
got tests working
armcknight May 5, 2024
9fe6819
condense declarations
armcknight May 5, 2024
402c03d
express the same app launch options combo test in another way
armcknight May 5, 2024
018a8b2
add combinations with profilesSampler
armcknight May 5, 2024
1d9592c
clean up
armcknight May 5, 2024
a5f9755
rewrite last old app launch objc test in the new swift class
armcknight May 5, 2024
fe6808e
rename SentryLegacyProfiler -> SentryTraceProfiler and associated oth…
armcknight May 7, 2024
6dba68c
fixup! rename SentryLegacyProfiler -> SentryTraceProfiler and associa…
armcknight May 7, 2024
9f603af
fix tvos build
armcknight May 8, 2024
1254b54
Merge remote-tracking branch 'origin/main' into armcknight/feat/3555-…
armcknight May 8, 2024
3cf1ca5
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 8, 2024
0c789a8
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 8, 2024
2231a68
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 8, 2024
c840791
fix bad conflict resolution
armcknight May 8, 2024
4ec29cc
fix remaining broken tests due to improperly ordered dispatch queue m…
armcknight May 8, 2024
804b7f3
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 8, 2024
c219d70
fix test build
armcknight May 8, 2024
cfdf77f
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 8, 2024
d406a5c
fix tvos build
armcknight May 8, 2024
4b8985a
wip testing sampling in/out for sdk session starts
armcknight May 8, 2024
8f30d3e
fixup! wip testing sampling in/out for sdk session starts
armcknight May 8, 2024
d75ca2c
remove auto session profiling, only leave manual start/stop without s…
armcknight May 9, 2024
97e1ec0
fixup! remove auto session profiling, only leave manual start/stop wi…
armcknight May 9, 2024
64964b5
add other tests for starting/stopping
armcknight May 9, 2024
2d36147
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 9, 2024
45d1573
dont sample anything related to continuous profiling
armcknight May 9, 2024
1de6d86
fix field name and IDs; set launch arg to test continuous profiles
armcknight May 10, 2024
9d69b6f
fix build of iOS-Swift to be able to use SentryOptions+Private.h
armcknight May 10, 2024
69c4967
stop profiler after every test in case it's still running
armcknight May 11, 2024
2b9d3b1
Merge remote-tracking branch 'origin/main' into armcknight/feat/3555-…
armcknight May 12, 2024
191b897
assert on profile payload schema version numbers
armcknight May 12, 2024
122be7a
add data category for profile chunk
armcknight May 12, 2024
0b56d0f
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 12, 2024
7ba3397
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 12, 2024
eb2d7a4
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 12, 2024
3227f93
Merge remote-tracking branch 'origin/main' into armcknight/feat/3555-…
armcknight May 14, 2024
48959ff
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 14, 2024
5097c30
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 14, 2024
d0c8e78
fix build issue; just stop continuous profiler in clearTestState()
armcknight May 14, 2024
8a829a6
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 14, 2024
5bf2bdd
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 14, 2024
9a1edd7
feat: implement starting continuous profiling from launch
armcknight Apr 9, 2024
d46cc59
wip: test case description for all option combinations
armcknight Apr 9, 2024
3d9a8c6
WIP: bdd test all option combinations
armcknight Apr 10, 2024
b440e9e
WIP: writing app launch profiling option tests
armcknight May 5, 2024
4ad43d1
got tests working
armcknight May 5, 2024
4981b60
condense declarations
armcknight May 5, 2024
f893978
express the same app launch options combo test in another way
armcknight May 5, 2024
a7088fa
add combinations with profilesSampler
armcknight May 5, 2024
fec8ee7
clean up
armcknight May 5, 2024
a33651c
rewrite last old app launch objc test in the new swift class
armcknight May 5, 2024
197722b
dont sample anything related to continuous profiling
armcknight May 9, 2024
ac102a4
wip writing a test for launch profile configuration
armcknight May 14, 2024
39208f4
add more tests to cover launch profiling code
armcknight May 15, 2024
de2a193
fix a couple bugs in launch profiling state mgmt, and get all tests p…
armcknight May 15, 2024
544890d
fix tvos build
armcknight May 15, 2024
ccf77d8
fix build issue
armcknight May 15, 2024
8b6a180
pr feedback
armcknight May 15, 2024
33c28e0
fix build
armcknight May 15, 2024
12f0397
clean up launch profile state after each test
armcknight May 15, 2024
7eff3a3
add test to ensure trace profiler is nil after stopping launch profiler
armcknight May 15, 2024
596b88b
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 16, 2024
94b52be
fixes after merge
armcknight May 16, 2024
cf9a6bd
some new instances that needed renaming
armcknight May 16, 2024
86b8815
remove comment after fixing the test situation
armcknight May 16, 2024
95521a4
Merge branch 'armcknight/feat/3555-continuous-profiling/5-implementat…
armcknight May 16, 2024
b605236
Merge remote-tracking branch 'origin/main' into armcknight/feat/3555-…
armcknight May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 21 additions & 19 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@
7DC8310A2398283C0043DD9A /* SentryCrashIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DC831082398283C0043DD9A /* SentryCrashIntegration.h */; };
7DC8310C2398283C0043DD9A /* SentryCrashIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DC831092398283C0043DD9A /* SentryCrashIntegration.m */; };
840A11122B61E27500650D02 /* SentrySamplerDecision.m in Sources */ = {isa = PBXBuildFile; fileRef = 840A11102B61E27500650D02 /* SentrySamplerDecision.m */; };
840A11132B61FE5800650D02 /* SentryAppLaunchProfilingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 840A11092B5F47F700650D02 /* SentryAppLaunchProfilingTests.m */; };
84281C432A578E5600EE88F2 /* SentryProfilerState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84281C422A578E5600EE88F2 /* SentryProfilerState.mm */; };
84281C462A57905700EE88F2 /* SentrySample.h in Headers */ = {isa = PBXBuildFile; fileRef = 84281C442A57905700EE88F2 /* SentrySample.h */; };
84281C472A57905700EE88F2 /* SentrySample.m in Sources */ = {isa = PBXBuildFile; fileRef = 84281C452A57905700EE88F2 /* SentrySample.m */; };
Expand All @@ -645,7 +644,7 @@
8431EFD329B27B1100D8DC56 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 630C01951EC341D600C52CEF /* Resources */; };
8431EFDC29B27B5300D8DC56 /* SentryProfilerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03F9D37B2819A65C00602916 /* SentryProfilerTests.mm */; };
8431EFDD29B27B5300D8DC56 /* SentrySamplingProfilerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73CB27D575B3005EEB11 /* SentrySamplingProfilerTests.mm */; };
8431EFDE29B27B5300D8DC56 /* SentryLegacyProfilerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419C0C328C1889D001C8259 /* SentryLegacyProfilerTests.swift */; };
8431EFDE29B27B5300D8DC56 /* SentryTraceProfilerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */; };
8431EFDF29B27B5300D8DC56 /* SentryThreadHandleTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73C927D57398005EEB11 /* SentryThreadHandleTests.mm */; };
8431EFE029B27B5300D8DC56 /* SentryBacktraceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73C727D56757005EEB11 /* SentryBacktraceTests.mm */; };
8431EFE129B27B5300D8DC56 /* SentryThreadMetadataCacheTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 035E73CD27D5790A005EEB11 /* SentryThreadMetadataCacheTests.mm */; };
Expand Down Expand Up @@ -681,8 +680,9 @@
848A451D2BBF9504006AAAEC /* SentryProfilerTestHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 848A451C2BBF9504006AAAEC /* SentryProfilerTestHelpers.m */; };
848A451E2BBF9504006AAAEC /* SentryProfilerTestHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 848A451B2BBF9504006AAAEC /* SentryProfilerTestHelpers.h */; };
849AC40029E0C1FF00889C16 /* SentryFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849AC3FF29E0C1FF00889C16 /* SentryFormatterTests.swift */; };
84A305572BC9EF8C00D84283 /* SentryLegacyProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A305552BC9EF8C00D84283 /* SentryLegacyProfiler.h */; };
84A305582BC9EF8C00D84283 /* SentryLegacyProfiler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84A305562BC9EF8C00D84283 /* SentryLegacyProfiler.mm */; };
84A305492BC7328400D84283 /* SentryAppLaunchProfilingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A305472BC72A0A00D84283 /* SentryAppLaunchProfilingTests.swift */; };
84A305572BC9EF8C00D84283 /* SentryTraceProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A305552BC9EF8C00D84283 /* SentryTraceProfiler.h */; };
84A305582BC9EF8C00D84283 /* SentryTraceProfiler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84A305562BC9EF8C00D84283 /* SentryTraceProfiler.mm */; };
84A5D75B29D5170700388BFA /* TimeInterval+Sentry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A5D75A29D5170700388BFA /* TimeInterval+Sentry.swift */; };
84A8891C28DBD28900C51DFD /* SentryDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A8891A28DBD28900C51DFD /* SentryDevice.h */; };
84A8891D28DBD28900C51DFD /* SentryDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84A8891B28DBD28900C51DFD /* SentryDevice.mm */; };
Expand Down Expand Up @@ -1644,7 +1644,6 @@
7DC27EC423997EB7006998B5 /* SentryAutoBreadcrumbTrackingIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryAutoBreadcrumbTrackingIntegration.m; sourceTree = "<group>"; };
7DC831082398283C0043DD9A /* SentryCrashIntegration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashIntegration.h; path = include/SentryCrashIntegration.h; sourceTree = "<group>"; };
7DC831092398283C0043DD9A /* SentryCrashIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashIntegration.m; sourceTree = "<group>"; };
840A11092B5F47F700650D02 /* SentryAppLaunchProfilingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryAppLaunchProfilingTests.m; sourceTree = "<group>"; };
840A11102B61E27500650D02 /* SentrySamplerDecision.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySamplerDecision.m; sourceTree = "<group>"; };
840A11142B62041600650D02 /* SentryLaunchProfiling+Tests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryLaunchProfiling+Tests.h"; sourceTree = "<group>"; };
840B7EEA2BBF2ABA008B8120 /* .slather.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .slather.yml; sourceTree = "<group>"; };
Expand All @@ -1654,7 +1653,7 @@
840B7EEF2BBF2B2B008B8120 /* .spi.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .spi.yml; sourceTree = "<group>"; };
840B7EF02BBF2B5F008B8120 /* MIGRATION.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = MIGRATION.md; sourceTree = "<group>"; };
840B7EF22BBF83DF008B8120 /* SentryProfiler+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryProfiler+Private.h"; path = "Sources/Sentry/include/SentryProfiler+Private.h"; sourceTree = SOURCE_ROOT; };
8419C0C328C1889D001C8259 /* SentryLegacyProfilerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryLegacyProfilerTests.swift; sourceTree = "<group>"; };
8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTraceProfilerTests.swift; sourceTree = "<group>"; };
84281C422A578E5600EE88F2 /* SentryProfilerState.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryProfilerState.mm; sourceTree = "<group>"; };
84281C442A57905700EE88F2 /* SentrySample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySample.h; path = ../include/SentrySample.h; sourceTree = "<group>"; };
84281C452A57905700EE88F2 /* SentrySample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySample.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1721,9 +1720,10 @@
849472822971C2CD002603DE /* SentryNSProcessInfoWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSProcessInfoWrapperTests.swift; sourceTree = "<group>"; };
849472842971C41A002603DE /* SentryNSTimerFactoryTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSTimerFactoryTest.swift; sourceTree = "<group>"; };
849AC3FF29E0C1FF00889C16 /* SentryFormatterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryFormatterTests.swift; sourceTree = "<group>"; };
84A305552BC9EF8C00D84283 /* SentryLegacyProfiler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryLegacyProfiler.h; path = ../include/SentryLegacyProfiler.h; sourceTree = "<group>"; };
84A305562BC9EF8C00D84283 /* SentryLegacyProfiler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryLegacyProfiler.mm; sourceTree = "<group>"; };
84A305592BC9FD1600D84283 /* SentryLegacyProfiler+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryLegacyProfiler+Test.h"; sourceTree = "<group>"; };
84A305472BC72A0A00D84283 /* SentryAppLaunchProfilingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryAppLaunchProfilingTests.swift; sourceTree = "<group>"; };
84A305552BC9EF8C00D84283 /* SentryTraceProfiler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryTraceProfiler.h; path = ../include/SentryTraceProfiler.h; sourceTree = "<group>"; };
84A305562BC9EF8C00D84283 /* SentryTraceProfiler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryTraceProfiler.mm; sourceTree = "<group>"; };
84A305592BC9FD1600D84283 /* SentryTraceProfiler+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryTraceProfiler+Test.h"; sourceTree = "<group>"; };
84A5D75A29D5170700388BFA /* TimeInterval+Sentry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TimeInterval+Sentry.swift"; sourceTree = "<group>"; };
84A8891A28DBD28900C51DFD /* SentryDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryDevice.h; path = include/SentryDevice.h; sourceTree = "<group>"; };
84A8891B28DBD28900C51DFD /* SentryDevice.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryDevice.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2456,11 +2456,10 @@
62872B602BA1B84400A4FA7D /* Swift */,
7B3878E92490D90400EBDEA2 /* SentryClient+TestInit.h */,
D8BC83BA2AFCF08C00A662B7 /* SentryUIApplication+Private.h */,
84A305592BC9FD1600D84283 /* SentryLegacyProfiler+Test.h */,
84A305592BC9FD1600D84283 /* SentryTraceProfiler+Test.h */,
7B569DFE2590EEF600B653FC /* SentryScope+Equality.h */,
7B569E052590F04700B653FC /* SentryScope+Properties.h */,
7B9421C4260CA393001F9349 /* SentrySDK+Tests.h */,
840A11142B62041600650D02 /* SentryLaunchProfiling+Tests.h */,
8431D4572BE175A1009EAEC1 /* SentryContinuousProfiler+Test.h */,
639889D21EDF06C100EA7442 /* SentryTests-Bridging-Header.h */,
63B819131EC352A7002FDF4C /* SentryInterfacesTests.m */,
Expand Down Expand Up @@ -3365,8 +3364,8 @@
840B7EF22BBF83DF008B8120 /* SentryProfiler+Private.h */,
8431D4612BE1B534009EAEC1 /* SentryProfilerDefines.h */,
03F84D2B27DD4191008FE43F /* SentryProfiler.mm */,
84A305552BC9EF8C00D84283 /* SentryLegacyProfiler.h */,
84A305562BC9EF8C00D84283 /* SentryLegacyProfiler.mm */,
84A305552BC9EF8C00D84283 /* SentryTraceProfiler.h */,
84A305562BC9EF8C00D84283 /* SentryTraceProfiler.mm */,
848A451B2BBF9504006AAAEC /* SentryProfilerTestHelpers.h */,
848A451C2BBF9504006AAAEC /* SentryProfilerTestHelpers.m */,
848A45172BBF8D33006AAAEC /* SentryContinuousProfiler.h */,
Expand Down Expand Up @@ -3409,8 +3408,8 @@
035E73CB27D575B3005EEB11 /* SentrySamplingProfilerTests.mm */,
035E73CD27D5790A005EEB11 /* SentryThreadMetadataCacheTests.mm */,
03F9D37B2819A65C00602916 /* SentryProfilerTests.mm */,
840A11092B5F47F700650D02 /* SentryAppLaunchProfilingTests.m */,
8419C0C328C1889D001C8259 /* SentryLegacyProfilerTests.swift */,
84A305472BC72A0A00D84283 /* SentryAppLaunchProfilingTests.m */,
8419C0C328C1889D001C8259 /* SentryTraceProfilerTests.swift */,
8446F5182BE172290040D57E /* SentryContinuousProfilerTests.swift */,
8431D4522BE1741E009EAEC1 /* SentryProfileTestFixture.swift */,
);
Expand All @@ -3431,6 +3430,7 @@
8431F00B29B284F200D8DC56 /* SentryTestUtils */ = {
isa = PBXGroup;
children = (
840A11142B62041600650D02 /* SentryLaunchProfiling+Tests.h */,
7BD47B4C268F0B080076A663 /* ClearTestState.swift */,
7B18DE4328D9F8F6004845C6 /* TestNSNotificationCenterWrapper.swift */,
84AC61D829F7643B009EEF61 /* TestDispatchFactory.swift */,
Expand Down Expand Up @@ -3998,7 +3998,7 @@
62A456E12B03704A003F19A1 /* SentryUIEventTrackerMode.h in Headers */,
03F84D2327DD414C008FE43F /* SentryThreadHandle.hpp in Headers */,
7B6C5EE0264E8E050010D138 /* SentryFramesTracker.h in Headers */,
84A305572BC9EF8C00D84283 /* SentryLegacyProfiler.h in Headers */,
84A305572BC9EF8C00D84283 /* SentryTraceProfiler.h in Headers */,
63FE715720DA4C1100CDBAE8 /* SentryCrashThread.h in Headers */,
7BF9EF862722D10600B5BBEF /* SentryTestObjCRuntimeWrapper.h in Headers */,
15360CD2243277A000112302 /* SentrySessionTracker.h in Headers */,
Expand Down Expand Up @@ -4228,6 +4228,8 @@
8431EED229B27B1100D8DC56 /* PBXTargetDependency */,
);
name = SentryProfilerTests;
packageProductDependencies = (
);
productName = "Tests-iOS";
productReference = 8431EFD929B27B1100D8DC56 /* SentryProfilerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
Expand Down Expand Up @@ -4503,7 +4505,7 @@
63FE70E120DA4C1000CDBAE8 /* SentryCrashMonitor_CPPException.cpp in Sources */,
D8F6A2472885512100320515 /* SentryPredicateDescriptor.m in Sources */,
A839D89A24864BA8003B7AFD /* SentrySystemEventBreadcrumbs.m in Sources */,
84A305582BC9EF8C00D84283 /* SentryLegacyProfiler.mm in Sources */,
84A305582BC9EF8C00D84283 /* SentryTraceProfiler.mm in Sources */,
7D082B8323C628790029866B /* SentryMeta.m in Sources */,
D8CAC02F2BA0663E00E38F34 /* SentryVideoInfo.swift in Sources */,
63FE710720DA4C1000CDBAE8 /* SentryCrashStackCursor_SelfThread.m in Sources */,
Expand Down Expand Up @@ -4961,10 +4963,10 @@
8431EFE129B27B5300D8DC56 /* SentryThreadMetadataCacheTests.mm in Sources */,
8431EFE029B27B5300D8DC56 /* SentryBacktraceTests.mm in Sources */,
8431EFDF29B27B5300D8DC56 /* SentryThreadHandleTests.mm in Sources */,
840A11132B61FE5800650D02 /* SentryAppLaunchProfilingTests.m in Sources */,
8431EFE829B27BAD00D8DC56 /* SentrySystemWrapperTests.swift in Sources */,
84A305492BC7328400D84283 /* SentryAppLaunchProfilingTests.swift in Sources */,
8431EFE529B27BAD00D8DC56 /* SentryNSProcessInfoWrapperTests.swift in Sources */,
8431EFDE29B27B5300D8DC56 /* SentryLegacyProfilerTests.swift in Sources */,
8431EFDE29B27B5300D8DC56 /* SentryTraceProfilerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
5 changes: 3 additions & 2 deletions SentryTestUtils/ClearTestState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ class TestCleanup: NSObject {
SentryTracer.resetAppStartMeasurementRead()

#if os(iOS) || os(macOS) || targetEnvironment(macCatalyst)
SentryLegacyProfiler.getCurrentProfiler()?.stop(for: SentryProfilerTruncationReason.normal)
SentryLegacyProfiler.resetConcurrencyTracking()
SentryTraceProfiler.getCurrentProfiler()?.stop(for: SentryProfilerTruncationReason.normal)
SentryTraceProfiler.resetConcurrencyTracking()
SentryContinuousProfiler.stop()
#endif // os(iOS) || os(macOS) || targetEnvironment(macCatalyst)

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ SENTRY_EXTERN NSString *const kSentryLaunchProfileConfigKeyProfilesSampleRate;

SentryLaunchProfileConfig sentry_shouldProfileNextLaunch(SentryOptions *options);

/**
* `sentry_shouldProfileNextLaunch` cannot be exposed to Swift tests because its return type is not
* expressible in Swift. This wraps it and only returns the `BOOL shouldProfile` value in the
* struct.
*/
BOOL sentry_willProfileNextLaunch(SentryOptions *options);

SentryTransactionContext *sentry_context(NSNumber *tracesRate);

NS_ASSUME_NONNULL_END
Expand Down
3 changes: 2 additions & 1 deletion SentryTestUtils/SentryTestUtils-ObjC-BridgingHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#import "SentryProfilingConditionals.h"

#if SENTRY_TARGET_PROFILING_SUPPORTED
# import "SentryLegacyProfiler+Test.h"
# import "SentryContinuousProfiler.h"
# import "SentryProfiler+Private.h"
# import "SentryTraceProfiler+Test.h"
#endif // SENTRY_TARGET_PROFILING_SUPPORTED

#import "PrivateSentrySDKOnly.h"
Expand Down
4 changes: 2 additions & 2 deletions Sources/Sentry/PrivateSentrySDKOnly.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#import <SentryUser.h>

#if SENTRY_TARGET_PROFILING_SUPPORTED
# import "SentryLegacyProfiler.h"
# import "SentryProfiledTracerConcurrency.h"
# import "SentryProfilerSerialization.h"
# import "SentryTraceProfiler.h"
#endif // SENTRY_TARGET_PROFILING_SUPPORTED

@implementation PrivateSentrySDKOnly
Expand Down Expand Up @@ -134,7 +134,7 @@ + (NSDictionary *)getExtraContext
#if SENTRY_TARGET_PROFILING_SUPPORTED
+ (uint64_t)startProfilerForTrace:(SentryId *)traceId;
{
[SentryLegacyProfiler startWithTracer:traceId];
[SentryTraceProfiler startWithTracer:traceId];
return SentryDependencyContainer.sharedInstance.dateProvider.systemTime;
}

Expand Down
32 changes: 12 additions & 20 deletions Sources/Sentry/Profiling/SentryContinuousProfiler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,10 @@

namespace {
/** @warning: Must be used from a synchronized context. */
std::mutex _unsafe_gContinuousProfilerLock;
std::mutex _threadUnsafe_gContinuousProfilerLock;

/** @warning: Must be used from a synchronized context. */
SentryProfiler *_Nullable _unsafe_gContinuousCurrentProfiler;

/** @warning: Must be called from a synchronized context. */
BOOL
_unsafe_isRunning(void)
{
return _unsafe_gContinuousCurrentProfiler != nil &&
[_unsafe_gContinuousCurrentProfiler isRunning];
}
SentryProfiler *_Nullable _threadUnsafe_gContinuousCurrentProfiler;
} // namespace

@implementation SentryContinuousProfiler
Expand All @@ -30,44 +22,44 @@ @implementation SentryContinuousProfiler

+ (void)start
{
std::lock_guard<std::mutex> l(_unsafe_gContinuousProfilerLock);
std::lock_guard<std::mutex> l(_threadUnsafe_gContinuousProfilerLock);

if (_unsafe_isRunning()) {
if ([_threadUnsafe_gContinuousCurrentProfiler isRunning]) {
SENTRY_LOG_DEBUG(@"A continuous profiler is already running.");
return;
}

if (!(_unsafe_gContinuousCurrentProfiler =
if (!(_threadUnsafe_gContinuousCurrentProfiler =
[[SentryProfiler alloc] initWithMode:SentryProfilerModeContinuous])) {
SENTRY_LOG_WARN(@"Continuous profiler was unable to be initialized.");
}
}

+ (BOOL)isCurrentlyProfiling
{
std::lock_guard<std::mutex> l(_unsafe_gContinuousProfilerLock);
return _unsafe_isRunning();
std::lock_guard<std::mutex> l(_threadUnsafe_gContinuousProfilerLock);
return [_threadUnsafe_gContinuousCurrentProfiler isRunning];
}

+ (void)stop
{
std::lock_guard<std::mutex> l(_unsafe_gContinuousProfilerLock);
std::lock_guard<std::mutex> l(_threadUnsafe_gContinuousProfilerLock);

if (!_unsafe_isRunning()) {
if (![_threadUnsafe_gContinuousCurrentProfiler isRunning]) {
SENTRY_LOG_DEBUG(@"No continuous profiler is currently running.");
return;
}

[_unsafe_gContinuousCurrentProfiler stopForReason:SentryProfilerTruncationReasonNormal];
[_threadUnsafe_gContinuousCurrentProfiler stopForReason:SentryProfilerTruncationReasonNormal];
}

# pragma mark - Testing

# if defined(TEST) || defined(TESTCI) || defined(DEBUG)
+ (nullable SentryProfiler *)profiler
{
std::lock_guard<std::mutex> l(_unsafe_gContinuousProfilerLock);
return _unsafe_gContinuousCurrentProfiler;
std::lock_guard<std::mutex> l(_threadUnsafe_gContinuousProfilerLock);
return _threadUnsafe_gContinuousCurrentProfiler;
}
# endif // defined(TEST) || defined(TESTCI) || defined(DEBUG)

Expand Down