Path: blob/main_old/src/tests/test_utils/runner/HistogramWriter.h
1694 views
//1// Copyright 2020 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//5// HistogramWriter:6// Helper class for writing histogram-json-set-format files to JSON.78#ifndef ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_9#define ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_1011#include <map>12#include <memory>13#include <string>1415// Include forward delcarations for rapidjson types.16#include <rapidjson/fwd.h>1718namespace catapult19{20class HistogramBuilder;21} // namespace catapult2223namespace angle24{25class HistogramWriter26{27public:28HistogramWriter();29~HistogramWriter();3031void addSample(const std::string &measurement,32const std::string &story,33double value,34const std::string &units);3536void getAsJSON(rapidjson::Document *doc) const;3738private:39#if defined(ANGLE_HAS_HISTOGRAMS)40std::map<std::string, std::unique_ptr<catapult::HistogramBuilder>> mHistograms;41#endif // defined(ANGLE_HAS_HISTOGRAMS)42};4344// Define a stub implementation when histograms are compiled out.45#if !defined(ANGLE_HAS_HISTOGRAMS)46inline HistogramWriter::HistogramWriter() = default;47inline HistogramWriter::~HistogramWriter() = default;48inline void HistogramWriter::addSample(const std::string &measurement,49const std::string &story,50double value,51const std::string &units)52{}53inline void HistogramWriter::getAsJSON(rapidjson::Document *doc) const {}54#endif // !defined(ANGLE_HAS_HISTOGRAMS)5556} // namespace angle5758#endif // ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_596061