blob: 5296d571e5e76b83096e8f8d77f5367b1cb1fddc [file] [log] [blame]
Georgios Katsikas83600982017-05-28 20:41:45 +02001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.drivers.server.stats;
18
Georgios Katsikasfda66742018-07-31 20:18:14 +020019import java.util.Optional;
20
Georgios Katsikas83600982017-05-28 20:41:45 +020021/**
22 * CPU statistics API.
23 */
24public interface CpuStatistics {
25
26 /**
27 * Returns the ID of a CPU core.
28 *
29 * @return CPU core identifier
30 */
31 int id();
32
33 /**
34 * Returns the load of this CPU core.
35 * This is a value in [0, 1].
36 * Zero means no load, while one means fully loaded.
37 *
38 * @return load of a CPU core
39 */
40 float load();
41
42 /**
Georgios Katsikasfda66742018-07-31 20:18:14 +020043 * Returns the hardware queue identifier associated with this CPU core.
44 *
45 * @return hardware queue identifier
46 */
47 int queue();
48
49 /**
Georgios Katsikas83600982017-05-28 20:41:45 +020050 * Returns the status (true=busy, false=free) of a CPU core.
51 *
52 * @return boolean CPU core status
53 */
54 boolean busy();
55
Georgios Katsikasfda66742018-07-31 20:18:14 +020056 /**
Georgios Katsikas6dc11c12018-12-20 08:43:29 +010057 * Returns the amount of time in ms since the CPU has been busy,
58 * or a negative value if the CPU is idle.
59 *
60 * @return int time in ms since the CPU has been busy
61 */
62 int busySince();
63
64 /**
Georgios Katsikasfda66742018-07-31 20:18:14 +020065 * Returns the unit of throughput values.
66 *
67 * @return throughput monitoring unit
68 */
69 Optional<MonitoringUnit> throughputUnit();
70
71 /**
72 * Returns the average throughput of this CPU core,
73 * expressed in throughputUnit() monitoring units.
74 *
75 * @return average throughput of a CPU core
76 */
77 Optional<Float> averageThroughput();
78
79 /**
80 * Returns the unit of latency values.
81 *
82 * @return latency monitoring unit
83 */
84 Optional<MonitoringUnit> latencyUnit();
85
86 /**
87 * Returns the minimum latency incurred by a CPU core,
88 * expressed in latencyUnit() monitoring units.
89 *
90 * @return minimum latency incurred by a CPU core
91 */
92 Optional<Float> minLatency();
93
94 /**
Georgios Katsikas973a2652018-06-28 08:45:47 +020095 * Returns the average latency incurred by a CPU core,
Georgios Katsikasfda66742018-07-31 20:18:14 +020096 * expressed in latencyUnit() monitoring units.
97 *
Georgios Katsikas973a2652018-06-28 08:45:47 +020098 * @return average latency incurred by a CPU core
Georgios Katsikasfda66742018-07-31 20:18:14 +020099 */
Georgios Katsikas973a2652018-06-28 08:45:47 +0200100 Optional<Float> averageLatency();
Georgios Katsikasfda66742018-07-31 20:18:14 +0200101
102 /**
103 * Returns the maximum latency incurred by a CPU core,
104 * expressed in latencyUnit() monitoring units.
105 *
106 * @return maximum latency incurred by a CPU core
107 */
108 Optional<Float> maxLatency();
109
Georgios Katsikas83600982017-05-28 20:41:45 +0200110}