Skip to content
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
50 changes: 50 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions libdd-profiling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ name = "main"
harness = false

[dependencies]
allocator-api2 = { version = "0.2", default-features = false, features = ["alloc"] }
anyhow = "1.0"
bitmaps = "3.2.0"
byteorder = { version = "1.5", features = ["std"] }
Expand All @@ -30,6 +31,7 @@ libdd-alloc = { version = "1.0.0", path = "../libdd-alloc" }
libdd-profiling-protobuf = { version = "1.0.0", path = "../libdd-profiling-protobuf", features = ["prost_impls"] }
libdd-common = { version = "1.0.0", path = "../libdd-common" }
futures = { version = "0.3", default-features = false }
hashbrown = { version = "0.16", default-features = false }
http = "1.0"
hyper = { workspace = true}
http-body-util = "0.1"
Expand All @@ -42,6 +44,7 @@ rustc-hash = { version = "1.1", default-features = false }
serde = {version = "1.0", features = ["derive"]}
serde_json = {version = "1.0"}
target-triple = "0.1.4"
thiserror = "2"
tokio = {version = "1.23", features = ["rt", "macros"]}
tokio-util = "0.7.1"
zstd = { version = "0.13", default-features = false }
Expand All @@ -50,3 +53,4 @@ zstd = { version = "0.13", default-features = false }
bolero = "0.13"
criterion = "0.5.1"
lz4_flex = { version = "0.9", default-features = false, features = ["std", "frame"] }
proptest = "1"
2 changes: 1 addition & 1 deletion libdd-profiling/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ pub mod exporter;
pub mod internal;
pub mod iter;
pub mod pprof;
mod profiles;
pub mod profiles;
5 changes: 2 additions & 3 deletions libdd-profiling/src/pprof/test_utils.rs
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file fix warnings under miri. Not the UB kind of warnings, just regular clippy style warnings.

Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
// Copyright 2023-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use anyhow::Context;
use libdd_profiling_protobuf::prost_impls::{Profile, Sample};
use std::io::Cursor;

fn deserialize_compressed_pprof(encoded: &[u8]) -> anyhow::Result<Profile> {
use prost::Message;
use std::io::Read;

// The zstd bindings use FFI so they don't work under miri. This means the
// buffer isn't compressed, so simply convert to a vec.
#[cfg(miri)]
let buf = encoded.to_vec();
#[cfg(not(miri))]
let buf = {
use anyhow::Context;
use std::io::{Cursor, Read};
let mut decoder =
zstd::Decoder::new(Cursor::new(encoded)).context("failed to create zstd decoder")?;
let mut out = Vec::new();
Expand Down
29 changes: 29 additions & 0 deletions libdd-profiling/src/profiles/collections/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2025-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

#[repr(C)]
#[derive(Debug, thiserror::Error)]
pub enum SetError {
#[error("set error: invalid argument")]
InvalidArgument,
#[error("set error: out of memory")]
OutOfMemory,
}

impl From<libdd_alloc::AllocError> for SetError {
fn from(_: libdd_alloc::AllocError) -> Self {
SetError::OutOfMemory
}
}

impl From<std::collections::TryReserveError> for SetError {
fn from(_: std::collections::TryReserveError) -> Self {
SetError::OutOfMemory
}
}

impl From<hashbrown::TryReserveError> for SetError {
fn from(_: hashbrown::TryReserveError) -> Self {
SetError::OutOfMemory
}
}
16 changes: 16 additions & 0 deletions libdd-profiling/src/profiles/collections/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

mod error;
mod set;
mod slice_set;
mod string_set;
mod thin_str;

pub type SetHasher = core::hash::BuildHasherDefault<rustc_hash::FxHasher>;

pub use error::*;
pub use set::*;
pub use slice_set::*;
pub use string_set::*;
pub use thin_str::*;
Loading
Loading