Skip to main content
QUICK REVIEW

[Paper Review] MetricHaven -- More Than 23,000 Metrics for Measuring Quality Attributes of Software Product Lines

Sascha El-Sharkawy, Adam Krafczyk|arXiv (Cornell University)|Oct 19, 2021
Software Engineering ResearchComputer Science17 references4 citations
TL;DR

MetricHaven is a scalable, open-source tool that enables the flexible computation of over 23,000 combined metrics for software product lines (SPLs), integrating traditional code metrics with variability-aware metrics and feature model metrics. It uses a unified abstract syntax tree (AST) to parse C code with preprocessor directives and supports parallel execution, enabling measurement of all 23,342 metric variations on the Linux kernel in under 3.5 hours—approximately 0.5 seconds per metric.

ABSTRACT

Variability-aware metrics are designed to measure qualitative aspects of software product lines. As we identified in a prior SLR \cite{El-SharkawyYamagishi-EichlerSchmid19}, there exist already many metrics that address code or variability separately, while the combination of both has been less researched. MetricHaven fills this gap, as it extensively supports combining information from code files and variability models. Further, we also enable the combination of well established single system metrics with novel variability-aware metrics, going beyond existing variability-aware metrics. Our tool supports most prominent single system and variability-aware code metrics. We provide configuration support for already implemented metrics, resulting in 23,342 metric variations. Further, we present an abstract syntax tree developed for MetricHaven, that allows the realization of additional code metrics. Tool: https://github.com/KernelHaven/MetricHaven Video: https://youtu.be/vPEmD5Sr6gM

Motivation & Objective

  • To address the lack of publicly available, extensible tool suites for measuring quality attributes in software product lines (SPLs) that combine code and variability information.
  • To support the flexible combination of traditional code metrics, variability-aware code metrics, and feature model metrics in a single analysis framework.
  • To provide a reusable, extensible infrastructure for researchers to develop, evaluate, and experiment with new variability-aware metrics.
  • To enable efficient, parallelized metric computation on large-scale SPLs such as the Linux kernel, reducing analysis time to under 3.5 hours for all metric variations.
  • To support practitioners in detecting code smells and quality issues in annotation-based SPLs through direct tool usage.

Proposed method

  • The tool is built as a plugin for KernelHaven, reusing its data models and parallel execution pipeline to enable scalable metric analysis.
  • A custom, unified abstract syntax tree (AST) is designed to represent both programming language constructs (e.g., C statements) and preprocessor directives (e.g., #if, #ifdef), enabling consistent metric computation across annotated code.
  • The AST supports fine-grained metric computation at the function level, allowing for efficient parallelization across multiple threads.
  • MetricHaven enables arbitrary combinations of metrics by allowing feature metrics (e.g., number of constraints per feature) to be used as inputs in variability-aware code metrics (e.g., McCabe’s cyclomatic complexity).
  • The system supports configuration-driven metric selection via property files, allowing users to run all 23,342 metric variations or specific subsets.
  • The tool leverages existing extractors for variability and build models, with extensibility to support new SPLs through additional extractors.

Experimental results

Research questions

  • RQ1How can traditional code metrics be effectively combined with variability-aware metrics to measure quality attributes in software product lines?
  • RQ2What is the scalability and performance of a unified metric computation framework that supports over 23,000 metric variations on large-scale SPLs?
  • RQ3To what extent can feature model metrics (e.g., number of constraints per feature) be integrated into code complexity metrics to reflect variability-induced complexity?
  • RQ4Can a shared AST representation effectively model both source code and preprocessor annotations without requiring full syntactic correctness?
  • RQ5How can an extensible, open-source tooling infrastructure support both research experimentation and industrial code quality analysis in SPLs?

Key findings

  • MetricHaven supports a total of 23,342 distinct metric variations by combining traditional code metrics, variability-aware code metrics, and feature model metrics.
  • The tool achieves high performance, measuring all 23,342 metric variations on the Linux kernel (version 4.15) in approximately 3.5 hours on a dual Xeon system with 128 GB RAM.
  • On average, each metric requires less than 1 second to compute across the entire Linux kernel source, equating to roughly 40ms per function.
  • The unified AST enables accurate modeling of preprocessor directives and code elements in a single, consistent structure, facilitating complex metric combinations.
  • The system demonstrates strong parallelization efficiency, with metric computation per function being highly parallelizable and scalable across multiple threads.
  • The framework enables novel metric combinations, such as using feature model complexity (e.g., NoC-metric) as a weight in cyclomatic complexity calculations, reflecting variability-induced complexity.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.