Skip to content

Commit

Permalink
feat: added benchmarking binary for torrent repository
Browse files Browse the repository at this point in the history
  • Loading branch information
mickvandijke committed Dec 16, 2023
1 parent a3274dc commit 6087e4f
Show file tree
Hide file tree
Showing 15 changed files with 1,110 additions and 121 deletions.
97 changes: 97 additions & 0 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ version = "3.0.0-alpha.12-develop"
[dependencies]
aquatic_udp_protocol = "0"
async-trait = "0"
axum = "0.6"
axum = { version = "0.6", features = ["macros"] }
axum-client-ip = "0.4"
axum-server = { version = "0", features = ["tls-rustls"] }
binascii = "0"
Expand Down Expand Up @@ -68,16 +68,18 @@ tower-http = { version = "0.4", features = ["compression-full"] }
uuid = { version = "1", features = ["v4"] }

[dev-dependencies]
criterion = { version = "0.5.1", features = ["async_tokio"] }
local-ip-address = "0"
mockall = "0"
once_cell = "1.18.0"
reqwest = { version = "0", features = ["json"] }
serde_bytes = "0"
serde_repr = "0"
serde_urlencoded = "0"
torrust-tracker-test-helpers = { version = "3.0.0-alpha.12-develop", path = "packages/test-helpers" }

[workspace]
members = ["contrib/bencode", "packages/configuration", "packages/located-error", "packages/primitives", "packages/test-helpers"]
members = ["contrib/bencode", "packages/configuration", "packages/located-error", "packages/primitives", "packages/test-helpers", "packages/torrent-repository-benchmarks"]

[profile.dev]
debug = 1
Expand Down
21 changes: 21 additions & 0 deletions packages/torrent-repository-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "torrust-torrent-repository-benchmarks"
authors.workspace = true
categories.workspace = true
description.workspace = true
documentation.workspace = true
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
publish.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[dependencies]
aquatic_udp_protocol = "0.8.0"
clap = { version = "4.4.8", features = ["derive"] }
futures = "0.3.29"
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync"] }
torrust-tracker = { path = "../../" }
15 changes: 15 additions & 0 deletions packages/torrent-repository-benchmarks/src/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use clap::Parser;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]

Check warning on line 4 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L3-L4

Added lines #L3 - L4 were not covered by tests
pub struct Args {
/// Amount of benchmark worker threads

Check warning on line 6 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L6

Added line #L6 was not covered by tests
#[arg(short, long)]
pub threads: usize,
/// Amount of time in ns a thread will sleep to simulate a client response after handling a task

Check warning on line 9 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L8-L9

Added lines #L8 - L9 were not covered by tests
#[arg(short, long)]
pub sleep: Option<u64>,
/// Compare with old implementations of the torrent repository

Check warning on line 12 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L11-L12

Added lines #L11 - L12 were not covered by tests
#[arg(short, long)]
pub compare: Option<bool>,

Check warning on line 14 in packages/torrent-repository-benchmarks/src/args.rs

View check run for this annotation

Codecov / codecov/patch

packages/torrent-repository-benchmarks/src/args.rs#L14

Added line #L14 was not covered by tests
}
Loading

0 comments on commit 6087e4f

Please sign in to comment.