-
Notifications
You must be signed in to change notification settings - Fork 81
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
OS logging integrated with trace
for iOS
#1140
Conversation
…into es/ios-traces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need multiple copies for each linux/win arch? It should be just one like nonIosNativeMain
or just linuxMain
. Additional gradle setup is required of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@ExperimentalComposeApi | ||
fun enableTraceOSLog() { | ||
if (traceImpl == null) { | ||
traceImpl = CMPOSLogger(categoryName = "androidx.compose.runtime") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it should work on all Apple platforms - macOS, tvOS, watchOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this class is implemented in UIKitUtils framework, which is built for iOS now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same - you should combine js and wasmJs into one file/sourceset - webMain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
return trace("BaseComposeScene:render") { | ||
postponeInvalidation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add trace
inside postponeInvalidation
and pass tag as parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added trace, but didn't get what you mean under pass tag as a parameter
, can you elaborate?
@@ -171,7 +172,7 @@ private class SingleLayerComposeSceneImpl( | |||
mainOwner.measureAndLayout() | |||
} | |||
|
|||
override fun draw(canvas: Canvas) { | |||
override fun draw(canvas: Canvas) = trace("SingleLayerComposeSceneImpl:draw") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it to owner, no need to log "SingleLayerComposeSceneImpl"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -75,7 +75,7 @@ internal abstract class BaseComposeScene( | |||
private set | |||
|
|||
private var isInvalidationDisabled = false | |||
private inline fun <T> postponeInvalidation(crossinline block: () -> T): T { | |||
private inline fun <T> postponeInvalidation(crossinline block: () -> T): T = trace("BaseComposeScene:postponeInvalidation") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's called from multiple places. Let's add label for trace in parameters of postponeInvalidation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
- (CMPOSLoggerInterval *)beginIntervalNamed:(NSString *)name { | ||
CMPOSLoggerInterval *interval; | ||
|
||
[_poolLock lock]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're adding unconditional mutex lock in many critical places. It will probably impact performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it, it's only around 20 calls per frame and critical section is very short and not congested due to almost all current calls begin on the same thread. Moreover, this logic is performed only if logging was enabled in the first place. It's not supposed to be used in production env.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from unconditional adding mutexes, LGTM.
Should be reviewed by someone else too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than "runtime" depending on "ui" - looks good to me
compose/ui/ui-uikit/src/uikitMain/objc/CMPUIKitUtils/CMPUIKitUtils/CMPOSLoggerInterval.m
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/BaseComposeScene.skiko.kt
Outdated
Show resolved
Hide resolved
…aseComposeScene.skiko.kt Co-authored-by: Igor Demin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also remove it from the PR description
Proposed Changes
Integrate iOS logging with traces API in
ui:util
modules.Additional traces in
ui
inskikoMain
source set.Testing
Test: N/A
API Change
API added to iOS source set