Code Energy Defect Detection Using Dynamic Execution Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional code efficiency analysis techniques fail to account for dynamic interactions during code execution, leading to inefficiencies in energy consumption that are not addressed by static analysis methods.
Innovation Solution
A system utilizing machine-learning techniques to analyze computer code snippets through embedding models and a code defect detection model to identify and correct defects impacting dynamic energy efficiency, incorporating data from code commits, energy efficiency rules, and log key messages, and employing generative adversarial networks for training.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Device complexity
If static energy efficiency analysis is performed at higher levels of computer code, then analysis simplicity is improved, but measurement precision of dynamic energy efficiency deteriorates
Solution Approach 1:
The patent segments the code analysis process into multiple levels: static analysis at higher levels and dynamic analysis at lower levels. The system divides code into functions and basic blocks, analyzing each segment's energy consumption characteristics separately while considering their interactions during execution.
Solution Approach 2:
The patent transitions from static to dynamic analysis by introducing execution traces that capture actual runtime behavior. The system monitors energy consumption during code execution, allowing the analysis to adapt to dynamic interactions between code segments, memory access patterns, and processor states.
2Measurement precision
If dynamic interactions during code execution are accounted for, then measurement precision of energy efficiency is improved, but device complexity increases
Solution Approach 1:
The patent introduces an intermediary layer consisting of execution traces and instrumentation code that mediates between the complex dynamic execution environment and the analysis system. These traces capture essential energy-relevant events without requiring direct modification of the underlying hardware or operating system.
Solution Approach 2:
The patent performs preliminary instrumentation of the code before execution, embedding monitoring points at critical locations such as function boundaries and memory access points. This preliminary action prepares the system to capture energy consumption data efficiently during execution without adding complexity during the actual analysis phase.
3Measurement precision
If comprehensive analysis of code snippets is performed using machine-learning techniques, then detection precision of energy efficiency defects is improved, but loss of time in data collection and processing increases
Solution Approach 1:
The patent applies partial analysis by focusing machine learning techniques on specific high-impact code patterns identified through static analysis. Rather than analyzing all code equally, the system targets functions and basic blocks that are most likely to contain energy efficiency defects based on preliminary static assessment and historical data.
Solution Approach 2:
The patent performs preliminary static analysis and data preparation before applying machine learning models. Execution traces are pre-processed and feature-engineered in advance, allowing the machine learning component to work with prepared data structures that reduce processing time during actual defect detection.
Data Source
AI summary
Methods, computer systems, and apparatus, including computer programs encoded on computer storage media, for evaluating an energy efficiency of a computer code snippet. A computer-implemented system obtains code data characterizing a computer code snippet and rule data characterizing one or more energy efficiency rules, and processes the code data and rule data using machine-learning models to detect energy efficiency defects in the computer code snippet that negatively impact a dynamic energy efficiency of the computer code snippet upon execution by the computing device.


