Home > Articles > Home & Office Computing > Mac OS X

This chapter is from the book

This chapter is from the book

The Trace Document Window

The initial form of a trace document window is simple: a toolbar at the top, and a stack of instruments in the view that dominates the window. After you've recorded data into the document, the window becomes much richer. Let's go through Figure 26.2 and identify the components.

Figure 26.2

Figure 26.2 A typical Instruments window, after data has been recorded. The Extended Detail pane (at right) has also been exposed. I discuss the numbered parts in the text.

The Toolbar

The toolbar comes in three sections. The controls at left (1) control recording and the execution of the target applications. There is a pause button for suspending and resuming data collection, a Record / Drive & Record / Stop button to start and stop data collection, and a loop button for running a recorded human-interface script repeatedly.

The Default Target pop-up designates the process or executable that all instruments in the document will target, unless you specify different targets for individual instruments. The choices are as follows:

  • All Processes. Data will be collected from all the processes, user and system, on the machine. For instance, the Core Data instruments can measure the Core Data activity of all processes. Not every instrument can span processes; if your document contains no instruments that can sample systemwide, this option is disabled.
  • Attach to Process. Data will be collected from a process that is already running; select it from the submenu. Some instruments require that their targets be launched from Instruments, and cannot attach to running processes. If you use only nonattaching instruments, this option is disabled.
  • Launch Executable. When you start recording, Instruments will launch the selected application or tool, and collect data from it. The submenu contains items for applications you've recorded previously, and has a Choose Executable item to select a fresh application.
  • Instrument Specific. Each instrument will collect data from the target specified in the Target pop-up of its configuration inspector. The instruments in a trace document do not all have to collect data from the same target.

The center section (2) relates to time (see Figure 26.3). The clock view in the center of the toolbar displays the total time period recorded in the document. If you click the clock-face icon to the right of the time display, the clock shows the position of the "playback head" in the time scale at the top of the Track pane.

Figure 26.3

Figure 26.3 The center section of a trace document's toolbar displays a clock, and controls for selecting a span of time within a recording. The clock displays the total time in the document (or, if you click the icon at the right of the clock, the position of the "playback head") and the run being displayed if there is more than one.

The clock view also controls which run of the document is being displayed. Each time you click Record, a new recording, with a timeline of its own, is added to the document. The run now being displayed is shown like "Run 1 of 2," and you can switch among them by pressing the arrowhead buttons to either side.

Most instruments will display subsets of the data they collect if you select a time span within the recording. To do so, move the playback head to the beginning of the span, and click the button on the left of the Inspection Range control; then move the head to the end of the span and click the button on the right. The selected span will be highlighted, and the Detail pane will be restricted to data collected in the span. To clear the selection, click the button in the middle.

The right section (3) provides convenient controls for display. Mini hides Instruments and displays a heads-up window for controlling recording from other applications. View pops up a menu that shows and hides the Detail and Extended Detail panes. Library shows and hides the Library window.

The Track Pane

The Track pane (4) is the focus of the document window, and the only component you see when a document is first opened. This is the pane you drag new instruments into. Each instrument occupies its own row, with a configuration block on the left, and the instrument's track on the right.

The configuration block (see Figure 26.4) shows the instrument's name and icon. To the left is a disclosure triangle so you can see the instrument's track for each run in the document. To the right is an inspector button (i) that reveals a configuration inspector for the instrument.

Figure 26.4

Figure 26.4 A stack of instrument tracks in a trace document. Each instrument has its own row, with a timeline extending to the right, calibrated in seconds. Clicking an instrument's configuration button opens an inspector containing settings for the instrument. Some of these control the style of the graph and which of its data an instrument displays, and can be changed at any time. The pop-up at the top of the inspector selects what process the instrument is to collect data from, and must be set (or left to the default, if the instrument can accept it) before recording begins.

The tracks to the right of the configuration blocks display the data collected by the instruments, on a timeline. The configuration inspector controls what data is plotted, and how it is displayed.

At the top of the timeline is a ruler matching the data to the time at which is was collected. The scale of the track can be controlled by the slider below the configuration blocks. In the ruler, you will see a white triangle, the playback head. Drag the playback head and use the Inspection Range control to select intervals within the recording. As you drag the head across the track, many instruments will label their tracks with the value of their data at that time.

The Detail Pane

The Detail pane (5 and 6) appears when you've made a recording, or when you use a control or menu item to display it. View > Detail (stard.gifD), View (toolbar button) > Detail, the Detail item in the Action gear_xcu.jpg) menu at the lower left of the window, and the detail button (rectangle with arrowhead) next to it, will all toggle the Detail pane. You do not lack for options.

When you select an instrument in the Track pane, the data from the instrument collection is shown in tabular form in the Detail pane. What's in the table varies among instruments. And, the Detail pane controls (9, and Figure 26.5) provide for up to three table formats.

Figure 26.5

