Simple Runtime Analyzer
|
The output formats generated by the Simple Runtime Analyzer library are designed for both human readability and machine processing, ensuring compatibility with a wide range of analysis tools and visualization systems.
The library automatically detects the correct output format based on the file extension provided when saving data:
.txt
→ Plain Text Format.csv
→ CSV (Comma-Separated Values) Format.json
→ JSON (JavaScript Object Notation) FormatFor stream-based reporting using the generate_report
function, the format can be specified explicitly as a string ("text"
, "csv"
, or "json"
).
The choice of output format depends on the specific use case. The table below outlines the general compatibility of each format with common data analysis and programming tools.
Format | Excel | Python Pandas | JavaScript | R | Database |
---|---|---|---|---|---|
CSV | ✅ Excellent | ✅ Excellent | ✅ Good | ✅ Excellent | ✅ Excellent |
JSON | ⚠️ Fair | ✅ Excellent | ✅ Excellent | ✅ Good | ✅ Excellent |
Text | ⚠️ Poor | ⚠️ Fair | ⚠️ Fair | ⚠️ Fair | ❌ Poor |
The runtime_reporter
module generates profiling reports that summarize performance metrics.
This format is optimized for human readability and console output. The data is presented with fixed-width columns for clear alignment.
Sample [ID]: | Time: [value] [unit] | Sample size: [size]
.Example:
This is a machine-readable format optimized for data analysis and spreadsheet applications. It includes a header row for easy data import.
sample_id,time_unit,time_value,sample_size
.Example:
This structured format is ideal for programmatic consumption, such as in web applications or other software. The data is represented as an array of JSON objects, each with distinct keys for clarity.
"sample_id"
, "time_unit"
, "time_value"
, and "sample_size"
.Example:
The sample_utilities
module can serialize generated test data for later use. The save_samples
function handles this process, with different output formats for the samples themselves.
Each sample is written to a new line in the file. The format is a string representation of the iterable container.
[value1, value2, value3, ..., valueN]
.This format includes a header row and places each sample in a separate line, with the entire sample data quoted to ensure proper CSV parsing.
sample_id,sample_data
.Example:
This format stores the samples as an array of strings. Each string is the serialized representation of a single sample, with proper JSON escaping for special characters.
within the serialized strings.
Example: