- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / performance_monitor / performance_monitor_ui_constants.h
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_UI_CONSTANTS_H_
6 #define CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_UI_CONSTANTS_H_
7
8 #include "base/basictypes.h"
9
10 namespace performance_monitor {
11
12 enum EventCategory {
13   EVENT_CATEGORY_EXTENSIONS,
14   EVENT_CATEGORY_CHROME,
15   EVENT_CATEGORY_EXCEPTIONS,
16   EVENT_CATEGORY_NUMBER_OF_CATEGORIES
17 };
18
19 enum MetricCategory {
20   METRIC_CATEGORY_CPU,
21   METRIC_CATEGORY_MEMORY,
22   METRIC_CATEGORY_TIMING,
23   METRIC_CATEGORY_NETWORK,
24   METRIC_CATEGORY_NUMBER_OF_CATEGORIES
25 };
26
27 enum Unit {
28   UNIT_BYTES,
29   UNIT_KILOBYTES,
30   UNIT_MEGABYTES,
31   UNIT_GIGABYTES,
32   UNIT_TERABYTES,
33   UNIT_MICROSECONDS,
34   UNIT_MILLISECONDS,
35   UNIT_SECONDS,
36   UNIT_MINUTES,
37   UNIT_HOURS,
38   UNIT_DAYS,
39   UNIT_WEEKS,
40   UNIT_MONTHS,
41   UNIT_YEARS,
42   UNIT_PERCENT,
43   UNIT_UNDEFINED
44 };
45
46 // The different options for aggregation when we pass data to the UI side.
47 enum AggregationMethod {
48   // IMPORTANT! These values are hard-coded in
49   // chrome/browser/resources/performance_monitor.js. Please do not change them.
50   AGGREGATION_METHOD_NONE,
51   AGGREGATION_METHOD_MEDIAN,
52   AGGREGATION_METHOD_MEAN,
53   AGGREGATION_METHOD_NUMBER_OF_METHODS
54 };
55
56
57 // A MeasurementType represents the "type" of data which we are measuring, e.g.
58 // whether we are measuring distance, memory amounts, time, etc. Two units can
59 // be converted if and only if they are in the same type. We can convert
60 // two units of distance (meters to centimeters), but cannot convert a unit of
61 // time to a unit of memory (seconds to megabytes).
62 enum MeasurementType {
63   MEASUREMENT_TYPE_MEMORY,
64   MEASUREMENT_TYPE_PERCENT,
65   MEASUREMENT_TYPE_TIME,
66   MEASUREMENT_TYPE_UNDEFINED
67 };
68
69 // A struct which holds the conversion information for each unit. The
70 // |amount_in_base_units| corresponds to the value of 1 |unit| in the specified
71 // base for the measurement type (for instance, since the base unit for memory
72 // is bytes, a kilobyte would have |amount_in_base_units| of 1 << 10.
73 struct UnitDetails {
74   const Unit unit;
75   const MeasurementType measurement_type;
76   const int64 amount_in_base_units;
77 };
78
79 // Returns the corresponding UnitDetails for the given unit, or NULL if invalid.
80 const UnitDetails* GetUnitDetails(Unit unit);
81
82 }  // namespace performance_monitor
83
84 #endif  // CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_UI_CONSTANTS_H_