Skip to content

Commit

Permalink
Fix data type in ReadAction and WriteAction
Browse files Browse the repository at this point in the history
  • Loading branch information
janjurca committed Dec 1, 2023
1 parent 890c7d4 commit 782fdc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 3 additions & 6 deletions include/filestorm/actions/rw_actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class ReadAction : public VirtualMonitoredAction, public FileActionAttributes {
protected:
long long m_read_bytes = 0;
u_int64_t m_read_bytes = 0;

inline off_t get_offset() {
static off_t offset = 0;
Expand Down Expand Up @@ -69,7 +69,6 @@ class ReadAction : public VirtualMonitoredAction, public FileActionAttributes {
throw std::runtime_error(
fmt::format("{}::work: error opening file: {}", typeid(*this).name(), strerror(errno)));
}
size_t offset = 0;
spdlog::debug("{}::work: file_size: {}", typeid(*this).name(), get_file_size());

if (is_time_based()) {
Expand Down Expand Up @@ -105,7 +104,6 @@ class RandomReadAction : public ReadAction {
std::vector<off_t> m_offsets;

inline off_t get_offset() {
static off_t offset = 0;
static off_t block_size_bytes = get_block_size().convert<DataUnit::B>().get_value();
static ssize_t file_size_bytes = get_file_size().convert<DataUnit::B>().get_value();

Expand All @@ -127,7 +125,7 @@ class RandomReadAction : public ReadAction {

class WriteAction : public VirtualMonitoredAction, public FileActionAttributes {
protected:
long long m_written_bytes = 0;
u_int64_t m_written_bytes = 0;

inline off_t get_offset() {
static off_t offset = 0;
Expand Down Expand Up @@ -178,7 +176,7 @@ class WriteAction : public VirtualMonitoredAction, public FileActionAttributes {
if (fd == -1) {
throw std::runtime_error("WriteAction::work: error opening file");
}
size_t offset = 0;

spdlog::debug("{}::work: file_size: {}", typeid(*this).name(), get_file_size());
generate_random_chunk(line.get(), get_block_size().convert<DataUnit::B>().get_value());
if (is_time_based()) {
Expand Down Expand Up @@ -216,7 +214,6 @@ class RandomWriteAction : public WriteAction {
std::vector<off_t> m_offsets;

inline off_t get_offset() {
static off_t offset = 0;
static off_t block_size_bytes = get_block_size().convert<DataUnit::B>().get_value();
static ssize_t file_size_bytes = get_file_size().convert<DataUnit::B>().get_value();

Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ include(../cmake/CPM.cmake)
CPMAddPackage("gh:doctest/[email protected]")
CPMAddPackage("gh:TheLartians/[email protected]")

find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)

if(TEST_INSTALLED_VERSION)
find_package(filestorm REQUIRED)
else()
Expand All @@ -28,7 +31,7 @@ endif()

file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
add_executable(${PROJECT_NAME} ${sources})
target_link_libraries(${PROJECT_NAME} doctest::doctest filestorm::filestorm)
target_link_libraries(${PROJECT_NAME} doctest::doctest filestorm::filestorm fmt::fmt spdlog::spdlog)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)

# enable compiler warnings
Expand Down

0 comments on commit 782fdc5

Please sign in to comment.