diff --git a/Cargo.toml b/Cargo.toml index ccaf86b..2f7615e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,15 +21,14 @@ repository = "https://github.com/rust-lang/measureme" [workspace.dependencies] analyzeme = { path = "analyzeme" } -analyzeme_9_2_0 = { package = "analyzeme", git = "https://github.com/rust-lang/measureme", tag = "9.2.0" } clap = { version = "4.5.0", features = ["derive"] } decodeme = { path = "decodeme" } -decodeme_10_1_2 = { package = "decodeme", git = "https://github.com/rust-lang/measureme", tag = "10.1.2" } +decodeme_10 = { version = "10.1.3", package = "decodeme" } flate2 = "1.0" inferno = { version = "0.11", default-features = false } log = "0.4" measureme = { path = "measureme" } -measureme_10_1_2 = { package = "measureme", git = "https://github.com/rust-lang/measureme", tag = "10.1.2" } +measureme_10 = { version = "10.1.3", package = "measureme" } memchr = "2" memmap2 = "0.2.1" parking_lot = "0.12.0" diff --git a/analyzeme/Cargo.toml b/analyzeme/Cargo.toml index 95b4b4a..bd86d18 100644 --- a/analyzeme/Cargo.toml +++ b/analyzeme/Cargo.toml @@ -17,12 +17,9 @@ serde.workspace = true # Depending on older versions of this crate allows us to keep supporting older # file formats. -# File format: v7 -analyzeme_9_2_0.workspace = true - # File format: v8 -decodeme_10_1_2.workspace = true -measureme_10_1_2.workspace = true +decodeme_10.workspace = true +measureme_10.workspace = true [dev-dependencies] flate2.workspace = true diff --git a/analyzeme/src/file_formats/mod.rs b/analyzeme/src/file_formats/mod.rs index 7c2e27f..61ede59 100644 --- a/analyzeme/src/file_formats/mod.rs +++ b/analyzeme/src/file_formats/mod.rs @@ -1,7 +1,6 @@ use decodeme::{event::Event, lightweight_event::LightweightEvent, Metadata}; use std::fmt::Debug; -pub mod v7; pub mod v8; pub mod v9; diff --git a/analyzeme/src/file_formats/v7.rs b/analyzeme/src/file_formats/v7.rs deleted file mode 100644 index 57e4570..0000000 --- a/analyzeme/src/file_formats/v7.rs +++ /dev/null @@ -1,78 +0,0 @@ -//! This module implements file loading for the v7 file format used until -//! crate version 9.2.0 - -use std::error::Error; - -use analyzeme_9_2_0::ProfilingData; -use decodeme::{ - event::Event, - event_payload::{EventPayload, Timestamp}, - lightweight_event::LightweightEvent, - Metadata, -}; - -pub const FILE_FORMAT: u32 = analyzeme_9_2_0::CURRENT_FILE_FORMAT_VERSION; - -#[derive(Debug)] -pub struct EventDecoder { - legacy_profiling_data: ProfilingData, - metadata: Metadata, -} - -impl EventDecoder { - pub fn new(entire_file_data: Vec) -> Result> { - let legacy_profiling_data = ProfilingData::from_paged_buffer(entire_file_data)?; - - let metadata = Metadata { - start_time: legacy_profiling_data.metadata.start_time, - cmd: legacy_profiling_data.metadata.cmd.clone(), - process_id: legacy_profiling_data.metadata.process_id, - }; - - Ok(EventDecoder { - legacy_profiling_data, - metadata, - }) - } -} - -impl super::EventDecoder for EventDecoder { - fn num_events(&self) -> usize { - self.legacy_profiling_data.num_events() - } - - fn metadata(&self) -> Metadata { - self.metadata.clone() - } - - fn decode_full_event(&self, event_index: usize) -> Event<'_> { - let legacy_event = self.legacy_profiling_data.decode_full_event(event_index); - let timestamp = convert_timestamp(legacy_event.timestamp); - - Event { - event_kind: legacy_event.event_kind, - label: legacy_event.label, - additional_data: legacy_event.additional_data, - thread_id: legacy_event.thread_id, - payload: EventPayload::Timestamp(timestamp), - } - } - - fn decode_lightweight_event(&self, event_index: usize) -> LightweightEvent { - let legacy_event = self - .legacy_profiling_data - .decode_lightweight_event(event_index); - LightweightEvent { - event_index, - thread_id: legacy_event.thread_id, - payload: EventPayload::Timestamp(convert_timestamp(legacy_event.timestamp)), - } - } -} - -fn convert_timestamp(legacy_timestamp: analyzeme_9_2_0::Timestamp) -> Timestamp { - match legacy_timestamp { - analyzeme_9_2_0::Timestamp::Interval { start, end } => Timestamp::Interval { start, end }, - analyzeme_9_2_0::Timestamp::Instant(t) => Timestamp::Instant(t), - } -} diff --git a/analyzeme/src/file_formats/v8.rs b/analyzeme/src/file_formats/v8.rs index 23d01fc..0955e4d 100644 --- a/analyzeme/src/file_formats/v8.rs +++ b/analyzeme/src/file_formats/v8.rs @@ -11,13 +11,13 @@ 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; +use decodeme_10::event_payload::EventPayload as OldEventPayload; +use decodeme_10::event_payload::Timestamp as OldTimestamp; +use decodeme_10::lightweight_event::LightweightEvent as OldLightweightEvent; +pub use decodeme_10::EventDecoder; +use decodeme_10::Metadata as OldMetadata; -pub const FILE_FORMAT: u32 = measureme_10_1_2::file_header::CURRENT_FILE_FORMAT_VERSION; +pub const FILE_FORMAT: u32 = measureme_10::file_header::CURRENT_FILE_FORMAT_VERSION; // NOTE: These are functionally a hand-rolled "impl From -> New", but // given orphan rules, it seems undesirable to spread version-specific diff --git a/analyzeme/src/profiling_data.rs b/analyzeme/src/profiling_data.rs index d8fda6b..08d1a89 100644 --- a/analyzeme/src/profiling_data.rs +++ b/analyzeme/src/profiling_data.rs @@ -60,7 +60,6 @@ impl ProfilingData { )?; let event_decoder: Box = match file_format_version { - file_formats::v7::FILE_FORMAT => Box::new(file_formats::v7::EventDecoder::new(data)?), file_formats::v8::FILE_FORMAT => Box::new(file_formats::v8::EventDecoder::new( data, diagnostic_file_path, @@ -539,61 +538,6 @@ mod tests { use std::collections::{HashMap, HashSet}; use std::io::Read; - #[test] - fn can_read_v7_profdata_files() { - let (data, file_format_version) = - read_data_and_version("tests/profdata/v7.mm_profdata.gz"); - assert_eq!(file_format_version, file_formats::v7::FILE_FORMAT); - let profiling_data = ProfilingData::from_paged_buffer(data, None) - .expect("Creating the profiling data failed"); - let grouped_events = group_events(&profiling_data); - let event_kinds = grouped_events - .keys() - .map(|k| k.as_str()) - .collect::>(); - let expect_event_kinds = vec!["GenericActivity", "IncrementalResultHashing", "Query"] - .into_iter() - .collect::>(); - assert_eq!(event_kinds, expect_event_kinds); - - let generic_activity_len = 6425; - let incremental_hashing_len = 2237; - let query_len = 2260; - assert_eq!( - grouped_events["GenericActivity"].len(), - generic_activity_len - ); - assert_eq!( - grouped_events["IncrementalResultHashing"].len(), - incremental_hashing_len - ); - assert_eq!(grouped_events["Query"].len(), query_len); - - assert_eq!( - &*grouped_events["GenericActivity"][generic_activity_len / 2].label, - "incr_comp_encode_dep_graph" - ); - assert_eq!( - grouped_events["GenericActivity"][generic_activity_len / 2].duration(), - Some(Duration::from_nanos(200)) - ); - - assert_eq!( - &*grouped_events["IncrementalResultHashing"][incremental_hashing_len - 1].label, - "item_children" - ); - assert_eq!( - grouped_events["IncrementalResultHashing"][incremental_hashing_len - 1].duration(), - Some(Duration::from_nanos(300)) - ); - - assert_eq!(&*grouped_events["Query"][0].label, "hir_crate"); - assert_eq!( - grouped_events["Query"][0].duration(), - Some(Duration::from_nanos(16800)) - ); - } - #[test] fn can_read_v8_profdata_files() { let (data, file_format_version) = diff --git a/analyzeme/tests/profdata/v7.mm_profdata.gz b/analyzeme/tests/profdata/v7.mm_profdata.gz deleted file mode 100644 index 232ca0b..0000000 Binary files a/analyzeme/tests/profdata/v7.mm_profdata.gz and /dev/null differ