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

fix(analyzeme): drop the support of v7 profdata format #232

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 2 additions & 5 deletions analyzeme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion analyzeme/src/file_formats/mod.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
78 changes: 0 additions & 78 deletions analyzeme/src/file_formats/v7.rs

This file was deleted.

12 changes: 6 additions & 6 deletions analyzeme/src/file_formats/v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Old> -> New", but
// given orphan rules, it seems undesirable to spread version-specific
Expand Down
56 changes: 0 additions & 56 deletions analyzeme/src/profiling_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ impl ProfilingData {
)?;

let event_decoder: Box<dyn file_formats::EventDecoder> = 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,
Expand Down Expand Up @@ -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::<HashSet<_>>();
let expect_event_kinds = vec!["GenericActivity", "IncrementalResultHashing", "Query"]
.into_iter()
.collect::<HashSet<_>>();
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) =
Expand Down
Binary file removed analyzeme/tests/profdata/v7.mm_profdata.gz
Binary file not shown.