diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26b7c8e05..f5b482e29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,16 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.4.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort name: isort (python) diff --git a/src/io/local_transport/local_transport_handle.hpp b/src/io/local_transport/local_transport_handle.hpp index 38538620f..def9126d5 100644 --- a/src/io/local_transport/local_transport_handle.hpp +++ b/src/io/local_transport/local_transport_handle.hpp @@ -1,4 +1,4 @@ -// Copyright 2022 Memgraph Ltd. +// Copyright 2023 Memgraph Ltd. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source @@ -22,6 +22,7 @@ #include "io/message_histogram_collector.hpp" #include "io/time.hpp" #include "io/transport.hpp" +#include "utils/timer.hpp" namespace memgraph::io::local_transport { @@ -108,6 +109,7 @@ class LocalTransportHandle { auto type_info = TypeInfoFor(message); std::any message_any(std::forward(message)); + MG_RAII_TIMER(timer, message_any.type().name()); OpaqueMessage opaque_message{.to_address = to_address, .from_address = from_address, .request_id = request_id, diff --git a/src/storage/v3/shard_rsm.cpp b/src/storage/v3/shard_rsm.cpp index 881796a70..406e15aad 100644 --- a/src/storage/v3/shard_rsm.cpp +++ b/src/storage/v3/shard_rsm.cpp @@ -48,6 +48,7 @@ #include "storage/v3/vertex_id.hpp" #include "storage/v3/view.hpp" #include "utils/logging.hpp" +#include "utils/timer.hpp" namespace memgraph::storage::v3 { using msgs::Label; @@ -516,6 +517,7 @@ msgs::WriteResponses ShardRsm::ApplyWrite(msgs::CommitRequest &&req) { }; msgs::ReadResponses ShardRsm::HandleRead(msgs::GetPropertiesRequest &&req) { + MG_RAII_TIMER(timer, "SHARD_RSM_HANDLE_GET_PROPS"); if (!req.vertex_ids.empty() && !req.vertices_and_edges.empty()) { auto shard_error = SHARD_ERROR(ErrorCode::NONEXISTENT_OBJECT); auto error = CreateErrorResponse(shard_error, req.transaction_id, ""); diff --git a/src/utils/timer.hpp b/src/utils/timer.hpp index 7b498b2d2..d00096e84 100644 --- a/src/utils/timer.hpp +++ b/src/utils/timer.hpp @@ -12,6 +12,7 @@ #pragma once #include +#include namespace memgraph::utils { @@ -51,6 +52,6 @@ class Timer { // some of them ON/OFF (not all). // #define MG_RAII_TIMER(name, message) \ - memgraph::utils::Timer<> name([](auto elapsed) { spdlog::critical("{} {}s", message, elapsed); }) + memgraph::utils::Timer<> name([&](auto elapsed) { spdlog::critical("{} {}s", message, elapsed); }) } // namespace memgraph::utils