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

ASSignpost: Add support for the os_signpost API, fixes #1501

Merged
merged 4 commits into from
May 9, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Commentary
Adlai-Holler committed May 8, 2019

Verified

This commit was signed with the committer’s verified signature. The key has expired.
mz2 Matias Piipari
commit de78560599557e81cfd89083311c8567a1d3f7fd
8 changes: 4 additions & 4 deletions Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
@@ -1110,12 +1110,12 @@ - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
as_activity_scope_verbose(as_activity_create("Calculate node layout", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT));
as_log_verbose(ASLayoutLog(), "Calculating layout for %@ sizeRange %@", self, NSStringFromASSizeRange(constrainedSize));

#if AS_KDEBUG_ENABLE
#if AS_SIGNPOST_ENABLE
// We only want one calculateLayout signpost interval per thread.
// Currently there is no fallback for profiling i386, since it's not useful.
static _Thread_local NSInteger tls_callDepth;
if (tls_callDepth++ == 0) {
ASSignpostStart(ASSignpostCalculateLayout);
ASSignpostStart(CalculateLayout, self, "%@", ASObjectDescriptionMakeTiny(self));
}
#endif

@@ -1124,9 +1124,9 @@ - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
ASLayout *result = [self calculateLayoutThatFits:resolvedRange];
as_log_verbose(ASLayoutLog(), "Calculated layout %@", result);

#if AS_KDEBUG_ENABLE
#if AS_SIGNPOST_ENABLE
if (--tls_callDepth == 0) {
ASSignpostEnd(ASSignpostCalculateLayout);
ASSignpostEnd(CalculateLayout, self, "");
}
#endif

6 changes: 3 additions & 3 deletions Source/Private/ASInternalHelpers.mm
Original file line number Diff line number Diff line change
@@ -47,8 +47,8 @@ BOOL ASDefaultAllowsEdgeAntialiasing()
#if AS_SIGNPOST_ENABLE
void _ASInitializeSignpostObservers(void)
{
// Orientation changes. Unavailable on tvOS.
#if !TARGET_OS_TV
// Orientation changes.
[NSNotificationCenter.defaultCenter addObserverForName:UIApplicationWillChangeStatusBarOrientationNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
UIInterfaceOrientation orientation = (UIInterfaceOrientation)[note.userInfo[UIApplicationStatusBarOrientationUserInfoKey] integerValue];
ASSignpostStart(OrientationChange, (id)nil, "from %s", UIInterfaceOrientationIsPortrait(orientation) ? "portrait" : "landscape");
@@ -62,9 +62,9 @@ void _ASInitializeSignpostObservers(void)
}];
[CATransaction commit];
}];
#endif
#endif // TARGET_OS_TV
}
#endif
#endif // AS_SIGNPOST_ENABLE

void ASInitializeFrameworkMainThread(void)
{