perf_test_result_writer.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef TEST_TESTSUPPORT_PERF_TEST_RESULT_WRITER_H_
  11. #define TEST_TESTSUPPORT_PERF_TEST_RESULT_WRITER_H_
  12. #include <stdio.h>
  13. #include <string>
  14. #include "test/testsupport/perf_test.h"
  15. namespace webrtc {
  16. namespace test {
  17. // Interface for classes that write perf results to some kind of JSON format.
  18. class PerfTestResultWriter {
  19. public:
  20. virtual ~PerfTestResultWriter() = default;
  21. virtual void ClearResults() = 0;
  22. virtual void LogResult(const std::string& graph_name,
  23. const std::string& trace_name,
  24. const double value,
  25. const std::string& units,
  26. const bool important,
  27. webrtc::test::ImproveDirection improve_direction) = 0;
  28. virtual void LogResultMeanAndError(
  29. const std::string& graph_name,
  30. const std::string& trace_name,
  31. const double mean,
  32. const double error,
  33. const std::string& units,
  34. const bool important,
  35. webrtc::test::ImproveDirection improve_direction) = 0;
  36. virtual void LogResultList(
  37. const std::string& graph_name,
  38. const std::string& trace_name,
  39. const rtc::ArrayView<const double> values,
  40. const std::string& units,
  41. const bool important,
  42. webrtc::test::ImproveDirection improve_direction) = 0;
  43. virtual std::string Serialize() const = 0;
  44. };
  45. } // namespace test
  46. } // namespace webrtc
  47. #endif // TEST_TESTSUPPORT_PERF_TEST_RESULT_WRITER_H_