Skip to content

Commit

Permalink
add and update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
armcknight committed Feb 21, 2023
1 parent 643214c commit e883d69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Sentry/SentryProfiler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ + (SentryEnvelopeItem *)createProfilingEnvelopeItemForTransaction:(SentryTransac
NSMutableDictionary<NSString *, id> *payload = [_gCurrentProfiler->_profileData mutableCopy];

NSArray *samples = ((NSArray *)payload[@"profile"][@"samples"]).mutableCopy;

// We need at least two samples to be able to draw a stack frame for any given function: one
// sample for the start of the frame and another for the end. Otherwise we would only have a
// stack frame with 0 duration, which wouldn't make sense.
if ([samples count] < 2) {
SENTRY_LOG_DEBUG(@"Not enough samples in profile");
return nil;
Expand Down Expand Up @@ -760,7 +764,7 @@ + (void)serializeBasicProfileInfo:(NSMutableDictionary<NSString *, id> *)profile
profile[@"release"] = _gCurrentProfiler->_hub.getClient.options.releaseName;
}

/** @return serialize info from all transactions that occurred while profiler was running */
/** @return serialize info corresponding to the specified transaction. */
+ (NSDictionary *)serializeInfoForTransaction:(SentryTransaction *)transaction
profileDuration:(uint64_t)profileDuration
{
Expand Down

0 comments on commit e883d69

Please sign in to comment.