1 : // Copyright 2014 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // This file contains utilities for emitting performance metrics that
16 : // eventually find their way onto the Syzygy dashboard. All metrics are emitted
17 : // with Syzygy version, git hash, timestamp and build configuration information
18 : // attached.
19 : //
20 : // Metric names are alpha-numeric strings. They are made hierarchical by
21 : // inserted '.', allowing related metrics to be grouped. For example,
22 : // "Syzygy.Asan.Shadow.ScanRightForBracketingBlockEnd" and
23 : // "Syzygy.Asan.Shadow.MarkAsFreed".
24 :
25 : #ifndef SYZYGY_TESTING_METRICS_H_
26 : #define SYZYGY_TESTING_METRICS_H_
27 :
28 : #include "base/strings/string_piece.h"
29 :
30 m : namespace testing {
31 :
32 : // Emits a single data point in a named metric. The behaviour of the logging
33 : // is controlled by the SYZYGY_UNITTEST_METRICS environment variable, which is
34 : // a list of options. The options are as follows:
35 : // --emit-to-log
36 : // Causes the metric to be logged to the metrics log.
37 : // --emit-to-waterfall
38 : // Causes the metric to be logged to the waterfall.
39 : // If neither are present the metric will simply be emitted via logging.
40 : // @param name The name of the metric.
41 : // @param value The value of the metric.
42 m : void EmitMetric(const base::StringPiece& name, int64 value);
43 m : void EmitMetric(const base::StringPiece& name, uint64 value);
44 m : void EmitMetric(const base::StringPiece& name, double value);
45 :
46 m : } // namespace testing
47 :
48 : #endif // SYZYGY_TESTING_METRICS_H_
|