Giter Site home page Giter Site logo

hribz / cppstats Goto Github PK

View Code? Open in Web Editor NEW

This project forked from se-sic/cppstats

0.0 0.0 0.0 10.63 MB

toolsuite for analyzing cpp-preprocessor-based software product lines

Home Page: fosd.net/cppstats

License: GNU General Public License v3.0

Shell 1.21% Python 98.23% XSLT 0.56%

cppstats's Introduction

cppstats

License & Copyright

  • Copyright (C) 2009-2015 University of Passau, Germany

All rights reserved.

cppstats is covered by the GNU Lesser General Public License. The full license text is distributed with this software. See the LICENSE.LESSER file.

Main Developers

Further Contributors

What is it?

cppstats is a suite of analyses for measuring C preprocessor-based variability in software product lines.

Currently, cppstats supports following analyses:

  • general,
  • generalvalues,
  • discipline,
  • featurelocations,
  • derivative, and
  • interaction.

For detailed information on each kind of analysis, please refer to the corresponding paragraph below in this file.

For further information, please see the tool's homepage at: http://www.fosd.net/cppstats

Details of the latest version can be found on the cppstats project site at GitHub under https://github.com/clhunsen/cppstats/.

System Requirements

Installation

cppstats should be runnable under following systems:

  • Linux/Ubuntu,
  • Mac OS X, and
  • Cygwin.

Please see the file called INSTALL.md for detailed instructions for each system.

In detail, cppstats was successfully tested under:

  • Ubuntu 12.04, Python 2.7.*, and
  • Cygwin, Python 2.7.*.

Right now, Python 3.x is NOT supported.

Quick Start

  • Install cppstats using sudo python setup.py install.

  • Supply cppstats with the appropriate paths in cppstats_input.txt

    • use full paths like /local/repos/mpsolve/mpsolve-2.2

    • each project folder given in the file has to be structured as follows:

      > /local/repos/cpp-history/mpsolve/mpsolve-2.2/
          > source/ (here are the C source files)
      
  • Then run:

    $ cppstats --kind <K>
    

    <K> must be one of the analyses listed in the introduction. Also, have a look on cppstats --help for further command line options.

  • The output files for each analysis are written to the folders given in the file cppstats_input.txt.

Analyses

  • GENERAL

    • Measurement of CPP-related metrics regarding scattering, tangling, and nesting
    • returns a list of metrics for each file, and a list of metric values for the whole project folder
  • GENERALVALUES

    • Calculation of scattering, tangling, and nesting values
    • allows deactivation of the rewriting of #ifdefs to get a 'pure' result
      • rewriting changes #else branches from no used constant to the negation of the corresponding #if clause
    • returns a list for each characteristic, which #ifdef or configuration constant has which value (merged and unmerged)
      • unmerged: each #ifdef expression is counted once per file
      • merged: each #ifdef expression is counted once per project
  • DISCIPLINE

    • Analysis of the discipline of used CPP annotations
    • returns the number of occurences for the categories listed below
      • (1) check top level siblings (compilation unit)'
      • (2) check sibling (excludes check top level siblings; NOT CLASSIFIED)'
      • (4) check if-then enframement (wrapper)'
      • (8) check case enframement (conditional)'
      • (16) check else-if enframement (conditional)
      • (32) check param/argument enframement (parameter)
      • (64) check expression enframement (expression)
      • (128) check else enframement (NOT CLASSIFIED)
  • FEATURELOCATIONS

    • Analysis of the locations of CPP annotation blocks in the given file or project folder
    • returns a table with the following headers:
      • file
      • starting line
      • end line
      • type of the annotation (#if, #elif, #else)
      • the #ifdef expression -- involved configuration constants
  • DERIVATIVE

    • Analysis of all derivatives in the given project folder
    • returns all CPP annotations that involve shared code (expression contains &&)
  • INTERACTION

    • Analysis of pair-wise interactions of configurations constants that have been used alltogether in one expression (# of constants involved >= 3)
    • (A, B, C) -> |(A, B)? (A, C)? (B, C)? ...|

General Notes

  • When cppstats computes general stats (--kind general parameter), the reported granularity function level (GRANFL) also accounts for conditional elements within an array initialization or conditional field initializations when creating a struct variable. Example (for array):

    static const struct squashfs_decompressor *decompressor[] = {
      &squashfs_zlib_comp_ops,
      &squashfs_lzma_unsupported_comp_ops,
      #if defined(CONFIG_SQUASHFS_LZO)
      &squashfs_lzo_comp_ops,
      #else
      &squashfs_lzo_unsupported_comp_ops,
      #endif
      &squashfs_unknown_comp_ops
    };

    The rationale behind such decision is that array/struct instance initializations can be interpreted as constructor procedure calls.

cppstats's People

Contributors

clhunsen avatar ext3h avatar sergiykolesnikov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.