Verified Commit 125882a1 authored by Marc Vef's avatar Marc Vef
Browse files

Added msgpack2json tools to convert clientmetrics into a readable format

parent d0eb08b0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -227,6 +227,13 @@ gkfs_define_option(
  DEFAULT_VALUE OFF
)

# build tools
gkfs_define_option(
    GKFS_BUILD_TOOLS
    HELP_TEXT "Enable ${PROJECT_NAME} tools compilation"
    DEFAULT_VALUE OFF
)

cmake_dependent_option(GKFS_INSTALL_TESTS "Install GekkoFS self tests" OFF "GKFS_BUILD_TESTS" OFF)


+52 −0
Original line number Diff line number Diff line
################################################################################
# Copyright 2018-2023, Barcelona Supercomputing Center (BSC), Spain            #
# Copyright 2015-2023, Johannes Gutenberg Universitaet Mainz, Germany          #
#                                                                              #
# This software was partially supported by the                                 #
# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).    #
#                                                                              #
# This software was partially supported by the                                 #
# ADA-FS project under the SPPEXA project funded by the DFG.                   #
#                                                                              #
# This file is part of GekkoFS.                                                #
#                                                                              #
# GekkoFS is free software: you can redistribute it and/or modify              #
# it under the terms of the GNU General Public License as published by         #
# the Free Software Foundation, either version 3 of the License, or            #
# (at your option) any later version.                                          #
#                                                                              #
# GekkoFS is distributed in the hope that it will be useful,                   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
# GNU General Public License for more details.                                 #
#                                                                              #
# You should have received a copy of the GNU General Public License            #
# along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.            #
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

include(FetchContent)

set(FETCHCONTENT_QUIET OFF)

FetchContent_Declare(nlohmann_json
    DOWNLOAD_EXTRACT_TIMESTAMP ON
    URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)

FetchContent_GetProperties(nlohmann_json)

if (NOT nlohmann_json_POPULATED)
    FetchContent_Populate(nlohmann_json)
    message(STATUS "[gkfs.io] Nlohmann JSON source dir: ${nlohmann_json_SOURCE_DIR}")
    message(STATUS "[gkfs.io] Nlohmann JSON binary dir: ${nlohmann_json_BINARY_DIR}")

    # we don't really care so much about a third party library's tests to be
    # run from our own project's code
    set(JSON_BuildTests OFF CACHE INTERNAL "")

    # we also don't need to install it when our main project gets installed
    set(JSON_Install OFF CACHE INTERNAL "")

    add_subdirectory(${nlohmann_json_SOURCE_DIR} ${nlohmann_json_BINARY_DIR})
endif ()
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -320,6 +320,9 @@ include_directories(
add_subdirectory(src)
add_subdirectory(include)
add_subdirectory(examples)
if (GKFS_BUILD_TOOLS)
    add_subdirectory(tools)
endif ()

### Mark any CMake variables imported from {fmt} and spdlog as advanced, so
### that they don't appear in cmake-gui or ccmake. Similarly for FETCHCONTENT
+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ enum class client_metric_type { write, read };
class ClientMetrics {

public:
    std::mutex mtx_{};
    //    std::mutex mtx_{};
    //    std::thread thread_{};

    std::chrono::time_point<std::chrono::system_clock> init_t_;
@@ -92,7 +92,7 @@ public:
    path() const;

    void
    path(const std::string& path, const std::string& prefix = "");
    path(const std::string& path, const std::string prefix = "");
};

} // namespace gkfs::messagepack
+2 −2
Original line number Diff line number Diff line
@@ -315,8 +315,8 @@ destroy_preload() {
        destroy_forwarding_mapper();
    }
#ifdef GKFS_ENABLE_CLIENT_METRICS
//    CTX->write_metrics().flush_msgpack();
//    CTX->read_metrics().flush_msgpack();
    CTX->write_metrics().flush_msgpack();
    CTX->read_metrics().flush_msgpack();
#endif
    CTX->clear_hosts();
    LOG(DEBUG, "Peer information deleted");
Loading