2012-11-20 00:20:20 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 The WebRTC 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 in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef TEST_TESTSUPPORT_PERF_TEST_H_
|
|
|
|
|
#define TEST_TESTSUPPORT_PERF_TEST_H_
|
2012-11-20 00:20:20 +00:00
|
|
|
|
2017-11-30 11:43:42 +01:00
|
|
|
#include "api/array_view.h"
|
|
|
|
|
|
2016-06-03 09:27:37 -07:00
|
|
|
#include <sstream>
|
2012-11-20 00:20:20 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
// Prints numerical information to stdout in a controlled format, for
|
|
|
|
|
// post-processing. |measurement| is a description of the quantity being
|
|
|
|
|
// measured, e.g. "vm_peak"; |modifier| is provided as a convenience and
|
|
|
|
|
// will be appended directly to the name of the |measurement|, e.g.
|
|
|
|
|
// "_browser"; |trace| is a description of the particular data point, e.g.
|
|
|
|
|
// "reference"; |value| is the measured value; and |units| is a description
|
|
|
|
|
// of the units of measure, e.g. "bytes". If |important| is true, the output
|
|
|
|
|
// line will be specially marked, to notify the post-processor. The strings
|
|
|
|
|
// may be empty. They should not contain any colons (:) or equals signs (=).
|
|
|
|
|
// A typical post-processing step would be to produce graphs of the data
|
|
|
|
|
// produced for various builds, using the combined |measurement| + |modifier|
|
|
|
|
|
// string to specify a particular graph and the |trace| to identify a trace
|
|
|
|
|
// (i.e., data series) on that graph.
|
|
|
|
|
void PrintResult(const std::string& measurement,
|
|
|
|
|
const std::string& modifier,
|
|
|
|
|
const std::string& trace,
|
2017-11-22 19:17:50 +01:00
|
|
|
const double value,
|
2012-11-20 00:20:20 +00:00
|
|
|
const std::string& units,
|
|
|
|
|
bool important);
|
|
|
|
|
|
|
|
|
|
// Like PrintResult(), but prints a (mean, standard deviation) result pair.
|
|
|
|
|
// The |<values>| should be two comma-separated numbers, the mean and
|
|
|
|
|
// standard deviation (or other error metric) of the measurement.
|
|
|
|
|
void PrintResultMeanAndError(const std::string& measurement,
|
|
|
|
|
const std::string& modifier,
|
|
|
|
|
const std::string& trace,
|
2017-11-23 14:06:04 +01:00
|
|
|
const double mean,
|
|
|
|
|
const double error,
|
2012-11-20 00:20:20 +00:00
|
|
|
const std::string& units,
|
|
|
|
|
bool important);
|
|
|
|
|
|
|
|
|
|
// Like PrintResult(), but prints an entire list of results. The |values|
|
|
|
|
|
// will generally be a list of comma-separated numbers. A typical
|
|
|
|
|
// post-processing step might produce plots of their mean and standard
|
|
|
|
|
// deviation.
|
|
|
|
|
void PrintResultList(const std::string& measurement,
|
|
|
|
|
const std::string& modifier,
|
|
|
|
|
const std::string& trace,
|
2017-11-30 11:43:42 +01:00
|
|
|
rtc::ArrayView<const double> values,
|
2012-11-20 00:20:20 +00:00
|
|
|
const std::string& units,
|
|
|
|
|
bool important);
|
|
|
|
|
|
2018-01-25 15:17:55 +01:00
|
|
|
// Returns all perf results to date in a JSON string formatted as described in
|
2017-11-30 11:43:42 +01:00
|
|
|
// https://github.com/catapult-project/catapult/blob/master/dashboard/docs/data-format.md
|
2018-01-25 15:17:55 +01:00
|
|
|
std::string GetPerfResultsJSON();
|
|
|
|
|
|
|
|
|
|
// Writes the JSON representation of the perf results returned by
|
|
|
|
|
// GetPerfResultsJSON() to the file in output_path.
|
2018-01-05 15:34:09 +01:00
|
|
|
void WritePerfResults(const std::string& output_path);
|
|
|
|
|
|
2018-01-25 15:17:55 +01:00
|
|
|
// By default, perf results are printed to stdout. Set the FILE* to where they
|
|
|
|
|
// should be printing instead.
|
2018-01-25 17:59:55 +01:00
|
|
|
void SetPerfResultsOutput(FILE* output);
|
2017-11-30 11:43:42 +01:00
|
|
|
|
|
|
|
|
// You shouldn't use this function. It's only used to test the functions above.
|
|
|
|
|
void ClearPerfResults();
|
|
|
|
|
|
2012-11-20 00:20:20 +00:00
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // TEST_TESTSUPPORT_PERF_TEST_H_
|