Skip to content

Commit

Permalink
Update all deps (#79)
Browse files Browse the repository at this point in the history
* Update nix deps

* Update Rust deps

And fix new lints
  • Loading branch information
javierhonduco authored Oct 1, 2024
1 parent d510e79 commit 1e5a3ec
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 250 deletions.
288 changes: 96 additions & 192 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ object = "0.36.4"
memmap2 = "0.9.5"
lazy_static = "1.5.0"
anyhow = "1.0.89"
thiserror = "1.0.63"
thiserror = "1.0.64"
libbpf-rs = { version = "0.23.3", features = ["static"] }
perf-event-open-sys = "4.0.0"
libc = "0.2.158"
libc = "0.2.159"
errno = "0.3.9"
plain = "0.2.3"
procfs = "0.16.0"
ring = "0.17.8"
data-encoding = "2.6.0"
page_size = "0.6.0"
clap = { version = "4.5.17", features = ["derive", "string"] }
clap = { version = "4.5.18", features = ["derive", "string"] }
blazesym = "0.2.0-rc.1"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
chrono = "0.4.38"
inferno = "0.11.21"
primal = "0.3.3"
nix = { version = "0.29.0", features = ["user"] }
prost = "0.12" # Needed to encode protocol buffers to bytes.
prost = "0.13" # Needed to encode protocol buffers to bytes.
reqwest = { version = "0.12", features = ["blocking"] }
lightswitch-proto = { path = "./lightswitch-proto"}
lightswitch-capabilities = {path = "./lightswitch-capabilities"}
Expand All @@ -43,14 +43,14 @@ crossbeam-channel = "0.5.13"
[dev-dependencies]
assert_cmd = { version = "2.0.16" }
insta = { version = "1.40.0", features = ["yaml"] }
rstest = "0.21.0"
rstest = "0.23.0"
tempdir = "0.3.7"
rand = "0.8.5"
criterion = "0.5.1"
tempfile = "3.12.0"
tempfile = "3.13.0"

[build-dependencies]
bindgen = "0.69.4"
bindgen = "0.70.1"
libbpf-cargo = "0.23.3"
glob = "0.3.1"

Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lightswitch-capabilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ edition = "2021"

[dependencies]
anyhow = "1.0.89"
thiserror = "1.0.63"
thiserror = "1.0.64"
libbpf-rs = { version = "0.23.3", features = ["static"] }
perf-event-open-sys = "4.0.0"
libc = "0.2.158"
libc = "0.2.159"
errno = "0.3.9"
procfs = "0.16.0"
tracing = "0.1.40"
nix = { version = "0.29.0", features = ["user"] }

[build-dependencies]
bindgen = "0.69.4"
bindgen = "0.70.1"
libbpf-cargo = "0.23.3"
glob = "0.3.1"
2 changes: 1 addition & 1 deletion lightswitch-capabilities/src/system_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl Drop for DroppableFiledescriptor {
}

fn tracefs_mount_detected() -> bool {
return Path::new(TRACEFS_PATH).exists();
Path::new(TRACEFS_PATH).exists()
}

fn get_trace_sched_event_id(trace_event: &str) -> Result<u32> {
Expand Down
4 changes: 2 additions & 2 deletions lightswitch-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
prost = "0.12"
prost = "0.13"
anyhow = "1.0.89"

[build-dependencies]
prost-build = "0.13.2"
prost-build = "0.13.3"
16 changes: 4 additions & 12 deletions lightswitch-proto/src/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ impl PprofBuilder {
}

match self.known_strings.entry(string.to_string()) {
Entry::Occupied(o) => {
return *o.get();
}
Entry::Occupied(o) => *o.get(),
Entry::Vacant(v) => {
let id = self.string_table.len() as i64;
v.insert(id);
Expand All @@ -168,9 +166,7 @@ impl PprofBuilder {
};

match self.known_functions.entry(name_idx) {
Entry::Occupied(o) => {
return *o.get();
}
Entry::Occupied(o) => *o.get(),
Entry::Vacant(v) => {
let id = self.functions.len() as u64 + 1;
v.insert(id);
Expand Down Expand Up @@ -205,9 +201,7 @@ impl PprofBuilder {
let unique_id = (address, mapping_id);

match self.known_locations.entry(unique_id) {
Entry::Occupied(o) => {
return *o.get();
}
Entry::Occupied(o) => *o.get(),
Entry::Vacant(v) => {
let id = self.locations.len() as u64 + 1;
v.insert(id);
Expand Down Expand Up @@ -242,9 +236,7 @@ impl PprofBuilder {
};

match self.known_mappings.entry(mapping.id) {
Entry::Occupied(o) => {
return *o.get();
}
Entry::Occupied(o) => *o.get(),
Entry::Vacant(v) => {
let id = self.mappings.len() as u64 + 1;
v.insert(id);
Expand Down
24 changes: 1 addition & 23 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,13 @@ fn value_is_power_of_two(s: &str) -> Result<usize, String> {
.parse()
.map_err(|_| format!("`{s}' isn't a valid usize"))?;
// Now we have a value, test whether it's a power of 2
if is_power_of_two(value) {
if value.is_power_of_two() {
Ok(value)
} else {
Err(format!("{} is not a power of 2", value))
}
}

fn is_power_of_two(v: usize) -> bool {
// NOTE: Neither 0 nor 1 are a power of 2 (ignoring 2^0 for this use case),
// so rule them out
(v != 0) && (v != 1) && ((v & (v - 1)) == 0)
}

/// Given a non-prime unsigned int, return the prime number that precedes it
/// as well as the prime that succeeds it
fn primes_before_after(non_prime: usize) -> Result<(usize, usize), String> {
Expand Down Expand Up @@ -551,22 +545,6 @@ mod tests {
test_uint_strings
}

// Testing is_power_of_two predicate used by perf_buffer_bytes
// value_parser()
#[rstest]
fn test_should_be_powers_of_two(power_of_two_usize: Vec<usize>) {
for val in power_of_two_usize {
assert!(is_power_of_two(val))
}
}

#[rstest]
fn test_should_not_be_powers_of_two(all_but_power_of_two_usize: Vec<usize>) {
for val in all_but_power_of_two_usize {
assert!(!is_power_of_two(val))
}
}

// Testing the value_parser() implementation for perf_buffer_bytes
#[rstest]
fn args_should_be_powers_of_two(power_of_two_strings: Vec<String>) {
Expand Down
2 changes: 1 addition & 1 deletion src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl ObjectFile<'_> {
}

// No build id (Rust, some compilers and Linux distributions).
return Ok(BuildId::Sha256(HEXLOWER.encode(self.code_hash.as_ref())));
Ok(BuildId::Sha256(HEXLOWER.encode(self.code_hash.as_ref())))
}

pub fn is_dynamic(&self) -> bool {
Expand Down

0 comments on commit 1e5a3ec

Please sign in to comment.