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 latte::uniform for generating random numbers with uniform distrib… #68

Merged
merged 2 commits into from
Jun 20, 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
214 changes: 76 additions & 138 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "latte-cli"
description = "A database benchmarking tool for Apache Cassandra"
version = "0.25.0"
version = "0.26.0"
authors = ["Piotr Kołaczkowski <pkolaczk@gmail.com>"]
edition = "2021"
readme = "README.md"
Expand All @@ -14,7 +14,7 @@ path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0"
base64 = "0.21"
base64 = "0.22"
rmp = "0.8.10"
rmp-serde = "1.0.0-beta.2"
chrono = { version = "0.4.18", features = ["serde"] }
Expand All @@ -26,7 +26,7 @@ err-derive = "0.3"
futures = "0.3"
hdrhistogram = "7.1.0"
hytra = "0.1.2"
itertools = "0.12"
itertools = "0.13"
jemallocator = "0.5"
lazy_static = "1.4.0"
metrohash = "1.0"
Expand All @@ -39,11 +39,11 @@ rand = "0.8"
regex = "1.5"
rune = "0.12"
rust-embed = "8"
scylla = { version = "0.12", features = ["ssl"] }
scylla = { version = "0.13", features = ["ssl"] }
search_path = "0.1"
serde = { version = "1.0.116", features = ["derive"] }
serde_json = "1.0.57"
statrs = "0.16"
statrs = "0.17"
status-line = "0.2.0"
strum = { version = "0.26", features = ["derive"] }
strum_macros = "0.26"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ are pure, i.e. invoking them multiple times with the same parameters yields alwa
- `latte::hash_select(i, vector)` – selects an item from a vector based on a hash
- `latte::blob(i, len)` – generates a random binary blob of length `len`
- `latte::normal(i, mean, std_dev)` – generates a floating point number from a normal distribution
- `latte::uniform(i, min, max)` – generates a floating point number from a uniform distribution

#### Numeric conversions

Expand Down
16 changes: 12 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl RetryInterval {
if values.len() > 2 {
return None;
}
let min_ms = RetryInterval::parse_time(values.get(0).unwrap_or(&""))?;
let min_ms = RetryInterval::parse_time(values.first().unwrap_or(&""))?;
let max_ms = RetryInterval::parse_time(values.get(1).unwrap_or(&"")).unwrap_or(min_ms);
if min_ms > max_ms {
None
Expand Down Expand Up @@ -136,7 +136,8 @@ impl FromStr for RetryInterval {
Err(concat!(
"Expected 1 or 2 parts separated by comma such as '500ms' or '200ms,5s' or '1s'.",
" First value cannot be bigger than second one.",
).to_string())
)
.to_string())
}
}
}
Expand Down Expand Up @@ -190,9 +191,12 @@ pub struct ConnectionConf {
#[clap(long("retry-number"), default_value = "10", value_name = "COUNT")]
pub retry_number: u64,

#[clap(long("retry-interval"), default_value = "100ms,5s", value_name = "TIME[,TIME]")]
#[clap(
long("retry-interval"),
default_value = "100ms,5s",
value_name = "TIME[,TIME]"
)]
pub retry_interval: RetryInterval,

}

#[derive(Clone, Copy, Default, Debug, Eq, PartialEq, Serialize, Deserialize)]
Expand Down Expand Up @@ -544,6 +548,7 @@ pub struct AppConfig {
}

#[derive(Debug, Deserialize, Default)]
#[allow(unused)]
pub struct SchemaConfig {
#[serde(default)]
pub script: Vec<String>,
Expand All @@ -552,6 +557,7 @@ pub struct SchemaConfig {
}

#[derive(Debug, Deserialize)]
#[allow(unused)]
pub struct LoadConfig {
pub count: u64,
#[serde(default)]
Expand All @@ -567,6 +573,7 @@ mod defaults {
}

#[derive(Debug, Deserialize)]
#[allow(unused)]
pub struct RunConfig {
#[serde(default = "defaults::ratio")]
pub ratio: f64,
Expand All @@ -577,6 +584,7 @@ pub struct RunConfig {
}

#[derive(Debug, Deserialize)]
#[allow(unused)]
pub struct WorkloadConfig {
#[serde(default)]
pub schema: SchemaConfig,
Expand Down
Loading
Loading