Compare commits
No commits in common. "95c66c3f470bc2d6cafcca8de912d85a2b20d255" and "82f454d7ca25eda5dd7ed4dbbb3f8f53a195b852" have entirely different histories.
95c66c3f47
...
82f454d7ca
@ -4,7 +4,8 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
mace = { git = "https://github.com/abbycin/mace" }
|
||||
# mace = { git = "https://git.o2c.fun/abby/mace.git", branch = "task-64-1" }
|
||||
mace = { path = "/home/workspace/gits/github/mace"}
|
||||
clap = { version = "4.5.42", features = ["derive"] }
|
||||
rand = "0.9.2"
|
||||
log = "0.4.22"
|
||||
|
||||
@ -10,14 +10,12 @@ endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
|
||||
find_package(CLI11 CONFIG REQUIRED)
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
find_package(RocksDB CONFIG REQUIRED)
|
||||
|
||||
add_executable(rocksdb_bench main.cpp
|
||||
instant.h)
|
||||
|
||||
target_include_directories(rocksdb_bench PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(rocksdb_bench PRIVATE RocksDB::rocksdb CLI11::CLI11 fmt::fmt)
|
||||
target_link_libraries(rocksdb_bench rocksdb CLI11::CLI11)
|
||||
|
||||
file(GLOB ALL_SOURCE_FILES *.cpp *.h)
|
||||
add_custom_target(format
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <fmt/format.h>
|
||||
#include <print>
|
||||
#include <random>
|
||||
#include <rocksdb/cache.h>
|
||||
#include <rocksdb/db.h>
|
||||
@ -52,27 +52,27 @@ int main(int argc, char *argv[]) {
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
if (args.path.empty()) {
|
||||
fmt::println("path is empty");
|
||||
std::println("path is empty");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (std::filesystem::exists(args.path)) {
|
||||
fmt::println("path `{}` already exists", args.path);
|
||||
std::println("path `{}` already exists", args.path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (args.mode != "insert" && args.mode != "get" && args.mode != "mixed") {
|
||||
fmt::println("Error: Invalid mode");
|
||||
std::println("Error: Invalid mode");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (args.key_size < 16 || args.value_size < 16) {
|
||||
fmt::println("Error: key_size or value_size too small, must >= 16");
|
||||
std::println("Error: key_size or value_size too small, must >= 16");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (args.insert_ratio > 100) {
|
||||
fmt::println("Error: Insert ratio must be between 0 and 100");
|
||||
std::println("Error: Insert ratio must be between 0 and 100");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ int main(int argc, char *argv[]) {
|
||||
return args.mode == "insert" ? 100 : 0;
|
||||
}();
|
||||
double ops = static_cast<double>(total_op.load(std::memory_order_relaxed)) / b.elapse_sec();
|
||||
fmt::println("{},{},{},{},{},{:.2f},{}", args.mode, args.threads, args.key_size, args.value_size, ratio, ops,
|
||||
std::println("{},{},{},{},{},{:.2f},{}", args.mode, args.threads, args.key_size, args.value_size, ratio, ops,
|
||||
b.elapse_ms());
|
||||
delete db;
|
||||
std::filesystem::remove_all(args.path);
|
||||
|
||||
@ -1,14 +1,5 @@
|
||||
{
|
||||
"dependencies": [
|
||||
"cli11",
|
||||
"rocksdb",
|
||||
"fmt"
|
||||
],
|
||||
"builtin-baseline": "120deac3062162151622ca4860575a33844ba10b",
|
||||
"overrides": [
|
||||
{
|
||||
"name": "rocksdb",
|
||||
"version": "10.4.2"
|
||||
}
|
||||
"cli11"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user