ring-file 0.2.0

A debugging tool with ring buffer like file struture, for high-performance code development
Documentation

RingFile

crates.io: crates.io docs.rs: docs.rs

The purpose of this tool is to help debug deadlock problems, that only occur under high-performance scenarios. Because writing log to disk will slow down execution, which makes deadlock hidden without racing conditions met.

This crate provides a ringbuffer like file, in order to store byte content. Already integrated into captain-log as LogRingFile sink.

The content is kept in memory when written, when offset rewinds, new content will overwrite old content, So that memory consumption is limited to buf_size. Once deadlock encountered and process hangs, no more message will be written, you can safely dump the content to disk.

Example:

use ring_file::RingFile;
let mut file = RingFile::new(512*1024*1024, "/tmp/ringfile.log");
file.write_all("log message").expect("write ok");
file.dump().expect("dump ok");