Skip to main content

Module metrics

Module metrics 

Source
Expand description

Strongly-typed VFS activity metrics.

The sqlite-objs VFS tracks per-connection I/O counters. These are returned as a newline-separated key=value text string via SQLITE_OBJS_FCNTL_STATS or PRAGMA sqlite_objs_stats.

This module provides VfsMetrics — a typed struct that parses the C output into native Rust i64 fields — and a ParseError for malformed input.

§Example

use sqlite_objs::metrics::VfsMetrics;

let text = "\
    disk_reads=10\n\
    disk_writes=5\n\
    disk_bytes_read=40960\n\
    disk_bytes_written=20480\n\
    blob_reads=2\n\
    blob_writes=1\n\
    blob_bytes_read=1048576\n\
    blob_bytes_written=4096\n\
    cache_hits=100\n\
    cache_misses=3\n\
    cache_miss_pages=12\n\
    prefetch_pages=256\n\
    lease_acquires=1\n\
    lease_renewals=0\n\
    lease_releases=1\n\
    syncs=2\n\
    dirty_pages_synced=5\n\
    blob_resizes=0\n\
    revalidations=1\n\
    revalidation_downloads=0\n\
    revalidation_diffs=1\n\
    pages_invalidated=0\n\
    journal_uploads=1\n\
    journal_bytes_uploaded=4096\n\
    wal_uploads=0\n\
    wal_bytes_uploaded=0\n\
    azure_errors=0";

let m = VfsMetrics::parse(text).unwrap();
assert_eq!(m.disk_reads, 10);
assert_eq!(m.cache_hits, 100);

Structs§

ParseError
Error returned when VfsMetrics::parse cannot interpret the C output.
VfsMetrics
Per-connection VFS activity counters.