blob: 6a78d3616ab2ca221ddc719e264fbe2589bdde62 [file] [log] [blame]
Per Ã…hgrenada9b892019-04-03 16:06:42 +02001/*
2 * Copyright (c) 2019 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#ifndef MODULES_AUDIO_PROCESSING_TEST_API_CALL_STATISTICS_H_
12#define MODULES_AUDIO_PROCESSING_TEST_API_CALL_STATISTICS_H_
13
14#include <string>
15#include <vector>
16
17namespace webrtc {
18namespace test {
19
20// Collects statistics about the API call durations.
21class ApiCallStatistics {
22 public:
23 enum class CallType { kRender, kCapture };
24
25 // Adds a new datapoint.
26 void Add(int64_t duration_nanos, CallType call_type);
27
28 // Prints out a report of the statistics.
29 void PrintReport() const;
30
31 // Writes the call information to a file.
32 void WriteReportToFile(const std::string& filename) const;
33
34 private:
35 struct CallData {
36 CallData(int64_t duration_nanos, CallType call_type);
37 int64_t duration_nanos;
38 CallType call_type;
39 };
40 std::vector<CallData> calls_;
41};
42
43} // namespace test
44} // namespace webrtc
45
46#endif // MODULES_AUDIO_PROCESSING_TEST_API_CALL_STATISTICS_H_