-
Notifications
You must be signed in to change notification settings - Fork 49
v9 format: Increase StringId and Addr size to u64, fixing ICEs during self-profiling #216
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,84 @@ | ||
//! This module implements file loading for the v8 file format used until | ||
//! crate version 10.0.0 | ||
//! crate version 10.0.0. | ||
//! | ||
//! The difference from v8 to v9 copes with the expansion of StringId and Addr | ||
//! types from u32 to u64. Most of the EventDecoder interface is actually | ||
//! unchanged, but the construction of "EventDecoder::new", which parses | ||
//! the stream of events, varies based on these sizes. | ||
//! | ||
//! This file provides conversions to current interfaces, relying on an | ||
//! old version of this crate to parse the u32-based v8 version. | ||
|
||
use crate::{Event, LightweightEvent}; | ||
pub use decodeme::EventDecoder; | ||
use crate::{Event, EventPayload, LightweightEvent, Timestamp}; | ||
use decodeme::Metadata; | ||
use decodeme_10_1_2::event_payload::EventPayload as OldEventPayload; | ||
use decodeme_10_1_2::event_payload::Timestamp as OldTimestamp; | ||
use decodeme_10_1_2::lightweight_event::LightweightEvent as OldLightweightEvent; | ||
pub use decodeme_10_1_2::EventDecoder; | ||
use decodeme_10_1_2::Metadata as OldMetadata; | ||
|
||
pub const FILE_FORMAT: u32 = decodeme::CURRENT_FILE_FORMAT_VERSION; | ||
pub const FILE_FORMAT: u32 = measureme_10_1_2::file_header::CURRENT_FILE_FORMAT_VERSION; | ||
|
||
// NOTE: These are functionally a hand-rolled "impl From<Old> -> New", but | ||
// given orphan rules, it seems undesirable to spread version-specific | ||
// converters around the codebase. | ||
// | ||
// In lieu of an idiomatic type conversion, we at least centralize compatibility | ||
// with the old "v8" version to this file. | ||
|
||
fn v8_metadata_as_current(old: &OldMetadata) -> Metadata { | ||
Metadata { | ||
start_time: old.start_time, | ||
process_id: old.process_id, | ||
cmd: old.cmd.clone(), | ||
} | ||
} | ||
|
||
fn v8_timestamp_as_current(old: OldTimestamp) -> Timestamp { | ||
match old { | ||
OldTimestamp::Interval { start, end } => Timestamp::Interval { start, end }, | ||
OldTimestamp::Instant(t) => Timestamp::Instant(t), | ||
} | ||
} | ||
|
||
fn v8_event_payload_as_current(old: OldEventPayload) -> EventPayload { | ||
match old { | ||
OldEventPayload::Timestamp(t) => EventPayload::Timestamp(v8_timestamp_as_current(t)), | ||
OldEventPayload::Integer(t) => EventPayload::Integer(t), | ||
} | ||
} | ||
|
||
fn v8_lightweightevent_as_current(old: OldLightweightEvent) -> LightweightEvent { | ||
LightweightEvent { | ||
event_index: old.event_index, | ||
thread_id: old.thread_id, | ||
payload: v8_event_payload_as_current(old.payload), | ||
} | ||
} | ||
|
||
impl super::EventDecoder for EventDecoder { | ||
fn num_events(&self) -> usize { | ||
self.num_events() | ||
} | ||
|
||
fn metadata(&self) -> &Metadata { | ||
self.metadata() | ||
fn metadata(&self) -> Metadata { | ||
let old = self.metadata(); | ||
v8_metadata_as_current(&old) | ||
} | ||
|
||
fn decode_full_event(&self, event_index: usize) -> Event<'_> { | ||
self.decode_full_event(event_index) | ||
let old = self.decode_full_event(event_index); | ||
|
||
Event { | ||
event_kind: old.event_kind, | ||
label: old.label, | ||
additional_data: old.additional_data, | ||
payload: v8_event_payload_as_current(old.payload), | ||
thread_id: old.thread_id, | ||
} | ||
} | ||
|
||
fn decode_lightweight_event(&self, event_index: usize) -> LightweightEvent { | ||
self.decode_lightweight_event(event_index) | ||
v8_lightweightevent_as_current(self.decode_lightweight_event(event_index)) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! This module implements file loading for the v9 file format | ||
|
||
use crate::{Event, LightweightEvent}; | ||
pub use decodeme::EventDecoder; | ||
use decodeme::Metadata; | ||
|
||
pub const FILE_FORMAT: u32 = decodeme::CURRENT_FILE_FORMAT_VERSION; | ||
|
||
impl super::EventDecoder for EventDecoder { | ||
fn num_events(&self) -> usize { | ||
self.num_events() | ||
} | ||
|
||
fn metadata(&self) -> Metadata { | ||
self.metadata() | ||
} | ||
|
||
fn decode_full_event(&self, event_index: usize) -> Event<'_> { | ||
self.decode_full_event(event_index) | ||
} | ||
|
||
fn decode_lightweight_event(&self, event_index: usize) -> LightweightEvent { | ||
self.decode_lightweight_event(event_index) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.