diff --git a/common/edit-distance/src/bubbles.rs b/common/edit-distance/src/bubbles.rs index fb1ef9b..e3486c5 100644 --- a/common/edit-distance/src/bubbles.rs +++ b/common/edit-distance/src/bubbles.rs @@ -227,16 +227,6 @@ where self.current() } - pub fn interpolate<'b>(&'b mut self, interpolate_percentage: u8) -> Perm<'a, 'b, T> { - let m = (self.history_size * (interpolate_percentage as usize)) / 100; - if m > self.history_cursor { - self.skip(m - self.history_cursor); - } else { - self.skip_back(self.history_cursor - m); - } - self.current() - } - pub fn history_size(&self) -> usize { self.history_size } diff --git a/hermit-cli/src/bin/hermit/main.rs b/hermit-cli/src/bin/hermit/main.rs index 1e5856a..cd22114 100644 --- a/hermit-cli/src/bin/hermit/main.rs +++ b/hermit-cli/src/bin/hermit/main.rs @@ -85,7 +85,6 @@ enum Subcommand { /// Take the difference of two (run/record) logs written to files. LogDiff(LogDiffCLIOpts), - /// Analyze Pass and failing runs Analyze(AnalyzeOpts), } diff --git a/hermit-verify/src/internal/mod.rs b/hermit-verify/src/internal/mod.rs deleted file mode 100644 index 493cd97..0000000 --- a/hermit-verify/src/internal/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -mod schedule_trace; - -use clap::Parser; -pub use schedule_trace::SchedTraceOpts; - -use crate::CommonOpts; - -#[derive(Debug, Parser)] -pub struct InternalOpts { - #[clap(subcommand)] - pub internal_command: InternalSubcommand, -} - -#[derive(Debug, Parser)] -pub enum InternalSubcommand { - /// Schedule Trace - #[clap(subcommand)] - SchedTrace(SchedTraceOpts), -} - -impl InternalSubcommand { - pub fn main(&self, common_args: &CommonOpts) -> anyhow::Result { - match self { - InternalSubcommand::SchedTrace(x) => x.main(common_args), - } - } -} diff --git a/hermit-verify/src/internal/schedule_trace.rs b/hermit-verify/src/internal/schedule_trace.rs deleted file mode 100644 index 164ccb8..0000000 --- a/hermit-verify/src/internal/schedule_trace.rs +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -use std::path::PathBuf; - -use clap::Parser; -use colored::Colorize; -use detcore::preemptions::read_trace; -use detcore::preemptions::PreemptionRecord; -use edit_distance::iterable_bubble_sort; - -use crate::CommonOpts; - -#[derive(Debug, Parser)] -pub enum SchedTraceOpts { - /// Difference between two preempt files - Diff(DiffOpts), - - /// Run the interpolation between two preempt files - Interpolate(InterpolateOpts), -} - -impl SchedTraceOpts { - pub fn main(&self, common_args: &CommonOpts) -> anyhow::Result { - match self { - SchedTraceOpts::Diff(x) => x.run(common_args), - SchedTraceOpts::Interpolate(x) => x.run(common_args), - } - } -} - -#[derive(Debug, Parser)] -pub struct DiffOpts { - /// First log to compare. - file_a: PathBuf, - /// Second log to compare. - file_b: PathBuf, -} - -impl DiffOpts { - pub fn run(&self, _common_args: &CommonOpts) -> anyhow::Result { - let first_schedule = read_trace(&self.file_a); - let second_schedule = read_trace(&self.file_b); - println!("first schedule length: {}", first_schedule.len()); - println!("second schedule length: {}", second_schedule.len()); - let bubbles = iterable_bubble_sort(&first_schedule, &second_schedule); - eprintln!( - ":: {}", - format!("Diffs found in schedules {} ", bubbles.swap_distance()) - .yellow() - .bold() - ); - Ok(true) - } -} - -#[derive(Debug, Parser)] -pub struct InterpolateOpts { - /// Interpolate file a and b by how much percentage. Currently, it takes an integer between 0 and 100. - interpolate: u8, - - /// First log to compare. - file_a: PathBuf, - - /// Second log to compare. - file_b: PathBuf, -} - -impl InterpolateOpts { - pub fn run(&self, _common_args: &CommonOpts) -> anyhow::Result { - let first_schedule = read_trace(&self.file_a); - let second_schedule = read_trace(&self.file_b); - // let i = 0; - let dir = tempfile::Builder::new() - .prefix("hermit_internal") - .tempdir()?; - let tmpdir_path = dir.into_path(); - eprintln!(":: Temp workspace: {}", tmpdir_path.display()); - let (_swap_dist, _edit_dist, requested_schedule) = { - let mut bubbles = iterable_bubble_sort(&first_schedule, &second_schedule); - ( - bubbles.swap_distance(), - bubbles.edit_distance(), - bubbles - .interpolate(self.interpolate) - .cloned() - .collect::>(), - ) - }; - let sched_path = tmpdir_path.join(format!("interpolate_{}.events", self.interpolate)); - let next_sched = PreemptionRecord::from_sched_events(requested_schedule); - next_sched.write_to_disk(&sched_path).unwrap(); - - Ok(true) - } -} diff --git a/hermit-verify/src/main.rs b/hermit-verify/src/main.rs index 87c86c5..62c1fce 100644 --- a/hermit-verify/src/main.rs +++ b/hermit-verify/src/main.rs @@ -12,7 +12,6 @@ use clap::Subcommand; mod cli_wrapper; mod common; -mod internal; mod run; mod trace_replay; mod use_case; @@ -21,8 +20,6 @@ use colored::*; pub use common::CommonOpts; use use_case::run_use_case; -use self::internal::InternalOpts; - #[derive(Parser, Debug)] #[clap(author = "oncall+hermit@xmail.facebook.com")] struct Args { @@ -37,8 +34,6 @@ struct Args { pub enum Commands { Run(run::RunOpts), TraceReplay(trace_replay::TraceReplayOpts), - /// Internal features - Internal(InternalOpts), } #[fbinit::main] @@ -51,7 +46,6 @@ fn main() -> Result<()> { let result = match command { Commands::Run(cmd) => run_use_case(cmd, &common_opts)?, Commands::TraceReplay(cmd) => run_use_case(cmd, &common_opts)?, - Commands::Internal(cmd) => cmd.internal_command.main(&common_opts)?, }; if !result {