Hash :
6d0452b7
Author :
Date :
2022-08-10T13:34:29
Fix ANGLE_HAS_HISTOGRAMS following crrev.com/c/3817602 Bug: angleproject:7299 Change-Id: I1d6f97e61dfdbea04009cc08a17344a59e438e51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3823618 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
//
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// HistogramWriter:
// Helper class for writing histogram-json-set-format files to JSON.
#ifndef ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_
#define ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_
#if !defined(ANGLE_HAS_HISTOGRAMS)
# error "Requires ANGLE_HAS_HISTOGRAMS, see angle_maybe_has_histograms"
#endif // !defined(ANGLE_HAS_HISTOGRAMS)
#include <map>
#include <memory>
#include <string>
// Include forward delcarations for rapidjson types.
#include <rapidjson/fwd.h>
namespace catapult
{
class HistogramBuilder;
} // namespace catapult
namespace angle
{
class HistogramWriter
{
public:
HistogramWriter();
~HistogramWriter();
void addSample(const std::string &measurement,
const std::string &story,
double value,
const std::string &units);
void getAsJSON(rapidjson::Document *doc) const;
private:
#if ANGLE_HAS_HISTOGRAMS
std::map<std::string, std::unique_ptr<catapult::HistogramBuilder>> mHistograms;
#endif // ANGLE_HAS_HISTOGRAMS
};
// Define a stub implementation when histograms are compiled out.
#if !ANGLE_HAS_HISTOGRAMS
inline HistogramWriter::HistogramWriter() = default;
inline HistogramWriter::~HistogramWriter() = default;
inline void HistogramWriter::addSample(const std::string &measurement,
const std::string &story,
double value,
const std::string &units)
{}
inline void HistogramWriter::getAsJSON(rapidjson::Document *doc) const {}
#endif // !ANGLE_HAS_HISTOGRAMS
} // namespace angle
#endif // ANGLE_TESTS_TEST_UTILS_HISTOGRAM_WRITER_H_