-
-
Notifications
You must be signed in to change notification settings - Fork 380
ref: Convert SentrySample to Swift
#7405
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
Changes from 3 commits
c4db9d0
38deaea
a292c47
e017d30
bb92b9a
f33114d
31a5e45
4f67dea
4d199e1
21318ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #if defined(DEBUG) | ||
|
|
||
| # import "SentryProfileLoggerHelper.h" | ||
|
Check failure on line 3 in Sources/Sentry/Profiling/SentryProfileDebugLoggerHelper.m
|
||
| # import "SentrySwift.h" | ||
|
|
||
| @implementation SentryProfileLoggerHelper | ||
|
|
||
| + (uint64_t)getAbsoluteTimeStampFromSample:(SentrySample *)sample | ||
| { | ||
| return sample.absoluteTimestamp; | ||
| } | ||
|
|
||
| @end | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #import "SentryProfilerSampleCreation.h" | ||
| #if SENTRY_TARGET_PROFILING_SUPPORTED | ||
| # import "SentryInternalDefines.h" | ||
| # import "SentrySwift.h" | ||
|
|
||
| SentrySample * | ||
| sentry_profilerSampleWithStack(NSArray<NSNumber *> *stack, uint64_t absoluteTimestamp, | ||
| NSTimeInterval absoluteNSDateInterval, uint64_t threadID, SentryProfilerMutableState *state) | ||
| { | ||
| SentrySample *sample = [[SentrySample alloc] init]; | ||
| sample.absoluteTimestamp = absoluteTimestamp; | ||
| sample.absoluteNSDateInterval = absoluteNSDateInterval; | ||
| sample.threadID = threadID; | ||
|
|
||
| NSString *stackKey = [stack componentsJoinedByString:@"|"]; | ||
| NSNumber *_Nullable stackIndex = state.stackIndexLookup[stackKey]; | ||
| if (stackIndex) { | ||
| sample.stackIndex = SENTRY_UNWRAP_NULLABLE(NSNumber, stackIndex); | ||
| } else { | ||
| NSNumber *nextStackIndex = @(state.stacks.count); | ||
| sample.stackIndex = nextStackIndex; | ||
| state.stackIndexLookup[stackKey] = nextStackIndex; | ||
| [state.stacks addObject:stack]; | ||
| } | ||
|
|
||
| return sample; | ||
| } | ||
|
|
||
| #endif // SENTRY_TARGET_PROFILING_SUPPORTED |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #if defined(DEBUG) | ||
|
|
||
| @class SentrySample; | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface SentryProfileLoggerHelper : NSObject | ||
|
|
||
| + (uint64_t)getAbsoluteTimeStampFromSample:(SentrySample *)sample; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
|
|
||
| #endif defined(DEBUG) | ||
cursor[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #import "SentryProfilingConditionals.h" | ||
|
|
||
| #if SENTRY_TARGET_PROFILING_SUPPORTED | ||
|
|
||
| # import "SentryProfilerState.h" | ||
| # import <Foundation/Foundation.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| /** | ||
| * Creates a profiler sample from a stack of frame indices and appends the stack to state if new. | ||
| * Used so that SentrySample (Swift) is only referenced from Objective-C, not from Objective-C++. | ||
| */ | ||
| # if defined(__cplusplus) | ||
| extern "C" { | ||
| # endif | ||
| SentrySample *sentry_profilerSampleWithStack(NSArray<NSNumber *> *stack, uint64_t absoluteTimestamp, | ||
| NSTimeInterval absoluteNSDateInterval, uint64_t threadID, SentryProfilerMutableState *state); | ||
| # if defined(__cplusplus) | ||
| } | ||
| # endif | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
|
|
||
| #endif // SENTRY_TARGET_PROFILING_SUPPORTED |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import Foundation | ||
|
|
||
| // swiftlint:disable missing_docs | ||
|
|
||
| /// A storage class to hold the data associated with a single profiler sample. | ||
| @objcMembers | ||
| @_spi(Private) public final class SentrySample: NSObject { | ||
| public var absoluteTimestamp: UInt64 = 0 | ||
| public var absoluteNSDateInterval: TimeInterval = 0 | ||
| public var stackIndex: NSNumber = NSNumber(value: 0) | ||
| public var threadID: UInt64 = 0 | ||
| public var queueAddress: String? | ||
| } | ||
|
|
||
| // swiftlint:enable missing_docs |
Uh oh!
There was an error while loading. Please reload this page.