Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new function to loadgen contract for apply load testing. #1492

Merged
merged 1 commit into from
Nov 8, 2024
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
340 changes: 66 additions & 274 deletions soroban-test-wasms/wasm-workspace/Cargo.lock

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/add_f32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/add_i32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true, features = ["alloc"] }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/complex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
1 change: 0 additions & 1 deletion soroban-test-wasms/wasm-workspace/constructor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }
5 changes: 0 additions & 5 deletions soroban-test-wasms/wasm-workspace/contract_data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
testutils = ["soroban-sdk/testutils"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
1 change: 0 additions & 1 deletion soroban-test-wasms/wasm-workspace/deployer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/err/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/fannkuch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/fib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/hostile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/linear_memory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/loadgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
22 changes: 21 additions & 1 deletion soroban-test-wasms/wasm-workspace/loadgen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![no_std]
use soroban_sdk::{contract, contractimpl, Bytes, Env, U256};
use soroban_sdk::{contract, contractimpl, symbol_short, Bytes, Env, U256};

#[contract]
pub struct Contract;
Expand Down Expand Up @@ -48,4 +48,24 @@ impl Contract {
// Return has data dependency on both values to make sure nothing gets optimized out
u256_val
}

pub fn do_cpu_only_work(e: Env, guest_cycles: u32, host_cycles: u32, event_count: u32) -> U256 {
let mut val: i64 = 3;
for _ in 0..guest_cycles {
val = (val * 1664525 + 1013904223) >> 32;
}

let mut u256_val = U256::from_u32(&e, val as u32);
let u256_1 = U256::from_u32(&e, 1);
for _ in 0..host_cycles {
u256_val = u256_val.add(&u256_1);
}

for _ in 0..event_count {
e.events().publish((symbol_short!("event"),), val);
}

// Return has data dependency on both values to make sure nothing gets optimized out
u256_val
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }
Binary file modified soroban-test-wasms/wasm-workspace/opt/20/loadgen.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/simple_account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/sum_i32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/update/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
4 changes: 0 additions & 4 deletions soroban-test-wasms/wasm-workspace/vec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-env-common = { workspace = true }

[features]
next = ["soroban-env-common/next"]
Loading