Quantify User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
Quantify User’s Guide Version 3.1 [email protected] http://www.rational.com IMPORTANT NOTICE DISCLAIMER OF WARRANTY Rational Software Corporation makes no representations or warranties, either express or implied, by or with respect to anything in this guide, and shall not be liable for any implied warranties of merchantability or fitness for a particular purpose or for any indirect, special or consequential damages. COPYRIGHT NOTICE Quantify, copyright 1992-1997 Rational Software Corporation. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted, in any form or by any means, photocopying, recording or otherwise, without prior written consent of Rational Software Corporation. No patent liability is assumed with respect to the use of the information contained herein. While every precaution has been taken in the preparation of this book, Rational Software Corporation assumes no responsibility for errors or omissions. This publication and features described herein are subject to change without notice. The program and information contained herein are licensed only pursuant to a license agreement that contains use, reverse engineering, disclosure and other restrictions; accordingly, it is “Unpublished — rights reserved under the copyright laws of the United States” for purposes of the FARs. RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. Government is subject to restrictions set forth in DFARS 227.7202-1(a) and 227.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (Oct 1988), FAR 12.212(a) 1995, FAR 52.227-19, or FAR 52.227-14, as applicable. TRADEMARKS Rational, Purify, PureCoverage, Quantify, PureLink, ClearDDTS, and ClearCase are U. S. registered trademarks of Rational Software Corporation. All other products or services mentioned in this guide are covered by the trademarks, service marks, or product names as designated by the companies who market those products. PATENTS Quantify is covered by one or more of U.S. Patent Nos. 5,193,180 and 5,335,344 and 5,535,329. Purify is licensed under Sun Microsystems Inc.’s U.S. Pat. No. 5,404,499. Other U.S. and foreign patents pending. Printed in the U.S.A. QUANTIFY USER’S GUIDE Contents Welcome to Quantify Using this guide . .ix Using online Help . .ix Conventions used in this guide . x Displaying the release notes . x Installing Quantify . x Contacting technical support . .xi 1 Introducing Quantify How Quantify works . 1-2 Building and running a Quantify’d program . 1-3 Interpreting the program summary . 1-4 Using Quantify’s data analysis windows . 1-5 The Function List window . 1-6 Sorting the function list . 1-6 Restricting functions . 1-7 Finding and filtering functions . 1-7 The Call Graph window . 1-9 Understanding the layout of the call graph . 1-10 Using the pop-up menu . 1-11 Expanding and collapsing descendants . 1-11 Locating functions in the call graph . 1-12 Changing the focus of the call graph . 1-13 Displaying additional data for functions . 1-14 Changing line scale factors . 1-15 Shortening function names . 1-16 Saving the call graph . 1-16 iii The Function Detail window . 1-17 Understanding how time is distributed . 1-18 Changing the scale and precision of data . 1-19 Saving function detail data . 1-19 The Annotated Source window . 1-20 Changing annotations . 1-21 What annotations mean . 1-21 Saving performance data . 1-22 Customizing Quantify’s graphical interface . 1-23 Editing the .qvrc file . 1-23 2 Improving Performance with Quantify The hashtable package . 2-1 Collecting baseline performance data . 2-4 Uncovering an unexpected behavior . 2-5 The function detail suggests long buckets . 2-6 Annotated source confirms excessive calls . 2-8 Saving the baseline data . 2-9 Improving the performance of the testHash program . 2-10 Running the improved_testHash program . 2-12 Verifying the performance improvement . 2-14 Other causes of slow software . 2-15 Needless computation . 2-15 Premature computation . 2-16 Needless recomputation . 2-16 Inefficient computation . 2-16 Needless library or system-call requests . 2-16 Excessive library or system-call requests . 2-17 Expensive library or system-call requests . 2-17 Environmental factors . 2-17 3 How Quantify Collects Data How Quantify records function time . 3-2 iv How Quantify names functions . 3-3 Analyzing basic blocks . 3-4 How Quantify identifies basic blocks . 3-5 How Quantify reports multiple basic blocks . 3-9 Annotations and compiler differences . 3-9 C++ templates and annotated source . 3-11 How Quantify times system calls . 3-13 Variations in system-call timing . 3-14 How Quantify times register-window traps . 3-15 Understanding recursive functions . 3-16 Running on a different machine . 3-20 Paging and memory cache effects . 3-20 4 Customizing Data Collection Avoiding all data recording . 4-2 Timing system calls . 4-2 Avoiding timing for all system calls . 4-2 Controlling how system calls are timed . 4-4 Avoiding timing for specific system calls . 4-5 Reporting excluded system-call time . 4-6 Timing shared-library operations . 4-7 Recording dynamic linking . 4-7 Understanding shared-library operations . 4-8 Timing register-window traps . 4-10 Changing the granularity of collected data . 4-11 Collecting partial data for a run . 4-13 Analyzing datasets containing partial data . 4-14 Calling quantify _stop_recording_system_calls and quantify_clear_data from your debugger . 4-15 Annotating datasets . 4-16 Saving data on signals . 4-17 Collecting data in long-running programs . 4-18 v Collecting data for child processes . 4-18 Using execve . 4-19 Using fork . 4-19 Using vfork . 4-19 Collecting data in threaded programs . 4-20 Threads and stacks . 4-20 Solaris lightweight processes and threads . 4-21 Analyzing data from threaded programs . 4-22 5 Analyzing Data with Scripts Exporting performance data . 5-1 The export data file format . 5-1 Running qv . 5-2 Rerouting Quantify’s output . 5-3 Saving data incrementally . 5-4 Automating data analysis . 5-5 Automating performance regression tests . 5-5 Comparing program runs with qxdiff . 5-7 What qxdiff annotations mean . 5-8 Managing cached object files . 5-10 Deleting cached object files . 5-10 A Using Quantify Options and API Functions Using Quantify options . A-2 Option syntax . A-2 Using conversion characters in filenames . A-3 How Quantify creates filenames . A-4 Option types . ..