® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

23
® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S

Transcript of ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

Page 1: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

®

IBM Software Group

© 2006 IBM Corporation

PurifyPlus on Linux / Unix

Vinay Kumar H S

Page 2: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Agenda

Introduction

Installation

Components

Usage

Page 3: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Introduction

Memory debugging: pinpoints hard to find memory errors such as uninitialized

memory access, buffer overflow, and improper freeing of memory

Memory leak detection : identifies memory blocks that no longer have a valid

pointer

Performance profiling: highlights application performance bottlenecks and

improves application understanding with a graphical representation of function

calls

Code coverage: identifies untested code with line-level precision

Page 4: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Installation

PurifyPlus Installer

- http://www-01.ibm.com/support/docview.wss?&uid=swg21315781

- Need Passport Advantage (PA) Credentials

- Company Primary contact , Technical Contact will have the information

PurifyPlus Licenses

- Need PurifyPlusUNIX Licenses

- Floating , Nodelocked, Named User

Page 5: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Installation

Setup the License Server

Run rs_install to install the tool

Run Post_Install script

Source the file- purifyplus_setup.sh to set the path

Page 6: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Purify Usage

Test the sample provided with the installation

Instrumentation could be done in either way

- purify cc -g hello_world.c

- purify cc -g hello_world.o ( cc -c -g hello_world.c)

In make files, as above just append purify at link line

Purify command cannot be used to generate .so or .a

Page 7: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Purify Usage

purify cc –g hello_world.c

purify –log-file=./sample.log cc –g hello_world.c

purify –view-file=./sampleview.pv cc –g hello_world.c

purify –view sampleview.pv

Page 8: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Purify Usage

Can suppress messages

Can specify where to suppress the message making the report more meaning full

Can use JIT or the purified output with Debugger

Many Run time , Build Time options exist

Page 9: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Purify Usage

Purify maintains a table to track the status of each byte of memory used by

your program.

The table contains two bits that represent each byte of memory.

The first bit records whether the corresponding byte has been allocated

The second bit records whether the memory has been initialized.

Page 10: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Purify Usage

Purify uses these two bits to describe four states of memory:

Red, Yellow, Green, and Blue

Illegal to read, write, or free red and blue memory

Yellow could be written or freed but should not be read

Green could be Read or Written

Page 11: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Page 12: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

PureCoverage Usage

Helps Identify Untested Code

purecov cc -g hello_world.c

Provides Line Level and Function level Coverage information

Provides option to view annotated source with coverage information

Page 13: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Pure coverage

Can make Adjustments to get the practical data analysis

Provides option to view the result file on Windows

-view-file-format = both

- .pcv

-view-file-format = windows

- .cfy

Page 14: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Pure Coverage

Purecoverage script reports

- Coverage Summary Report

- Low Coverage Reports

- Differences Report

http://www.ibm.com/developerworks/rational/library/edge/08/oct08/srivastava_mcvey/index.html

Provides merge option to merge the results

purecov -merge=result.pcv -force-merge a.pcv b.pcv

Page 15: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Quantify

Quantify Provides the time measure required for the execution of Application,its module, its functions

Quantify uses Object Code Insertion (OCI)technology to count the instructions your program executes and to compute how many cycles they require to execute.

Quantify instruments and reports performance data for all the code in your program, including system and third-party libraries, shared libraries, and statically linked modules.

Quantify times system calls – Wall clock time ( System time)

Since Quantify counts cycles, it gives you accurate data at any scale.

Page 16: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Quantify Usage

quantify cc -g hello_world.c

Analysis could be done using various kind of information

Function List Window

Function Detail Window

Call Graph Window

Annotated Source Window

Page 17: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Qunatify Usage

Function List provides the list of function which has its share in the overall time

Function List can be sorted

Function List can be restricted

Page 18: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Quantify Usage

Call graph provides different functions on the graph with varying line thickness

The thickness of the line is directly proportional to the time taken by that function to execute

Provides an option to focus on specific functions , descendants

Page 19: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Quantify Usage

The Function Detail window presents detailed performance data for a single function, its contribution to the overall execution of the program

Function + Descendant value could also be calculated

Quantify can display recorded performance data in cycles (the number of

machine cycles) and in microseconds, milliseconds, or seconds

Various scaling levels are possible .00 , .000

Page 20: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Quantify Usage

The Annotated source window provides the Line wise performance data

The Annotated Source window is available only for files that you

compile using the -g debugging option

Annotations show how function+descendants time was distributed over

its source lines

Page 21: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Demo

Page 22: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Questions?

Page 23: ® IBM Software Group © 2006 IBM Corporation PurifyPlus on Linux / Unix Vinay Kumar H S.

IBM Software Group | Rational software

Thank You !!!