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
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: 1.66.0
toolchain: 1.74.0
override: true
components: rustfmt, clippy

Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
toolchain: [stable, nightly, 1.66.0]
toolchain: [stable, nightly, 1.74.0]
target:
[
x86_64-unknown-linux-gnu,
Expand Down
68 changes: 57 additions & 11 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "An internal perf tools for rust programs."
repository = "https://github.com/tikv/pprof-rs"
documentation = "https://docs.rs/pprof/"
readme = "README.md"
rust-version = "1.66.0" # MSRV
rust-version = "1.74.0" # MSRV

[features]
default = ["cpp"]
Expand All @@ -19,7 +19,7 @@ frame-pointer = []
# A private feature to indicate either prost-codec or protobuf-codec is enabled.
_protobuf = []
prost-codec = ["prost", "prost-derive", "prost-build", "sha2", "_protobuf"]
protobuf-codec = ["protobuf", "protobuf-codegen-pure", "_protobuf"]
protobuf-codec = ["protobuf", "protobuf-codegen", "_protobuf"]

[dependencies]
backtrace = { version = "0.3" }
Expand All @@ -37,7 +37,7 @@ smallvec = "1.7"
inferno = { version = "0.11", default-features = false, features = ["nameattr"], optional = true }
prost = { version = "0.12", optional = true }
prost-derive = { version = "0.12", optional = true }
protobuf = { version = "2.0", optional = true }
protobuf = { version = ">=3.7.2", optional = true }
criterion = {version = "0.5", optional = true}
aligned-vec = "0.6"

Expand All @@ -53,7 +53,7 @@ rand = "0.8.0"
[build-dependencies]
prost-build = { version = "0.12", optional = true }
sha2 = { version = "0.10", optional = true }
protobuf-codegen-pure = { version = "2.0", optional = true }
protobuf-codegen = { version = "3.7.2", optional = true }

[[example]]
name = "flamegraph"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Unit tests have been added to guarantee there is no `malloc` in sample functions

## Minimum Supported Rust Version

Rust 1.64 or higher.
Rust 1.74 or higher.

Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump.

Expand Down
26 changes: 12 additions & 14 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.

#[cfg(feature = "protobuf-codec")]
// Allow deprecated as TiKV pin versions to a outdated one.
#[allow(deprecated)]
fn generate_protobuf() {
use std::io::Write;

let customize = <protobuf_codegen::Customize as std::default::Default>::default();
// Set the output directory for generated files
let out_dir = std::env::var("OUT_DIR").unwrap();
protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
out_dir: &out_dir,
includes: &["proto"],
input: &["proto/profile.proto"],
customize: protobuf_codegen_pure::Customize {
generate_accessors: Some(false),
lite_runtime: Some(true),
..Default::default()
},
})
.unwrap();

let mut cg = protobuf_codegen::Codegen::new();
cg.pure();

cg.inputs(["proto/profile.proto"]).includes(["proto"]);

cg.customize(customize);
cg.out_dir(&out_dir).run().unwrap();

// Optionally, write a mod.rs file for module inclusion
let mut f = std::fs::File::create(format!("{}/mod.rs", out_dir)).unwrap();
write!(f, "pub mod profile;").unwrap();
}
Expand Down
3 changes: 0 additions & 3 deletions src/backtrace/backtrace_rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ impl super::Trace for Trace {
unsafe { backtrace::trace_unsynchronized(cb) }
}
}

pub use backtrace::Frame;
pub use backtrace::Symbol;
4 changes: 4 additions & 0 deletions src/backtrace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ pub trait Frame: Sized + Clone {
type S: Symbol;

fn resolve_symbol<F: FnMut(&Self::S)>(&self, cb: F);

#[allow(dead_code)]
fn symbol_address(&self) -> *mut c_void;

#[allow(dead_code)]
fn ip(&self) -> usize;
}

Expand Down
Loading