Module results

Source
Expand description

Analyzes and processes final analysis results for bit-packed data structures.

This module handles the final stage of analysis, computing metrics and statistics from processed bit-packed data. It provides comprehensive analysis capabilities including entropy calculations, LZ compression analysis, and field-level statistics.

§Core Types

§Key Features

  • Field-level and file-level entropy analysis
  • LZ compression match detection
  • Size estimation and actual compression metrics
  • Bit distribution statistics
  • Value frequency analysis
  • Split comparison results

§Public APIs

Key types and functions for users of this module:

§Types

§Functions

§Example

use struct_compression_analyzer::{analyzer::SchemaAnalyzer, schema::Schema};
use struct_compression_analyzer::results::analysis_results::AnalysisResults;
use struct_compression_analyzer::analyzer::CompressionOptions;

fn analyze_data(schema: &Schema, data: &[u8]) -> AnalysisResults {
    let options = CompressionOptions::default();
    let mut analyzer = SchemaAnalyzer::new(schema, options);
    analyzer.add_entry(data);
    analyzer.generate_results().unwrap()
}

§Output Formats

Results can be displayed in two formats (console):

  • Detailed: Comprehensive analysis with full metrics
  • Concise: Condensed summary of key statistics

Groups of results (multiple files) can also be displayed via one of the other modules.

  • CSV: CSV representation of results. Export to spreadsheets.
  • Plot: Generate plots of results.

§Field Metrics

For each field, the analysis computes:

  • Shannon entropy in bits
  • LZ compression matches
  • Bit-level distribution
  • Value frequency counts
  • Size estimates (original, compressed, estimated)

Fields can be analyzed individually or merged for group analysis.

§Implementation Notes

  • Handles both MSB and LSB bit ordering
  • Supports nested field hierarchies
  • Provides parent/child relationship tracking
  • Implements efficient metric merging for group analysis

Modules§

analysis_results
merged_analysis_results

Structs§

FieldMetrics
Complete analysis metrics for a single field

Enums§

AnalysisMergeError
Error type for when merging analysis results fails.
ComputeAnalysisResultsError
Error type for when something goes wrong when computing the final analysis results.
PrintFormat