Skip to content

Commit

Permalink
Apply clang-fomat
Browse files Browse the repository at this point in the history
Update test function in netmon to reset values
  • Loading branch information
quantum-shift committed Aug 19, 2021
1 parent 1449502 commit ffc6959
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
1 change: 0 additions & 1 deletion package/src/cpumon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ cpumon::cpumon() : cpu_stats{} {
}
}


void cpumon::update_stats(const std::vector<pid_t>& pids,
const std::string read_path) {
prmon::monitored_value_map cpu_stat_update{};
Expand Down
1 change: 0 additions & 1 deletion package/src/memmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ memmon::memmon() {
}
}


void memmon::update_stats(const std::vector<pid_t>& pids,
const std::string read_path) {
prmon::monitored_value_map mem_stat_update{};
Expand Down
8 changes: 5 additions & 3 deletions package/src/netmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ void netmon::read_raw_network_stats_test(
static int iteration = 0;
++iteration;
if (iteration == 1) {
// Reset all network_stats_last initialised in constructor to 0 for testing
for (auto& stat : network_stats_initial) {
stat.second = 0;
// Reset all net_stats initialised in constructor to 0 for testing
net_stats.clear();
for (const auto& param : params) {
net_stats.emplace(param.get_name(),
prmon::monitored_value(param, true, 0));
}
}
for (const auto& if_param : interface_params) {
Expand Down
5 changes: 2 additions & 3 deletions package/src/netmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ class netmon final : public Imonitor, public MessageBase {
// Internal method to read "raw" network stats
void read_raw_network_stats(prmon::monitored_value_map& values);

void read_raw_network_stats_test(
prmon::monitored_value_map& values,
const std::string& read_path);
void read_raw_network_stats_test(prmon::monitored_value_map& values,
const std::string& read_path);

public:
netmon(std::vector<std::string> netdevs);
Expand Down
1 change: 1 addition & 0 deletions package/src/nvidiamon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <stdlib.h>
#include <unistd.h>

#include <fstream>
#include <iostream>
#include <sstream>
Expand Down
19 changes: 10 additions & 9 deletions package/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.14.0" AND BUILD_GTESTS)
gtest_discover_tests(test_parameter_classes)

add_executable(test_values test_values.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/countmon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/cpumon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/memmon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/netmon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/nvidiamon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/iomon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/MessageBase.cpp
)
${CMAKE_CURRENT_SOURCE_DIR}/../src/countmon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/cpumon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/memmon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/netmon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/nvidiamon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/iomon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/MessageBase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/parameter.cpp
)
target_compile_definitions(test_values PRIVATE TESTS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/../scripts/precooked_tests/)

target_include_directories(test_values PRIVATE
Expand Down

0 comments on commit ffc6959

Please sign in to comment.