diff options
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/benchmark-index.rs | 33 | ||||
-rw-r--r-- | src/bin/benchmark-indexedstore.rs | 28 | ||||
-rw-r--r-- | src/bin/benchmark-null.rs | 29 | ||||
-rw-r--r-- | src/bin/benchmark-store.rs | 28 |
4 files changed, 118 insertions, 0 deletions
diff --git a/src/bin/benchmark-index.rs b/src/bin/benchmark-index.rs new file mode 100644 index 0000000..5008660 --- /dev/null +++ b/src/bin/benchmark-index.rs @@ -0,0 +1,33 @@ +use obnam::benchmark::ChunkGenerator; +use obnam::index::Index; +use std::path::PathBuf; +use structopt::StructOpt; + +#[derive(Debug, StructOpt)] +#[structopt( + name = "benchmark-index", + about = "Benhcmark the store index in memory" +)] +struct Opt { + // We don't use this, but we accept it for command line + // compatibility with other benchmark programs. + #[structopt(parse(from_os_str))] + chunks: PathBuf, + + #[structopt()] + num: u32, +} + +fn main() -> anyhow::Result<()> { + pretty_env_logger::init(); + + let opt = Opt::from_args(); + let gen = ChunkGenerator::new(opt.num); + + let mut index = Index::default(); + for (id, checksum, _, _) in gen { + index.insert(id, "sha25", &checksum); + } + + Ok(()) +} diff --git a/src/bin/benchmark-indexedstore.rs b/src/bin/benchmark-indexedstore.rs new file mode 100644 index 0000000..a4191ac --- /dev/null +++ b/src/bin/benchmark-indexedstore.rs @@ -0,0 +1,28 @@ +use obnam::benchmark::ChunkGenerator; +use obnam::indexedstore::IndexedStore; +use std::path::PathBuf; +use structopt::StructOpt; + +#[derive(Debug, StructOpt)] +#[structopt(name = "benchmark-store", about = "Benhcmark the store without HTTP")] +struct Opt { + #[structopt(parse(from_os_str))] + chunks: PathBuf, + + #[structopt()] + num: u32, +} + +fn main() -> anyhow::Result<()> { + pretty_env_logger::init(); + + let opt = Opt::from_args(); + let gen = ChunkGenerator::new(opt.num); + + let mut store = IndexedStore::new(&opt.chunks); + for (_, _, meta, chunk) in gen { + store.save(&meta, &chunk)?; + } + + Ok(()) +} diff --git a/src/bin/benchmark-null.rs b/src/bin/benchmark-null.rs new file mode 100644 index 0000000..6df8ca1 --- /dev/null +++ b/src/bin/benchmark-null.rs @@ -0,0 +1,29 @@ +use obnam::benchmark::ChunkGenerator; +use std::path::PathBuf; +use structopt::StructOpt; + +#[derive(Debug, StructOpt)] +#[structopt( + name = "benchmark-index", + about = "Benhcmark the store index in memory" +)] +struct Opt { + // We don't use this, but we accept it for command line + // compatibility with other benchmark programs. + #[structopt(parse(from_os_str))] + chunks: PathBuf, + + #[structopt()] + num: u32, +} + +fn main() -> anyhow::Result<()> { + pretty_env_logger::init(); + + let opt = Opt::from_args(); + let gen = ChunkGenerator::new(opt.num); + + for (_, _, _, _) in gen {} + + Ok(()) +} diff --git a/src/bin/benchmark-store.rs b/src/bin/benchmark-store.rs new file mode 100644 index 0000000..f7c82b1 --- /dev/null +++ b/src/bin/benchmark-store.rs @@ -0,0 +1,28 @@ +use obnam::benchmark::ChunkGenerator; +use obnam::store::Store; +use std::path::PathBuf; +use structopt::StructOpt; + +#[derive(Debug, StructOpt)] +#[structopt(name = "benchmark-store", about = "Benhcmark the store without HTTP")] +struct Opt { + #[structopt(parse(from_os_str))] + chunks: PathBuf, + + #[structopt()] + num: u32, +} + +fn main() -> anyhow::Result<()> { + pretty_env_logger::init(); + + let opt = Opt::from_args(); + let gen = ChunkGenerator::new(opt.num); + + let store = Store::new(&opt.chunks); + for (id, _, meta, chunk) in gen { + store.save(&id, &meta, &chunk)?; + } + + Ok(()) +} |