Figure 26.5 The Detail View buttons, which appear below the table portion of the Detail View. The first three buttons select different table displays, or "modes." The modes are Table, Outline, and Diagram. The fourth button, showing a window with a portion on the right highlighted, opens or closes the Extended Detail pane. The Navigation Path breadcrumb control enables you to back a display off after you've drilled down into a detail.

Like the table itself, the alternative views vary depending on the instrument. The general pattern seems to be

  • Table mode is the principal display the instrument's author has chosen for its data. For most instruments, this is the raw data they collected, such as the details of individual calls in the Reads/Writes instrument. In Sampler, the table contains a stack trace for each sample; in ObjectAlloc, the items are classes/categories of allocated blocks.
  • Outline mode, in the case of instruments that collect stack traces, aggregates the traces into call trees (like the Tree and Heavy displays in Shark). When this is the case, the Call Tree controls in the Detail controls view (5) become active.
  • Diagram mode is not often used. In Chapter 19, we saw that ObjectAlloc used this for a table of the individual data it collects.

The next button over, with an icon that suggests a window with a portion highlighted, displays the Extended Detail pane (7), which is covered in the next section.

When you "drill into" data in a Detail pane, such as when you obtain the history of an allocated block in ObjectAlloc, the "breadcrumb" control at the right end of the Detail controls enables you to back out to the superior view.

The left portion of the Detail pane (5) contains controls to adjust or analyze the contents of a Detail table, and in some cases to configure an instrument before it is run. The repertoire of controls varies by instrument and view, but the most commonly used controls are in the group labeled Call Tree, which is active whenever a tree of call stacks is displayed in the table.

These commands are similar to the stack data-mining options available in Shark:

  • Separate by Thread. Call trees are normally merged with no regard for which thread the calls occurred in. Separating the trees by thread will help you weed out calls in threads you aren't interested in.
  • Invert Call Tree. The default (top-down) presentation of call trees starts at the runtime start function, branching out through the successive calls down to the leaf functions that are the events the instrument records. Checking this box inverts the trees so that they are bottom up. The displayed tree begins at the "event" function, and branches out among its callers, thus aggregating call paths to bottleneck functions.
  • Hide Missing Symbols. Checking this box hides functions that don't have symbols associated with them. If you can't determine what they are, they probably aren't part of your code. (If they are part of your code, turn off symbol stripping in your build.)
  • Hide System Libraries. This skips over functions in system libraries. Reading the names of the library calls may help you get an idea of what is going on; if you are looking for code you can do something about, however, you don't want to see them.
  • Show Obj-C Only. Checking this narrows the list down to calls made from Objective-C methods, whether in system libraries or not (another way to cut out the possible distraction of calls you don't care to see).
  • Flatten Recursion. This lumps every call a function makes to itself into a single item. Recursive calls can run up the length of a call stack without being very informative.

You can also add call-tree constraints, such as minimum and maximum call counts. The idea is to prune (or focus on) calls that are not frequently made. Another constraint that may be available (for instance in the Sampler instrument) can filter call trees by the amount of time (minimum, maximum, or both) they took up in the course of the run.

Of course, another way to filter call trees is to restrict your attention to a particular time span, such as between the open and close calls on a particular file (which the File Activity instrument would landmark for you). Use the playback head and the Inspection Range control to select the beginning and end of the period of interest, and the call tree will reflect only the calls made between them.

The Extended Detail Pane

The Extended Detail pane (7) typically includes a stack trace when you select an item in the Detail pane that carries stack information. When the selected item is part of a call tree, the Extended Detail pane shows the "heaviest" stack, the one that accounts for the most of whatever the instrument keeps track of. Selecting a frame in the call stack highlights the corresponding call in the call-tree outline. Double-clicking a frame opens the corresponding source code in Xcode, if it can be found.

A stack trace in the Extended Detail pane has an Action (gear_xcu.jpg) menu at the top. Most commands in this menu have to do with how the calls in the trace are displayed. An example is Color by Library, which tints each call frame by the library file (including an application's main executable) that the call came from.

A couple of items in the Action menu are of particular interest. Look Up API Documentation acts like Option-double-clicking a symbol in Xcode: Select the frame, select the command, and be directed to its documentation in Xcode's Documentation window. Trace Call Duration creates a new instrument in the current document to record the stack trace when the function was called, and how long it took to execute.

Controls

Three additional controls are to be found at the bottom-left corner of the document window (8) (see Figure 26.6).

Figure 26.6

Figure 26.6 The controls at the lower left corner of a trace document window, with the Action menu displayed.

The first is an Action (gear_xcu.jpg) menu that affords yet another means to start recording or looping, and to control the visibility of the Detail and Extended Detail panes, and the Library window. There is a submenu for selecting an instrument to add to the document. The Spin Monitor item is a toggle; when it's checked, Instruments will automatically add a Spin Monitor instrument to the document whenever an application being traced hangs.

The second is the Full Screen toggle. Instruments' extensive display eats up a lot of screen area, and when you're concentrating on your analysis, you want the display to be as big as possible. Clicking this button fills the screen with the contents of the window. Click it again to return to normal windowing.

The third button shows and hides the Detail pane.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020