blob: 42307151f7cf747a2787205a3ef55107dee30c52 [file] [log] [blame]
Åsa Persson352b2d72015-04-15 18:00:40 +02001/*
2 * Copyright (c) 2015 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
11#include "webrtc/test/histogram.h"
12
13#include <map>
14
15#include "webrtc/system_wrappers/interface/metrics.h"
16
17// Test implementation of histogram methods in
18// webrtc/system_wrappers/interface/metrics.h.
19
20namespace webrtc {
21namespace {
22// Map holding the last added sample to a histogram (mapped by histogram name).
23std::map<std::string, int> histograms_;
24} // namespace
25
26namespace metrics {
27Histogram* HistogramFactoryGetCounts(const std::string& name, int min, int max,
28 int bucket_count) { return NULL; }
29
30Histogram* HistogramFactoryGetEnumeration(const std::string& name,
31 int boundary) { return NULL; }
32
33void HistogramAdd(
34 Histogram* histogram_pointer, const std::string& name, int sample) {
35 histograms_[name] = sample;
36}
37} // namespace metrics
38
39namespace test {
40int LastHistogramSample(const std::string& name) {
41 std::map<std::string, int>::const_iterator it = histograms_.find(name);
42 if (it == histograms_.end()) {
43 return -1;
44 }
45 return it->second;
46}
47} // namespace test
48} // namespace webrtc
49