Parallel Program Tracing via Specification-Driven Code Generation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current tracing methods for computer programs are intrusive, affect program behavior, and increase execution time, making it difficult to analyze large amounts of trace information without tools, especially in DEBUG and RELEASE modes, and may mask bugs.
Innovation Solution
A device comprising non-transitory memory and processors that generate trace code from a trace specification program, allowing trace instructions to be inserted at predetermined locations in the computer program, executed in parallel, and recorded in a trace file, minimizing intrusion and enhancing performance by reducing tracing overhead.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of information
If traditional tracing methods are used to record program execution information, then trace data can be obtained for debugging and analysis, but the tracing process intrudes into program behavior and may mask bugs
Solution Approach 1:
The tracing system is divided into separate components: the main program execution thread and the trace recording thread operate independently. The trace code is segmented into specific recording instructions that are inserted at predetermined locations, allowing the program to be traced without uniformly intruding into all program operations.
Solution Approach 2:
A queue mechanism is introduced as an intermediary between the program execution and trace recording processes. The queue stores trace information generated during program execution, allowing the trace function to retrieve and process data without directly interfering with the main program flow, thus preventing bug masking.
2Loss of information
If traditional tracing methods insert auxiliary trace code into the program, then trace information can be recorded, but execution time increases due to tracing overhead
Solution Approach 1:
Instead of continuous tracing that would slow down every program operation, the system uses periodic action by inserting trace recording instructions only at predetermined locations where trace information is needed. This selective approach reduces the frequency of trace operations and minimizes execution time overhead.
Solution Approach 2:
The trace recording functionality is extracted from the main program execution flow and placed in a separate parallel thread. This allows the trace recording to occur concurrently with program execution, removing the time overhead from the critical program path while still capturing necessary trace information.
3Loss of information
If manual trace code insertion is performed to record specific variable states, then relevant trace information can be obtained, but the process is complex and requires programmer intervention
Solution Approach 1:
The tracing system provides universal functionality through a standardized trace specification program format that can define multiple types of trace information (variable states, execution flow, etc.) using a single unified approach. This eliminates the need for different manual insertion methods for different tracing needs, simplifying the overall process.
Solution Approach 2:
The trace specification program is prepared in advance, defining all trace recording requirements before program execution. This preliminary action automates the generation of trace code and its insertion at appropriate locations, eliminating the need for manual programmer intervention during the tracing setup phase.
4Ease of manufacture
If dynamic binary instrumentation is used to modify compiled binaries at run time, then tracing can be performed without recompilation, but the binary modification is intrusive and may alter program behavior
Solution Approach 1:
Instead of uniformly modifying the entire binary, the system applies local quality by inserting trace recording instructions only at specific predetermined locations where trace information is required. This selective modification approach maintains program behavior integrity while enabling effective tracing at critical points.
Solution Approach 2:
The tracing system creates a parallel copy of the execution flow in a separate thread that mirrors the main program's operations at predetermined locations. This copying approach allows trace data collection without directly modifying the original program's critical execution paths, preserving program behavior.
Data Source
AI summary
A device for tracing a computer program comprises a non-transitory memory having instructions and one or more processors in communication with the memory. The one or more processors execute the instructions to generate trace code from a trace specification program to trace the computer program. The one or more processors calculate values by executing the computer program and the trace code records, in parallel, the values at a predetermined location in execution of the computer program.


