Skip to content

Commit

Permalink
#1009: memory footprinting: add serializer for DiagnosticStatsPack
Browse files Browse the repository at this point in the history
Add serializer for DiagnosticStatsPack and use it in derived classes.
  • Loading branch information
cz4rs committed Nov 21, 2020
1 parent 809f826 commit df266a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vt/runtime/component/meter/gauge.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ struct Gauge : DiagnosticStatsPack<T> {
}

template <typename SerializerT>
void serialize(SerializerT&) { }
void serialize(SerializerT& s) {
DiagnosticStatsPack<T>::serialize(s);
}
};

}}}} /* end namespace vt::runtime::component::meter */
Expand Down
8 changes: 8 additions & 0 deletions src/vt/runtime/component/meter/stats_pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ struct DiagnosticStatsPack : DiagnosticMeter {
}
}

template <typename SerializerT>
void serialize(SerializerT& s) {
s | sum_
| avg_
| max_
| min_;
}

protected:
detail::DiagnosticValue<T>* sum_ = nullptr; /**< Sum of all update values */
detail::DiagnosticValue<T>* avg_ = nullptr; /**< Avg of all update values */
Expand Down
2 changes: 2 additions & 0 deletions src/vt/runtime/component/meter/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ struct Timer : DiagnosticStatsPack<T> {
template <typename SerializerT>
void serialize(SerializerT& s) {
s | start_time_;

DiagnosticStatsPack<T>::serialize(s);
}

private:
Expand Down

0 comments on commit df266a4

Please sign in to comment.