Software Analysis Handbook: Software Complexity Analysis and Software Reliability Estimation and Prediction
Total Page:16
File Type:pdf, Size:1020Kb
Technical Memorandum 104799 Software Analysis Handbook: Software Complexity Analysis and Software Reliability Estimation and Prediction Alice T. Lee Todd Gunn (NASA-TM-I04799) SOFTWARE ANALYSIS N95-I1914 Tuan Pham HANDBOOK: SOFTWARE COMPLEXITY Ron Ricaldi ANALYSIS AND SOFTWARE RELIABILITY ESTIMATION AND PREDICTION (NASA. Unclas Johnson Space Center) 96 p G3159 0023056 August 1994 ..0 National Aeronautics and Space Administration Technical Memorandum 104799 Software Analysis Handbook: Software Complexity Analysis and Software Reliability Estimation and Prediction Alice T. Lee Safety, Reliability, & Quaflty Assurance Office Lyndon B. Johnson Space Center Houston, Texas Todd Gunn, Tuan Pham, and Ron Ricaldi Loral Space Information Systems Houston, Texas National Aeronautics and Space Administration Thispublication is available from the NASA Center for AeroSpace Information, 800 Elkridge Landing Road, Linthicum Heights, MD 21090-2934, (301) 621-0390. Summary The purpose of this handbook is to document the software analysis process as it is performed by the Analysis and Risk Assessment Branch of the Safety, Reliability, and Quality Assurance Office at the Johnson Space Center. The handbook also provides a summary of the tools and methodologies used to perform software analysis. This handbook is comprised of two sepa- rate sections describing aspects of software complexity and software reliability estimation and prediction. The body of this document will delineate the background, theories, tools, and analysis procedures of these approaches. Software complexity analysis can provide quantitative information on code to the designing, testing, and maintenance organizations throughout the software life cycle. Diverse information on code structure, critical components, risk areas, testing deficiencies, and opportunities for improvement can be obtained using software complexity analysis. Software reliability estimation and prediction analysis is a quantitative means of assessing the readiness of software before it is put into operation. It provides a quantitative approach that will assist the software acceptance process. In addition, the results can aid in forecasting, managing, and scheduling testing resources. This handbook is not intended to be the exclusive guide to software analysis. This document will be revised as new information on models and their respective processes are gathered. iii Contents Page SECTION 1 - SOFTWARE COMPLEXITY ANALYSIS AND THE DETERMINATION OF SOF'I'WARE TEST COVERAGE 1.1 Introduction ............................................................................................... 1.1.1 Static Analysis ........................................................................................... 1.1.2 Dynamic Analysis ...................................................................................... 1.1.3 Software Functional Criticality ................................................................... 1.2 Software Complexity: Theories and Concepts ......................................... 3 1.2.1 Introduction to Complexity Metrics ............................................................. 3 1.2.1.1 Common Metric Definitions ....................................................................... 4 1.2.1.1.1 Lines of Code ............................................................................................ 4 1.2.1.1.2 Halstead's Textual Complexity Metrics ...................................................... 4 1.2.1.1.3 McCabe's Cyclomatic Number .................................................................. 5 1.2.1.1.4 The Complexity Measure of Henry and Kafura ......................................... 6 1.2.1.2 Utilization of Complexity Metrics ................................................................ 7 1.2.1.3 Applicability of Metrics to the Software Life Cycle ..................................... 7 1.2.1.4 A Practical Example: Construction of an Error Prediction Model .............. 7 1.2.2 Dynamic Analysis: Definitions and Concepts ...... ..................................... 9 1.2.2.1 Test Coverage Monitoring Techniques ...................................................... 9 1.2.2.1.1 Entry Point Monitoring ............................................................................... 9 1.2.2.1.2 Segment (Instruction Block) Monitoring ..................................................... 9 1.2.2.1.3 Transfer (Decision-to-Decision Path) Monitoring ....................................... 10 1.2.2.1.4 Path Monitoring ......................................................................................... 10 1.2.2.2 Profiling ..................................................................................................... 10 1.2.2.3 A Practical Example: Transfer Monitoring During Interface Test Execution 10 1.2.3 Software Functional Criticality ................................................................... 12 1.2.4 Results Consolidation ................................................................................ 12 1.3 Tools ......................................................................................................... 16 1.3.1 Logiscope .................................................................. ................................ 16 1.3.2 Compiler Tools .......................................................................................... 17 1.3.3 Other Tools ............................................................................................... 17 1.4 Detailed Analysis Procedures ................................................................... 17 1.4.1 Collection of Metrics .................................................................................. 17 1.4.1 .1 Source Code ............................................................................................. 17 1.4.1 .2 Logiscope Procedures .............................................................................. 18 1.4.1 .2.1 Static Analysis of Code ............................................................................. 18 1.4.1 .2.2 Archiving Results Files .............................................................................. 21 1.4.1 .2.3 Editor Procedures for Generating Output .................................................. 21 1.4.1 .2.3.1 Metrics Generation .................................................................................... 22 1.4.1 .2.3.2 Control Graph Procedures ........................................................................ 24 1.4.1 .2.4 Kiviat Graph Procedures ........................................................................... 25 1.4.1 .2.5 Workspace Management Procedures ....................................................... 25 P_ PA_ eLAr_ L_3T FtL_f]E'_ Contents (continued) Page 1.4.2 Metrics Database Format and Input .......................................................... 26 1.4.3 Dynamic Analysis for Determination of Test Case Coverage .................... 27 1.4.3.1 Dynamic Analysis Using Logiscope ........................................................... 27 1.4.3.1.1 Code Instrumentation ................................................................................ 27 1.4.3.1.2 Compilation of Instrumented Code ............................................................ 28 1.4.3.1.3 Other Procedures ...................................................................................... 28 1.4.3.2 Dynamic Analysis Using Compiler Directives ............................................ 28 1.4.3.2.1 Code Instrumentation and Compilation ..................................................... 28 1.4.3.2.2 Test Case Execution ................................................................................. 29 1.4.3.2.3 Collection and Consolidation of Results .................................................... 29 1.4.3.2.4 Profiling ..................................................................................................... 34 1.4.4 Logiscope Log On Procedures .................................................................. 35 1.4.4.1 Remote Log On Procedures ...................................................................... 35 1.4.4.2 Terminal Configuration .............................................................................. 36 1.4.4.3 Logiscope Startup Procedures .................................................................. 36 1.4.4.3.1 Using the Menu System ............................................................................ 36 1.4.4.3.2 From the Command Line ........................................................................... 37 1.4.4.4 A Quick Tour of Logiscope ........................................................................ 37 1.5 UNIX Basics and Commands .................................................................... 38 SECTION 2 - SOFTWARE RELIABILITY ESTIMATION AND PREDICTION 2.1 Introduction ............................................................................................... 4O 2.1.1 Models ....................................................................................................... 4O 2.1.2 Tools ......................................................................................................... 4O 2.1.3 Data Collection and Analysis ..................................................................... 41 2.1.4 Modeling Procedure and Analysis ............................................................. 41 2.2 Background ..............................................................................................