Skip to content

Commit

Permalink
Display: Add ability to skip sections
Browse files Browse the repository at this point in the history
The KVM and MSR sections can now be skipped when display is run.
  • Loading branch information
andrewjj20 committed Jun 15, 2023
1 parent 860f5c2 commit 8011b58
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ enum CommandOpts {

#[derive(StructOpt)]
struct Disp {
#[structopt(short, long)]
#[structopt(short = "r", long)]
display_raw: bool,
#[cfg(all(target_os = "linux", feature = "kvm"))]
#[structopt(long)]
skip_kvm: bool,
#[structopt(long)]
skip_msr: bool,
}

impl Command for Disp {
Expand All @@ -53,7 +58,7 @@ impl Command for Disp {
}

#[cfg(all(target_os = "linux", feature = "kvm"))]
{
if !self.skip_kvm {
use cpuinfo::kvm::KvmInfo;
use kvm_ioctls::Kvm;
println!("KVM-CPUID:");
Expand All @@ -71,7 +76,7 @@ impl Command for Disp {
}
}

if MSRDesc::is_availible() {
if MSRDesc::is_availible() && self.skip_msr {
println!("MSRS:");
for msr in &config.msrs {
match msr.into_value() {
Expand Down

0 comments on commit 8011b58

Please sign in to comment.