Skip to content

Commit

Permalink
Moved enable-timestamps macro into the new config.h
Browse files Browse the repository at this point in the history
Now that there's a Cmake-generated config header for the macros that
enable or disable features, I should use it for the ENABLE_TIMESTAMPS
option. This means I can't have the macro named TIMESTAMPS (it has to
match the Cmake variable name), but that's only a minor change.

Also changed the timestamp logger files to use <> syntax for includes
instead of quotes, as we recently decided for the rest of Derecho.
  • Loading branch information
etremel committed May 9, 2024
1 parent b07863a commit 3ded687
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Expand Up @@ -8,9 +8,6 @@ set(derecho_VERSION 2.4)
set(derecho_build_VERSION 2.4.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(${ENABLE_TIMESTAMPS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMESTAMPS")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDERECHO_DEBUG -O0 -Wall -ggdb -gdwarf-3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
set(CMAKE_CXX_FLAGS_BENCHMARK "${CMAKE_CXX_FLAGS_RELEASE} -Wall -DNOLOG -Ofast -march=native")
Expand Down Expand Up @@ -78,6 +75,12 @@ set(ENABLE_HMEM 1)
else()
set(ENABLE_HMEM 0)
endif()
# Enable timestamp logging for performance testing
if (${ENABLE_TIMESTAMPS})
set(ENABLE_TIMESTAMPS 1)
else()
set(ENABLE_TIMESTAMPS 0)
endif()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/derecho/config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)

Expand Down
1 change: 1 addition & 0 deletions config.h.in
@@ -1,3 +1,4 @@
#pragma once
#cmakedefine USE_VERBS_API
#cmakedefine ENABLE_HMEM
#cmakedefine ENABLE_TIMESTAMPS
4 changes: 3 additions & 1 deletion include/derecho/utils/timestamp_logger.hpp
@@ -1,5 +1,7 @@
#pragma once

#include <derecho/config.h>

#include <atomic>
#include <chrono>
#include <iostream>
Expand Down Expand Up @@ -105,7 +107,7 @@ class TimestampLogger {

// Macro wrappers for the static functions so they can be completely disabled with a #define

#ifdef TIMESTAMPS
#ifdef ENABLE_TIMESTAMPS

#define TIMESTAMP_LOG(...) derecho::TimestampLogger::log(__VA_ARGS__)
#define TIMESTAMP_INIT() derecho::TimestampLogger::initialize()
Expand Down
Expand Up @@ -212,7 +212,7 @@ int main(int argc, char* argv[]) {
}
delete[] bbuf;

#ifdef TIMESTAMPS
#ifdef ENABLE_TIMESTAMPS
// Dump timestamps
std::ofstream timestamps_file("persistent_bw_timestamps.log");
derecho::TimestampLogger::dump(timestamps_file);
Expand Down
Expand Up @@ -225,7 +225,7 @@ int main(int argc, char* argv[]) {

while(!shared_test_state.experiment_done) {
}
#ifdef TIMESTAMPS
#ifdef ENABLE_TIMESTAMPS
// Dump timestamps
std::ofstream timestamp_file("signed_bw_timestamps.log");
derecho::TimestampLogger::dump(timestamp_file);
Expand Down
6 changes: 3 additions & 3 deletions src/core/git_version.cpp
Expand Up @@ -6,15 +6,15 @@
* local repository's .git/hooks/ directory.
*/

#include <derecho/core/git_version.hpp>
#include "derecho/core/git_version.hpp"

namespace derecho {

const int MAJOR_VERSION = 2;
const int MINOR_VERSION = 4;
const int PATCH_VERSION = 0;
const int COMMITS_AHEAD_OF_VERSION = 6;
const int COMMITS_AHEAD_OF_VERSION = 8;
const char* VERSION_STRING = "2.4.0";
const char* VERSION_STRING_PLUS_COMMITS = "2.4.0+6";
const char* VERSION_STRING_PLUS_COMMITS = "2.4.0+8";

}
4 changes: 2 additions & 2 deletions src/utils/timestamp_logger.cpp
@@ -1,5 +1,5 @@
#include "derecho/utils/timestamp_logger.hpp"
#include "derecho/conf/conf.hpp"
#include <derecho/utils/timestamp_logger.hpp>
#include <derecho/conf/conf.hpp>

#include <atomic>
#include <chrono>
Expand Down

0 comments on commit 3ded687

Please sign in to comment.