Diagnose performance issues with the Xcode Organizer
Analyze aggregated power and performance data from multiple versions of your app with just a few clicks. We'll introduce you to the latest version of the Xcode Organizer and its interactive interface, where you can easily compare and contrast app metrics across releases. Explore disk write diagnostics and scroll hitch metrics, and learn how you can use these to offer better performance, reduce battery consumption, and improve device health for people using your app.
If you'd like additional information on the Xcode Organizer and improving power and performance in your app, watch "Improving Battery Life and Performance" from WWDC19. For more on hitches, check out “Eliminate animation hitches with XCTest.”
Hi everyone. My name is Shefali and I'm a Performance Tools Engineer here at Apple today. I'm excited to talk to you about the Xcode Organizer.
Your apps are the backbone of our software experience. Now more than ever it's important that we continue working together to improve battery life and performance so users can get the most out of their devices. Year after year, You will strive to build the most performance apps for your users asking us what more you can do and what areas you should prioritize. To help you ensure that your apps are performing well on customer devices, we're dedicated to providing you with actionable tools and data so you can quickly determine what areas of your app to focus on. The Xcode Organizer window allows you to track aggregated battery, performance, and IO metrics for your applications.
Today I'm very excited to introduce some of the new features we've added this year. First, I'll go through a brief overview of the Xcode Organizer and show you what it looks like. An Xcode 11. Then we'll jump into the new features you've added this year which includes a new category of metrics and diagnostics reports as well as new UI. Finally, we'll tie all of these new features together in a demo where I'll show you how you can use this powerful tool to track the battery life and performance impact of your app from release to release. And we'll wrap it up with some next steps.
Let's begin with a brief overview of the Organizer. What is the Xcode Organizer? And how do I get to it to see my apps data? As the name suggests Xcode Organizer window is built directly in the Xkcode which means all you have to do is navigate to the menu bar, go to window, and click Organizer to launch.
What's great about using the Organizer is that it requires absolutely no changes to be made to your app. As users use your app, we collect battery life and performance data from consented devices. This data is an aggregated on our servers and sent back to you through the Organizer. To learn more about the Xcode Organizer I recommend you check out the "What's new in Energy Debugging" talk from 2018 and then "Improving Battery Life in Performance" talk from 2019. Last year through the Organizer we provided data for various app usage metrics. Since then we've loved seeing you use the metrics and diagnostics reports to monitor your app's performance and drive some really great bug fixes. Now let's take a look at the new data we've added in the Organizer this year. This year we're providing more data across both metrics and diagnostics. We've added a new category of metrics for scrolling. We're calling these Hitches before we go into the details. Let's take a look at the meal planner app I've been working on with some colleagues. And what a user perceives as a hitch.
Notice the slow skipping and jittery scroll. And here's the same application but without any hitches. As we can see there's quite a difference between the two experiences and this smooth scroll here is what we want to help you achieve using the scroll hitch metric. But what is a scroll hitch? A scroll hitch is when a rendered frame does not end up on screen at its expected time while a user is scrolling within your app. This usually causes frames to be dropped which can be perceived as a jittery scroll. For the scrolling section of the Organizer we take the hitch time, which is a total amount of extra time frames take to show up on screen, and we divide that by the scroll duration, which is the total amount of time a user spent scrolling within your app. The result is the hitch rate which is an important metric you can use to measure up performance because it provides an estimate of the severity of hitches as perceived by the user. There are three buckets for how you should interpret hitch rate. The first is when the hitch rate is less than five milliseconds per second. Here there's quite a large window of time between dropped frames and users are likely to perceive the smooth scroll that we saw in the meal planner app just a little earlier. Between five and 10 milliseconds per second frames are dropped every couple of seconds and when the hitch rate is greater than ten milliseconds per second, users will be perceiving frame drops very frequently leading to a poor scroll experience. To learn more about hitches I recommend you check out "The Eliminate Animation Hitches with XCTests" talk we've prepared for you this year. The second piece of new data we've added this year is Disk write Diagnostics reports. Last year we gave you metrics for this category and this year we're providing you with even more context to help you pinpoint and really narrow in on any issues your app encounters. Disk write diagnostic logs writes are aggregated when disk writes exceed 1 GB in a 24 hour period.
By reducing the amount of writes your app is doing, you can ensure better performance, longer battery life, and overall good device health. Let's take a look at an example of what these reports look like. In the left pane of the Organizer when we navigate to the report section and click on Disk Writes. Here's what we'll see for our app. We'll go into more detail about this during the demo.
So far we've seen some great new data and to go along with it, in Xcode 12 we've completely redone the interface. We're thrilled for you to finally see it. The new interactive UI allows you to compare and contrast metrics for different versions of your app with a single click. Let's go to the Organizer and take a better look at all of these new features. Let's say I'm a developer for an app called Meal Planner which allows users to plan meals for the week by saving pictures and recipes so that they're all in one place. In Xcode 12 when I open up the Organizer I can do a side by side comparison of two of my releases thanks to the new interactive UI.
I can now click on any of the older versions of my app. And on the right side we can see the UI update to reflect the differences between the latest and selected versions. There's also a more detailed breakdown of the subcategories accounting for the battery usage of my app. We can see here that in the latest version there's an increase in camera and Bluetooth usage that I now know to go investigate. I can also go back and select any of the older versions whenever I want. This is really useful because it opens up a lot of new possibilities for version comparison and it gives me control over the data I'm looking at. As developers we love seeing data about the usage of our app but what if it takes days or even weeks before we can see it in the Organizer. It's important to note that last year we set a threshold where we expected each app version to have a certain amount of usage from user devices before we could show histograms for them in the Xcode Organizer.
This year we're thrilled to show this data even sooner giving you an early glimpse of your app's performance. In Xcode 12, we've lowered the required usage threshold by a factor of five. This means that if you're currently able to see data for your app you'll now see this data even sooner. If your app's usage was below the old threshold but is above the new one, you'll start seeing data for the first time. We're incredibly happy that a much larger audience of app developers can now use the Organizer to monitor their apps battery life and performance impact. Looking at this battery usage graph we can see an icon in the x axis by version 1.0.1. This icon indicates that a version of our app had limited usage. Associated with this icon is additional information regarding the margin of error for that version.
We can see this on the right side here. This is important because we're analyzing fewer data points for these versions with limited usage. The data from the smaller working set will stabilize as more people update their app and use a new version. As it usage increases, the error margin will decrease until the version gets enough usage where the error margin is low enough that it's emitted from the UI. Now let's take a look at how we can use the new reports as part of our workflow. Clicking on the disk writes metrics on the left we can see that there is a sudden increase in disk writes in version 2.2. Let's walk through how we at meal planner would traige this regression. After identifying the spike in disk writes here, we'll navigate to the report's section on the left. And click on Disk Writes.
It looks like there were a couple of different issues contributing to the increase we saw. The top one looks like it's actually related to a new feature we added in version 2.2 where users can now add their own custom pictures and recipes to their meals. Since the stack trace tells us exactly what the signature of the issue is, we can jump to that part of the code and began investigating. Under the signature we can also see what percentage of our disk writes a given signature accounted for for a particular signature.
The report's section on the right shows us a breakdown by device type and operating system. And the bar graph below the pie chart gives us a trend of how many reports were received for app over the last 14 days. Similar to the energy reports we also provided sample stack traces per signature and additional information regarding the stack trace in the detail section on the right. I can use all of this information to make the fix so that our app isn't doing as much writing. I'll go ahead and mark the signature as "Resolved" so my colleagues can address some of the other regressions the Organizer caught. Once our users are using the version with this fixed, we'll come back to the metrics to confirm that our data returns back to what it previously was. We're incredibly excited to show you more data in a new interactive Organizer. And we're excited to see how you use all of these new features to drive some great optimizations within your app.
If you're a developer using the Organizer I encourage you to go compare metrics for two of your app versions with the new interactive UI. Check out what's scrolling performance looks like for your app with the Hitch's metric.
Take a deep dive into the disk writes for your app by using the disk writes reports along with the disk write metrics. We're very excited for you to continue using the Xcode Organizer to optimize your apps for battery life and performance.
Thank you for taking the time to listen to this presentation. And I hope
Looking for something specific? Enter a topic above and jump straight to the good stuff.
An error occurred when submitting your query. Please check your Internet connection and try again.