From 4c2017faadfd45fad01b7b324e2e68726d84819b Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 6 Jul 2023 20:40:41 -0800 Subject: [PATCH] rename Profiling -> Profiler --- Sources/Sentry/Profiling/SentryProfilerState.mm | 12 ++++++------ Sources/Sentry/SentryProfiler.mm | 4 ++-- Sources/Sentry/include/SentryProfilerState.h | 6 +++--- Tests/SentryProfilerTests/SentryProfilerTests.mm | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Sources/Sentry/Profiling/SentryProfilerState.mm b/Sources/Sentry/Profiling/SentryProfilerState.mm index b80a3c307a0..10b47e40a64 100644 --- a/Sources/Sentry/Profiling/SentryProfilerState.mm +++ b/Sources/Sentry/Profiling/SentryProfilerState.mm @@ -33,7 +33,7 @@ return [symbolNSStr substringWithRange:[match rangeAtIndex:1]]; } -@implementation SentryProfilingMutableState +@implementation SentryProfilerMutableState - (instancetype)init { @@ -51,20 +51,20 @@ - (instancetype)init @end -@implementation SentryProfilingState { - SentryProfilingMutableState *_mutableState; +@implementation SentryProfilerState { + SentryProfilerMutableState *_mutableState; std::mutex _lock; } - (instancetype)init { if (self = [super init]) { - _mutableState = [[SentryProfilingMutableState alloc] init]; + _mutableState = [[SentryProfilerMutableState alloc] init]; } return self; } -- (void)mutate:(void (^)(SentryProfilingMutableState *))block +- (void)mutate:(void (^)(SentryProfilerMutableState *))block { NSParameterAssert(block); std::lock_guard l(_lock); @@ -73,7 +73,7 @@ - (void)mutate:(void (^)(SentryProfilingMutableState *))block - (void)appendBacktrace:(const Backtrace &)backtrace { - [self mutate:^(SentryProfilingMutableState *state) { + [self mutate:^(SentryProfilerMutableState *state) { const auto threadID = sentry_stringForUInt64(backtrace.threadMetadata.threadID); NSString *queueAddress = nil; diff --git a/Sources/Sentry/SentryProfiler.mm b/Sources/Sentry/SentryProfiler.mm index 8ca5a54c320..29cda4d439e 100644 --- a/Sources/Sentry/SentryProfiler.mm +++ b/Sources/Sentry/SentryProfiler.mm @@ -268,7 +268,7 @@ } @implementation SentryProfiler { - SentryProfilingState *_state; + SentryProfilerState *_state; std::shared_ptr _profiler; SentryMetricProfiler *_metricProfiler; SentryDebugImageProvider *_debugImageProvider; @@ -469,7 +469,7 @@ - (void)start SENTRY_LOG_DEBUG(@"Starting profiler."); - SentryProfilingState *const state = [[SentryProfilingState alloc] init]; + SentryProfilerState *const state = [[SentryProfilerState alloc] init]; _state = state; _profiler = std::make_shared( [state](auto &backtrace) { diff --git a/Sources/Sentry/include/SentryProfilerState.h b/Sources/Sentry/include/SentryProfilerState.h index c4c1eb62cca..d7c12972d33 100644 --- a/Sources/Sentry/include/SentryProfilerState.h +++ b/Sources/Sentry/include/SentryProfilerState.h @@ -21,7 +21,7 @@ NSString *parseBacktraceSymbolsFunctionName(const char *symbol); @class SentrySample; -@interface SentryProfilingMutableState : NSObject +@interface SentryProfilerMutableState : NSObject @property (nonatomic, strong, readonly) NSMutableArray *samples; @property (nonatomic, strong, readonly) NSMutableArray *> *stacks; @property (nonatomic, strong, readonly) NSMutableArray *> *frames; @@ -70,9 +70,9 @@ NSString *parseBacktraceSymbolsFunctionName(const char *symbol); NSMutableDictionary *stackIndexLookup; @end -@interface SentryProfilingState : NSObject +@interface SentryProfilerState : NSObject // All functions are safe to call from multiple threads concurrently -- (void)mutate:(void (^)(SentryProfilingMutableState *))block; +- (void)mutate:(void (^)(SentryProfilerMutableState *))block; - (void)appendBacktrace:(const sentry::profiling::Backtrace &)backtrace; - (NSDictionary *)copyProfilingData; @end diff --git a/Tests/SentryProfilerTests/SentryProfilerTests.mm b/Tests/SentryProfilerTests/SentryProfilerTests.mm index 2cc4005e3d5..1d898ed4f0f 100644 --- a/Tests/SentryProfilerTests/SentryProfilerTests.mm +++ b/Tests/SentryProfilerTests/SentryProfilerTests.mm @@ -62,7 +62,7 @@ - (void)testProfilerCanBeInitializedOffMainThread - (void)testProfilerMutationDuringSlicing { - SentryProfilingState *state = [[SentryProfilingState alloc] init]; + SentryProfilerState *state = [[SentryProfilerState alloc] init]; // generate a large timeseries of simulated data const auto threads = 5; @@ -119,7 +119,7 @@ - (void)testProfilerMutationDuringSlicing sliceExpectation.expectedFulfillmentCount = operations; void (^sliceBlock)(void) = ^(void) { - [state mutate:^(SentryProfilingMutableState *mutableState) { + [state mutate:^(SentryProfilerMutableState *mutableState) { __unused const auto slice = slicedProfileSamples(mutableState.samples, transaction); [sliceExpectation fulfill]; }]; @@ -148,7 +148,7 @@ - (void)testProfilerMutationDuringSlicing void (^mutateBlock)(void) = ^(void) { [state mutate:^( - __unused SentryProfilingMutableState *mutableState) { [mutateExpectation fulfill]; }]; + __unused SentryProfilerMutableState *mutableState) { [mutateExpectation fulfill]; }]; }; const auto sliceOperations = [[NSOperationQueue alloc] init]; // concurrent queue @@ -177,7 +177,7 @@ - (void)testProfilerMutationDuringSlicing */ - (void)testProfilerMutationDuringSerialization { - SentryProfilingState *state = [[SentryProfilingState alloc] init]; + SentryProfilerState *state = [[SentryProfilerState alloc] init]; // initialize the data structures with some simulated data { ThreadMetadata threadMetadata; @@ -289,7 +289,7 @@ - (void)testProfilerMutationDuringSerialization - (void)testProfilerPayload { - SentryProfilingState *state = [[SentryProfilingState alloc] init]; + SentryProfilerState *state = [[SentryProfilerState alloc] init]; // record an initial backtrace @@ -337,7 +337,7 @@ - (void)testProfilerPayload [state appendBacktrace:backtrace2]; - [state mutate:^(SentryProfilingMutableState *mutableState) { + [state mutate:^(SentryProfilerMutableState *mutableState) { XCTAssertEqual(mutableState.frames.count, 5UL); const auto expectedOrdered = @[ @"0x0000000000000123", @"0x0000000000000456", @"0x0000000000000789",