Skip to content

Commit

Permalink
Merge c819702 into e3ffd1c
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight authored May 3, 2024
2 parents e3ffd1c + c819702 commit d9b4c67
Show file tree
Hide file tree
Showing 22 changed files with 460 additions and 152 deletions.
8 changes: 4 additions & 4 deletions Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.25.0-alpha.0;
MARKETING_VERSION = "8.25.0-alpha.0";
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.sample.iOS-Swift";
Expand Down Expand Up @@ -1277,7 +1277,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.25.0-alpha.0;
MARKETING_VERSION = "8.25.0-alpha.0";
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.sample.iOS-Swift";
Expand Down Expand Up @@ -1926,7 +1926,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.25.0-alpha.0;
MARKETING_VERSION = "8.25.0-alpha.0";
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift.Clip";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.sample.iOS-Swift.Clip";
Expand Down Expand Up @@ -1961,7 +1961,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 8.25.0-alpha.0;
MARKETING_VERSION = "8.25.0-alpha.0";
PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift.Clip";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.sample.iOS-Swift.Clip";
Expand Down
2 changes: 2 additions & 0 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,7 @@
84302A7F2B5767A50027A629 /* SentryLaunchProfiling.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryLaunchProfiling.m; sourceTree = "<group>"; };
8431D4522BE1741E009EAEC1 /* SentryProfileTestFixture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryProfileTestFixture.swift; sourceTree = "<group>"; };
8431D4572BE175A1009EAEC1 /* SentryContinuousProfiler+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryContinuousProfiler+Test.h"; sourceTree = "<group>"; };
8431D4612BE1B534009EAEC1 /* SentryProfilerDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryProfilerDefines.h; sourceTree = "<group>"; };
8431EE5A29ADB8EA00D8DC56 /* SentryTimeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryTimeTests.m; sourceTree = "<group>"; };
8431EFD929B27B1100D8DC56 /* SentryProfilerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SentryProfilerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8431F00A29B284F200D8DC56 /* libSentryTestUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSentryTestUtils.a; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -3342,6 +3343,7 @@
84AF45A429A7FFA500FBB177 /* SentryProfiledTracerConcurrency.h */,
84AF45A529A7FFA500FBB177 /* SentryProfiledTracerConcurrency.mm */,
840B7EF22BBF83DF008B8120 /* SentryProfiler+Private.h */,
8431D4612BE1B534009EAEC1 /* SentryProfilerDefines.h */,
03F84D2B27DD4191008FE43F /* SentryProfiler.mm */,
84A305552BC9EF8C00D84283 /* SentryLegacyProfiler.h */,
84A305562BC9EF8C00D84283 /* SentryLegacyProfiler.mm */,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/PrivateSentrySDKOnly.mm
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ + (uint64_t)startProfilerForTrace:(SentryId *)traceId;
and:(uint64_t)endSystemTime
forTrace:(SentryId *)traceId;
{
NSMutableDictionary<NSString *, id> *payload = sentry_collectProfileData(
NSMutableDictionary<NSString *, id> *payload = sentry_collectProfileDataHybridSDK(
startSystemTime, endSystemTime, traceId, [SentrySDK currentHub]);

if (payload != nil) {
Expand Down
1 change: 1 addition & 0 deletions Sources/Sentry/Profiling/SentryLegacyProfiler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ + (BOOL)startWithTracer:(SentryId *)traceId
}

sentry_trackProfilerForTracer(_unsafe_gLegacyProfiler, traceId);

return YES;
}

Expand Down
52 changes: 52 additions & 0 deletions Sources/Sentry/Profiling/SentryProfilerDefines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#import "SentryProfilingConditionals.h"

#if SENTRY_TARGET_PROFILING_SUPPORTED

# import "SentryDefines.h"
# import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, SentryProfilerMode) {
SentryProfilerModeLegacy,
SentryProfilerModeContinuous,
};

typedef NS_ENUM(NSUInteger, SentryProfilerTruncationReason) {
SentryProfilerTruncationReasonNormal,
SentryProfilerTruncationReasonTimeout,
SentryProfilerTruncationReasonAppMovedToBackground,
};

NS_ASSUME_NONNULL_BEGIN

SENTRY_EXTERN NSString *const kSentryMetricProfilerSerializationKeyMemoryFootprint;
SENTRY_EXTERN NSString *const kSentryMetricProfilerSerializationKeyCPUUsage;
SENTRY_EXTERN NSString *const kSentryMetricProfilerSerializationKeyCPUEnergyUsage;

SENTRY_EXTERN NSString *const kSentryMetricProfilerSerializationUnitBytes;
SENTRY_EXTERN NSString *const kSentryMetricProfilerSerializationUnitPercentage;
SENTRY_EXTERN NSString *const kSentryMetricProfilerSerializationUnitNanoJoules;

// The next two types are technically the same as far as the type system is concerned, but they
// actually contain different mixes of value types, so define them separately. If they ever change,
// the usage sites already specify which type each should be.

/**
* A structure to hold a single metric reading and the time it was taken, as a dictionary with keyed
* values either of type @c NSNumber for the reading value, or @c NSString for the timestamp (we
* just encode @c uint64_t as a string since JSON doesn't officially support it).
* @note: For continuous profiling, this will only contain @c NSNumber values because we will store
* timestamps as milliseconds, so we don't have to send them to the backend as @c NSString .
*/
typedef NSDictionary<NSString *, id /* <NSNumber, NSString> */> SentrySerializedMetricReading;

/**
* A structure containing the timeseries of values for a particular metric type, as a dictionary
* with keyed values either of type @c NSString, for unit names, or an array of metrics entries
* containing the values and timestamps in the above typedef.
*/
typedef NSDictionary<NSString *, id /* <NSString, NSArray<SentrySerializedMetricEntry *>> */>
SentrySerializedMetricEntry;

NS_ASSUME_NONNULL_END

#endif // SENTRY_TARGET_PROFILING_SUPPORTED
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SENTRY_EXTERN NSString *sentry_profilerTruncationReasonName(SentryProfilerTrunca
* will have different structures/objects available, these parameters are the common elements
* needed to construct the payload dictionary.
*/
SENTRY_EXTERN NSMutableDictionary<NSString *, id> *sentry_serializedProfileData(
SENTRY_EXTERN NSMutableDictionary<NSString *, id> *sentry_serializedProfileDataLegacy(
NSDictionary<NSString *, id> *profileData, uint64_t startSystemTime, uint64_t endSystemTime,
NSString *truncationReason, NSDictionary<NSString *, id> *serializedMetrics,
NSArray<SentryDebugMeta *> *debugMeta, SentryHub *hub
Expand Down
Loading

0 comments on commit d9b4c67

Please sign in to comment.