Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.drivers.server.stats; |
| 18 | |
Georgios Katsikas | fda6674 | 2018-07-31 20:18:14 +0200 | [diff] [blame] | 19 | import java.util.Optional; |
| 20 | |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 21 | /** |
| 22 | * CPU statistics API. |
| 23 | */ |
| 24 | public 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 Katsikas | fda6674 | 2018-07-31 20:18:14 +0200 | [diff] [blame] | 43 | * Returns the hardware queue identifier associated with this CPU core. |
| 44 | * |
| 45 | * @return hardware queue identifier |
| 46 | */ |
| 47 | int queue(); |
| 48 | |
| 49 | /** |
Georgios Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 50 | * Returns the status (true=busy, false=free) of a CPU core. |
| 51 | * |
| 52 | * @return boolean CPU core status |
| 53 | */ |
| 54 | boolean busy(); |
| 55 | |
Georgios Katsikas | fda6674 | 2018-07-31 20:18:14 +0200 | [diff] [blame] | 56 | /** |
Georgios Katsikas | 6dc11c1 | 2018-12-20 08:43:29 +0100 | [diff] [blame^] | 57 | * 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 Katsikas | fda6674 | 2018-07-31 20:18:14 +0200 | [diff] [blame] | 65 | * 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 Katsikas | 973a265 | 2018-06-28 08:45:47 +0200 | [diff] [blame] | 95 | * Returns the average latency incurred by a CPU core, |
Georgios Katsikas | fda6674 | 2018-07-31 20:18:14 +0200 | [diff] [blame] | 96 | * expressed in latencyUnit() monitoring units. |
| 97 | * |
Georgios Katsikas | 973a265 | 2018-06-28 08:45:47 +0200 | [diff] [blame] | 98 | * @return average latency incurred by a CPU core |
Georgios Katsikas | fda6674 | 2018-07-31 20:18:14 +0200 | [diff] [blame] | 99 | */ |
Georgios Katsikas | 973a265 | 2018-06-28 08:45:47 +0200 | [diff] [blame] | 100 | Optional<Float> averageLatency(); |
Georgios Katsikas | fda6674 | 2018-07-31 20:18:14 +0200 | [diff] [blame] | 101 | |
| 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 Katsikas | 8360098 | 2017-05-28 20:41:45 +0200 | [diff] [blame] | 110 | } |