Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-memory construction of profiling data #123

Merged
merged 1 commit into from
Aug 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions analyzeme/src/profiling_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ impl ProfilingData {
fs::read(paths.string_index_file).expect("couldn't read string_index file");
let event_data = fs::read(paths.events_file).expect("couldn't read events file");

ProfilingData::from_buffers(string_data, index_data, event_data)
}

pub fn from_buffers(
string_data: Vec<u8>,
string_index: Vec<u8>,
events: Vec<u8>,
) -> Result<ProfilingData, Box<dyn Error>> {
let index_data = string_index;
let event_data = events;

let event_data_format = read_file_header(&event_data, FILE_MAGIC_EVENT_STREAM)?;
if event_data_format != CURRENT_FILE_FORMAT_VERSION {
Err(format!(
Expand Down