summary_snapshot.cpp 856 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "summary_snapshot.h"
  2. #include <util/stream/output.h>
  3. #include <iostream>
  4. namespace {
  5. template <typename TStream>
  6. auto& Output(TStream& o, const NMonitoring::ISummaryDoubleSnapshot& s) {
  7. o << TStringBuf("{");
  8. o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", ");
  9. o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", ");
  10. o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", ");
  11. o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", ");
  12. o << TStringBuf("count: ") << s.GetCount();
  13. o << TStringBuf("}");
  14. return o;
  15. }
  16. } // namespace
  17. std::ostream& operator<<(std::ostream& o, const NMonitoring::ISummaryDoubleSnapshot& s) {
  18. return Output(o, s);
  19. }
  20. template <>
  21. void Out<NMonitoring::ISummaryDoubleSnapshot>(IOutputStream& o, const NMonitoring::ISummaryDoubleSnapshot& s) {
  22. Output(o, s);
  23. }