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

Make block benchmark #1569

Merged
merged 19 commits into from
May 4, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixes from review
  • Loading branch information
Harrm committed Apr 27, 2023
commit baa53ca0cc45599065a05bc03cc984a24b52a883
8 changes: 4 additions & 4 deletions core/application/impl/app_configuration_impl.cpp
Original file line number Diff line number Diff line change
@@ -13,12 +13,12 @@
#include <rapidjson/document.h>
#include <rapidjson/filereadstream.h>
#include <boost/algorithm/string.hpp>
#include "filesystem/common.hpp"
#include <boost/program_options.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <charconv>
#include <libp2p/layer/websocket/wss_adaptor.hpp>
#include "filesystem/common.hpp"

#include "api/transport/tuner.hpp"
#include "application/build_version.hpp"
@@ -34,7 +34,7 @@ namespace {

template <typename T, typename Func>
void find_argument(boost::program_options::variables_map &vm,
char const *name,
const char *name,
Func &&f) {
assert(nullptr != name);
if (auto it = vm.find(name); it != vm.end()) {
@@ -225,7 +225,6 @@ namespace kagome::application {
purge_wavm_cache_(def_purge_wavm_cache_),
offchain_worker_mode_{def_offchain_worker_mode},
enable_offchain_indexing_{def_enable_offchain_indexing},
subcommand_{},
recovery_state_{def_block_to_recover} {
SL_INFO(logger_, "Soramitsu Kagome started. Version: {} ", buildVersion());
}
@@ -1368,7 +1367,8 @@ namespace kagome::application {
return false;
}
benchmark_config_ = BlockBenchmarkConfig{
.from = *from_opt, .to = *to_opt, .times = *repeat_opt};
.from = *from_opt, .to = *to_opt, .times = *repeat_opt,
};
}

bool has_recovery = false;
2 changes: 2 additions & 0 deletions core/benchmark/block_execution_benchmark.cpp
Original file line number Diff line number Diff line change
@@ -31,6 +31,8 @@ OUTCOME_CPP_DEFINE_CATEGORY(kagome::benchmark,

static_assert(STR(CONCAT(2, 3)) == std::string_view("23"));

// mind if you want to move it to global scope, __LINE__ is not very reliable,
// may use __COUNTER__ instead
#define OUTCOME_TRY_MSG(var, expr, msg, ...) \
auto CONCAT(_res_, __LINE__) = (expr); \
do { \
2 changes: 1 addition & 1 deletion core/network/impl/protocols/protocol_error.hpp
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ namespace kagome::network {
NODE_NOT_SYNCHRONIZED_YET,
GENESIS_NO_MATCH,
HANDSHAKE_ERROR,
NO_RESPONSE
NO_RESPONSE,
};

}
3 changes: 0 additions & 3 deletions core/storage/spaces.hpp
Original file line number Diff line number Diff line change
@@ -21,9 +21,6 @@ namespace kagome::storage {
kJustification,
kTrieNode,

kTriePruner,
kBlockData,

//
kTotal
};
1 change: 1 addition & 0 deletions core/utils/benchmark_main.cpp
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ namespace kagome {
SL_ERROR(config_logger, "Failed to initialize kagome!");
return -1;
}
kagome::log::tuneLoggingSystem(config->log());

injector::KagomeNodeInjector injector{config};

5 changes: 0 additions & 5 deletions core/utils/kagome_db_editor.cpp
Original file line number Diff line number Diff line change
@@ -225,11 +225,6 @@ int db_editor_main(int argc, const char **argv) {
target_state_param = RootHash::fromHexWithPrefix(argv[2]).value();
}

auto logging_system = std::make_shared<soralog::LoggingSystem>(
std::make_shared<Configurator>());
std::ignore = logging_system->configure();
log::setLoggingSystem(logging_system);

auto log = log::createLogger("main", "kagome-db-editor");

common::Buffer prefix{};
16 changes: 2 additions & 14 deletions core/utils/storage_explorer.cpp
Original file line number Diff line number Diff line change
@@ -516,18 +516,6 @@ int storage_explorer_main(int argc, const char **argv) {
CommandParser parser;
parser.addCommand(std::make_unique<PrintHelpCommand>(parser));

auto logging_system = std::make_shared<soralog::LoggingSystem>(
std::make_shared<kagome::log::Configurator>(
std::make_shared<libp2p::log::Configurator>()));

auto r = logging_system->configure();
if (not r.message.empty()) {
(r.has_error ? std::cerr : std::cout) << r.message << std::endl;
}
if (r.has_error) {
exit(EXIT_FAILURE);
}
kagome::log::setLoggingSystem(logging_system);
kagome::log::setLevelOfGroup("*", kagome::log::Level::WARN);

auto logger = kagome::log::createLogger("AppConfiguration", "main");
@@ -553,7 +541,7 @@ int storage_explorer_main(int argc, const char **argv) {
}

kagome::injector::KagomeNodeInjector injector{configuration};
/*auto block_storage = injector.injectBlockStorage();
auto block_storage = injector.injectBlockStorage();
auto trie_storage = injector.injectTrieStorage();
auto app_state_manager = injector.injectAppStateManager();
auto block_tree = injector.injectBlockTree();
@@ -585,7 +573,7 @@ int storage_explorer_main(int argc, const char **argv) {
parser.addCommand(std::make_unique<SearchChainCommand>(
block_storage, trie_storage, authority_manager, hasher));

parser.invoke(args.subspan(0, kagome_args_start));*/
parser.invoke(args.subspan(0, kagome_args_start));

return 0;
}