Quantify User’s Guide - Isaac Newton Group of docs/external/purify/quantify-3_1.pdfQUANTIFY USER’S GUIDE ix Welcome to Quantify Using this guide This guide documents the features and capabilities of Quantify: Chapter 1, “Introducing Quantify,” provides an overview of how to use Quantify. Chapter 2

Embed Size (px)

Text of Quantify User’s Guide - Isaac Newton Group of docs/external/purify/quantify-3_1.pdfQUANTIFY...

  • Quantify Users Guide

    support@rational.comhttp://www.rational.com

    Version 3.1

  • IMPORTANT NOTICE

    DISCLAIMER OF WARRANTYRational Software Corporation makes no representations or warranties,either express or implied, by or with respect to anything in this guide, andshall not be liable for any implied warranties of merchantability or fitness fora particular purpose or for any indirect, special or consequential damages.

    COPYRIGHT NOTICEQuantify, copyright 1992-1997 Rational Software Corporation. All rightsreserved.

    No part of this publication may be reproduced, stored in a retrieval system ortransmitted, in any form or by any means, photocopying, recording orotherwise, without prior written consent of Rational Software Corporation. Nopatent liability is assumed with respect to the use of the informationcontained herein. While every precaution has been taken in the preparation ofthis book, Rational Software Corporation assumes no responsibility for errorsor omissions. This publication and features described herein are subject tochange without notice.

    The program and information contained herein are licensed only pursuant toa license agreement that contains use, reverse engineering, disclosure andother restrictions; accordingly, it is Unpublished rights reserved under thecopyright laws of the United States for purposes of the FARs.

    RESTRICTED RIGHTS LEGENDUse, duplication, or disclosure by the U.S. Government is subject torestrictions 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.

    TRADEMARKSRational, Purify, PureCoverage, Quantify, PureLink, ClearDDTS, andClearCase are U. S. registered trademarks of Rational Software Corporation.

    All other products or services mentioned in this guide are covered by thetrademarks, service marks, or product names as designated by the companieswho market those products.

    PATENTSQuantify is covered by one or more of U.S. Patent Nos. 5,193,180 and5,335,344 and 5,535,329. Purify is licensed under Sun Microsystems Inc.sU.S. Pat. No. 5,404,499. Other U.S. and foreign patents pending.

    Printed in the U.S.A.

  • Q U A N T I F Y U S E R S G U I D E

    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 Quantifyd program . . . . . . . . . . . . . . . . . 1-3

    Interpreting the program summary . . . . . . . . . . . . . . . . . . . . . . . . 1-4

    Using Quantifys 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 Quantifys 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_callsand quantify_clear_data from your debugger . . . . . . . . . . . . . 4-15

    Annotating datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-16

    Saving data on signals . . .