mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Remove plot_pareto crate
This commit is contained in:
parent
4e5750346d
commit
67234744e9
4 changed files with 0 additions and 209 deletions
140
Cargo.lock
generated
140
Cargo.lock
generated
|
|
@ -272,49 +272,6 @@ dependencies = [
|
||||||
"nodrop",
|
"nodrop",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "askama"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "10a1fb9e41eb366cbcd267da2094be5b7e62fdbca9f82091e7503e80f885050d"
|
|
||||||
dependencies = [
|
|
||||||
"askama_derive",
|
|
||||||
"askama_escape",
|
|
||||||
"askama_shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "askama_derive"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e1012c270085fa35ece6a48a569544fde85b6d9ee41074c7b706cc912a03f939"
|
|
||||||
dependencies = [
|
|
||||||
"askama_shared",
|
|
||||||
"nom",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "askama_escape"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a577aeba5fec1aafb9f195d98cfcc38a78b588e4ebf9b15f62ca1c7aa33795a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "askama_shared"
|
|
||||||
version = "0.9.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8ee517f4e33c27b129928e71d8a044d54c513e72e0b72ec5c4f5f1823e9de353"
|
|
||||||
dependencies = [
|
|
||||||
"askama_escape",
|
|
||||||
"humansize",
|
|
||||||
"num-traits",
|
|
||||||
"serde",
|
|
||||||
"toml",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "atty"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
|
|
@ -809,12 +766,6 @@ version = "1.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
|
checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "humansize"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
@ -1032,16 +983,6 @@ version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
|
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nom"
|
|
||||||
version = "5.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ntapi"
|
name = "ntapi"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
|
|
@ -1051,41 +992,6 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36"
|
|
||||||
dependencies = [
|
|
||||||
"num-bigint",
|
|
||||||
"num-complex",
|
|
||||||
"num-integer",
|
|
||||||
"num-iter",
|
|
||||||
"num-rational",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-bigint"
|
|
||||||
version = "0.2.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-complex"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-format"
|
name = "num-format"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
|
@ -1106,29 +1012,6 @@ dependencies = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-iter"
|
|
||||||
version = "0.1.41"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-rational"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-bigint",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.12"
|
version = "0.2.12"
|
||||||
|
|
@ -1243,29 +1126,6 @@ version = "0.3.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
|
checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "plot_pareto"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"plotly",
|
|
||||||
"rand",
|
|
||||||
"rand_distr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "plotly"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b2734cda9d5551d513e535acacd6c0016c2631a55f1cdbf32bc1a0bd675db1ac"
|
|
||||||
dependencies = [
|
|
||||||
"askama",
|
|
||||||
"num",
|
|
||||||
"rand",
|
|
||||||
"rand_distr",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plotters"
|
name = "plotters"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ members = [
|
||||||
"aquatic_ws",
|
"aquatic_ws",
|
||||||
"aquatic_ws_load_test",
|
"aquatic_ws_load_test",
|
||||||
"aquatic_ws_protocol",
|
"aquatic_ws_protocol",
|
||||||
"plot_pareto"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "plot_pareto"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Joakim Frostegård <joakim.frostegard@gmail.com>"]
|
|
||||||
edition = "2018"
|
|
||||||
license = "Apache-2.0"
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "plot_pareto"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
plotly = "0.4"
|
|
||||||
rand = { version = "0.7", features = ["small_rng"] }
|
|
||||||
rand_distr = "0.2"
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
use plotly::{Plot, Scatter, Layout};
|
|
||||||
use plotly::common::Title;
|
|
||||||
use plotly::layout::Axis;
|
|
||||||
use rand::{thread_rng, rngs::SmallRng, SeedableRng, Rng};
|
|
||||||
use rand_distr::Pareto;
|
|
||||||
|
|
||||||
|
|
||||||
fn main(){
|
|
||||||
let mut plot = Plot::new();
|
|
||||||
let mut rng = SmallRng::from_rng(thread_rng()).unwrap();
|
|
||||||
|
|
||||||
const LEN: usize = 1_000;
|
|
||||||
const MAX_VAL: usize = LEN - 1;
|
|
||||||
|
|
||||||
for pareto_shape in [0.1, 0.2, 0.3, 0.4, 0.5].iter() {
|
|
||||||
let pareto = Pareto::new(1.0, *pareto_shape).unwrap();
|
|
||||||
|
|
||||||
let mut y_axis = [0; LEN];
|
|
||||||
|
|
||||||
for _ in 1..1_000_000 {
|
|
||||||
let index = pareto_usize(&mut rng, pareto, MAX_VAL);
|
|
||||||
|
|
||||||
y_axis[index] += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
let x_axis: Vec<usize> = (0..MAX_VAL).into_iter().collect();
|
|
||||||
|
|
||||||
let trace = Scatter::new(x_axis, y_axis.to_vec())
|
|
||||||
.name(&format!("pareto shape = {}", pareto_shape));
|
|
||||||
|
|
||||||
plot.add_trace(trace);
|
|
||||||
}
|
|
||||||
|
|
||||||
let layout = Layout::new()
|
|
||||||
.title(Title::new("Pareto distribution"))
|
|
||||||
.xaxis(Axis::new().title(Title::new("Info hash index")))
|
|
||||||
.yaxis(Axis::new().title(Title::new("Num requests")));
|
|
||||||
|
|
||||||
plot.set_layout(layout);
|
|
||||||
|
|
||||||
plot.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pub fn pareto_usize(
|
|
||||||
rng: &mut impl Rng,
|
|
||||||
pareto: Pareto<f64>,
|
|
||||||
max: usize,
|
|
||||||
) -> usize {
|
|
||||||
let p: f64 = rng.sample(pareto);
|
|
||||||
let p = (p.min(101.0f64) - 1.0) / 100.0;
|
|
||||||
|
|
||||||
(p * max as f64) as usize
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue