Skip to content

Commit

Permalink
Remove profiler (#914)
Browse files Browse the repository at this point in the history
* Remove profiler

* fmt

* Add changelog entry

* Stop testing profiler in the ci, it has been removed

* Fix function name

* fmt

* Remove now-unused dyn-clone dependency
  • Loading branch information
Dentosal authored Feb 18, 2025
1 parent 987ab2b commit a39c9c7
Show file tree
Hide file tree
Showing 28 changed files with 53 additions and 1,116 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ jobs:
args: --all-targets --features random
- command: test
args: --all-targets --features serde
- command: test
args: --all-targets --features random,profile-gas,profile-coverage,serde
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Breaking
- [900](https://github.com/FuelLabs/fuel-vm/pull/900): Change the error variant `DuplicateMessageInputId` to `DuplicateInputNonce` which now contains a nonce instead of `MessageId` for performance improvements.
- [907](https://github.com/FuelLabs/fuel-vm/pull/907): `StorageRead` and `StorageWrite` traits no longer return the number of bytes written. They already required that the whole buffer is used, but now this is reflected in signature and documentation as well.
- [914](https://github.com/FuelLabs/fuel-vm/pull/914): The built-in profiler is removed. Use the debugger with single-stepping instead.

### Fixed
- [895](https://github.com/FuelLabs/fuel-vm/pull/895): Fix elided lifetimes compilation warnings that became errors after the release of rust 1.83.0.
Expand Down
3 changes: 1 addition & 2 deletions ci_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ cargo test --all-targets --no-default-features &&
cargo test --all-targets --no-default-features --features serde &&
cargo test --all-targets --no-default-features --features alloc &&
cargo test --all-targets --features random &&
cargo test --all-targets --features serde &&
cargo test --all-targets --features random,profile-gas,profile-coverage,serde
cargo test --all-targets --features serde
7 changes: 0 additions & 7 deletions fuel-vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ bn = { package = "substrate-bn", version = "0.6", default-features = false }
derive_more = { version = "0.99", default-features = false, features = [
"display",
] }
dyn-clone = { version = "1.0", optional = true }
educe = { version = "0.6", default-features = false, features = ["Debug"] }
ethnum = "1.3"
fuel-asm = { workspace = true, default-features = false }
Expand Down Expand Up @@ -58,8 +57,6 @@ fuel-tx = { workspace = true, features = ["test-helpers"] }
fuel-vm = { path = ".", default-features = false, features = [
"test-helpers",
"serde",
"profile-coverage",
"profile-gas",
"random",
] }
futures = "0.3.28"
Expand All @@ -71,7 +68,6 @@ quickcheck = "1.0"
quickcheck_macros = "1.0"
rayon = "1.7"
rstest = "0.17"
serde_json = "1.0"
test-case = "3.3"
tokio = { version = "1.27", features = ["full"] }
tokio-rayon = "2.1.0"
Expand All @@ -88,9 +84,6 @@ std = [
"sha3/std"
]
alloc = ["fuel-asm/alloc", "fuel-tx/alloc", "fuel-crypto/alloc"]
profile-gas = ["profile-any"]
profile-coverage = ["profile-any"]
profile-any = ["dyn-clone"] # All profiling features should depend on this
random = ["fuel-crypto/random", "fuel-types/random", "fuel-tx/random", "rand"]
da-compression = ["fuel-compression", "fuel-tx/da-compression"]
serde = [
Expand Down
28 changes: 0 additions & 28 deletions fuel-vm/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ mod receipts;
mod debug;
mod ecal;

use crate::profiler::Profiler;

#[cfg(feature = "profile-gas")]
use crate::profiler::InstructionLocation;

pub use balances::RuntimeBalances;
pub use ecal::{
EcalHandler,
Expand Down Expand Up @@ -131,7 +126,6 @@ pub struct Interpreter<M, S, Tx = (), Ecal = NotSupportedEcal> {
debugger: Debugger,
context: Context,
balances: RuntimeBalances,
profiler: Profiler,
interpreter_params: InterpreterParams,
/// `PanicContext` after the latest execution. It is consumed by
/// `append_panic_receipt` and is `PanicContext::None` after consumption.
Expand Down Expand Up @@ -320,16 +314,6 @@ impl<M, S, Tx, Ecal> Interpreter<M, S, Tx, Ecal> {
pub fn receipts_mut(&mut self) -> &mut ReceiptsCtx {
&mut self.receipts
}

pub(crate) fn contract_id(&self) -> Option<ContractId> {
self.frames.last().map(|frame| *frame.to())
}

/// Reference to the underlying profiler
#[cfg(feature = "profile-any")]
pub const fn profiler(&self) -> &Profiler {
&self.profiler
}
}

pub(crate) fn flags(flag: Reg<FLAG>) -> Flags {
Expand All @@ -344,18 +328,6 @@ pub(crate) fn is_unsafe_math(flag: Reg<FLAG>) -> bool {
flags(flag).contains(Flags::UNSAFEMATH)
}

#[cfg(feature = "profile-gas")]
fn current_location(
current_contract: Option<ContractId>,
pc: crate::constraints::reg_key::Reg<{ crate::constraints::reg_key::PC }>,
is: crate::constraints::reg_key::Reg<{ crate::constraints::reg_key::IS }>,
) -> InstructionLocation {
// Safety: pc should always be above is, but fallback to zero here for weird cases,
// as the profiling code should be robust against regards cases like this.
let offset = (*pc).saturating_sub(*is);
InstructionLocation::new(current_contract, offset)
}

impl<M, S, Tx, Ecal> AsRef<S> for Interpreter<M, S, Tx, Ecal> {
fn as_ref(&self) -> &S {
&self.storage
Expand Down
Loading

0 comments on commit a39c9c7

Please sign in to comment.