Skip to content

Commit

Permalink
#1009 add serialize method for theStatsReader component
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Sep 11, 2020
1 parent e80cfe9 commit 950ce1e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
9 changes: 9 additions & 0 deletions src/vt/vrt/collection/balance/stats_restart_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ struct StatsRestartReader : runtime::component::Component<StatsRestartReader> {

bool needsLB(PhaseType phase) const;

template <typename Serializer>
void serialize(Serializer& s) {
s | msgsReceived
| totalMove
| proxy_
| proc_move_list_
| proc_phase_runs_LB_;
}

private:
void inputStatsFile(
std::string const& fileName,
Expand Down
28 changes: 16 additions & 12 deletions tests/unit/runtime/test_memory_footprint.nompi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,40 @@
#include "vt/configs/arguments/args.h"
#include "vt/timetrigger/time_trigger_manager.h"
#include "vt/vrt/collection/balance/lb_invoke/lb_manager.h"
#include "vt/vrt/collection/balance/stats_restart_reader.h"

#include "test_harness.h"

namespace vt { namespace tests { namespace unit {

using TestMemoryFootprinting = TestHarness;

TEST_F(TestMemoryFootprinting, test_arg_config) {
arguments::ArgConfig args;
template<typename T>
void printMemoryFootprint(T& obj) {
fmt::print("sizeof(obj):\t{}\n", sizeof(obj));

fmt::print("sizeof instance: {}\n", sizeof(args));
auto size = checkpoint::getMemoryFootprint<T>(obj);
fmt::print("footprint(obj):\t{}\n", size);
}

auto size = checkpoint::getMemoryFootprint<arguments::ArgConfig>(args);
fmt::print("getMemoryFootprint: {}\n", size);
TEST_F(TestMemoryFootprinting, test_arg_config) {
arguments::ArgConfig args;
printMemoryFootprint(args);
}

TEST_F(TestMemoryFootprinting, test_time_trigger_manager) {
timetrigger::TimeTriggerManager trigger_manager;
fmt::print("sizeof instance: {}\n", sizeof(trigger_manager));

auto size = checkpoint::getMemoryFootprint<timetrigger::TimeTriggerManager>(trigger_manager);
fmt::print("getMemoryFootprint: {}\n", size);
printMemoryFootprint(trigger_manager);
}

TEST_F(TestMemoryFootprinting, test_lb_manager) {
vt::vrt::collection::balance::LBManager lb_manager;
fmt::print("sizeof instance: {}\n", sizeof(lb_manager));
printMemoryFootprint(lb_manager);
}

auto size = checkpoint::getMemoryFootprint<vt::vrt::collection::balance::LBManager>(lb_manager);
fmt::print("getMemoryFootprint: {}\n", size);
TEST_F(TestMemoryFootprinting, test_stats_restart_reader) {
vt::vrt::collection::balance::StatsRestartReader reader;
printMemoryFootprint(reader);
}

}}} /* end namespace vt::tests::unit */

0 comments on commit 950ce1e

Please sign in to comment.