![]() ![]() If you select the Allocations instrument from the instrument list, the detail view shows a summary of the memory allocation data. Let’s start with the Allocations instrument. Now it’s time to look at data for specific instruments. Clicking in the graph outside of the inspection range you set clears the inspection range. When you set an inspection range, the statistics in the detail view change to reflect the time interval in the inspection range. The inspection range is shaded blue, which you can see in the following screenshot: Click inside an instrument’s graph and drag to create the inspection range. You can focus on a specific time interval in the graph by setting an inspection range. The following image shows the memory usage for the Allocations instrument: If you move the mouse cursor inside the graph, Instruments shows a tooltip with a piece of data about the graph. Now comes the hard part: making sense of all the data that Instruments generates. If you want to save your trace so you can look at the results later, choose File > Save. The Leaks instrument is set to check for leaks every 10 seconds so you should run your app for at least 10 seconds. When you are finished, you can either click the Pause button or the Stop button. Click the Record button on the left side of the toolbar. The following screenshot shows the configuration options for the Allocations instrument:Īt this point you can start profiling your app. But when you use Instruments, you may need to configure an instrument, and it helps to configure the instrument before you start recording.Ĭhoose File > Recording Options to configure an instrument. You won’t need to configure any instruments to follow along with this tutorial. The bottom bar contains controls to filter the information that appears in the detail view. ![]() For most instruments the extended detail view shows the call stack. The extended detail view shows additional statistics. The detail view shows the profiling statistics. The jump bar allows you to choose what to show in the detail view. The graph is going to be empty until you start recording. The instrument list shows the instruments being used in the trace along with a graph for each instrument. The toolbar also has controls to choose an app to profile, add an instrument to the trace, and show/hide different parts of the trace document window. Running from top to bottom, the main areas of the trace document window are the following:įor this article the only toolbar items you need to worry about are the buttons to start/stop recording and pause recording on the left side of the toolbar. ![]() When you click the Choose button, an empty trace document window opens in Instruments. The Leaks template include both the Leaks and Allocations instruments. Select the Leaks template and click the Choose button. When Instruments launches, you will be asked to choose a template. The easiest way to launch Instruments is to profile your project by choosing Product > Profile in Xcode. Launching Instrumentsīecause Instruments is located inside Xcode’s app bundle, you won’t be able to find it in the Finder. But if your iOS app is generating memory warnings when you run it or your app runs really slow, you’ll want to profile the app with Instruments. You normally use Instruments when you get closer to shipping an app. If you’re learning iOS or Mac development, you’re not going to use Instruments at first. The Time Profiler instrument measures CPU usage and helps you find the slow spots in your code.The Allocations instrument records statistics about memory allocations.The Leaks instrument checks your app for memory leaks.Some popular instruments include the following: Instruments comes with a collection of instruments, each of which records a specific set of statistics. Instruments is an app that is bundled with Xcode to record and display statistics about your app as it runs. After reading this article you’ll know how to interpret the data Instruments generates for the Allocations and Leaks instruments and learn tips you can use with other instruments. On Stack Overflow I see many questions from people who have trouble interpreting the data Instruments generates. ![]()
0 Comments
Leave a Reply. |