Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 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 android.net.metrics; |
| 18 | |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 19 | import android.annotation.UnsupportedAppUsage; |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 20 | import android.os.Parcel; |
| 21 | import android.os.Parcelable; |
| 22 | |
| 23 | /** |
Erik Kline | 8d1fe54 | 2018-03-12 23:18:58 +0900 | [diff] [blame] | 24 | * An event logged for an interface with APF capabilities when its IpClient state machine exits. |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 25 | * {@hide} |
| 26 | */ |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 27 | public final class ApfStats implements Parcelable { |
| 28 | |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 29 | /** time interval in milliseconds these stastistics covers. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 30 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 31 | public long durationMs; |
| 32 | /** number of received RAs. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 33 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 34 | public int receivedRas; |
| 35 | /** number of received RAs matching a known RA. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 36 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 37 | public int matchingRas; |
| 38 | /** number of received RAs ignored due to the MAX_RAS limit. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 39 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 40 | public int droppedRas; |
| 41 | /** number of received RAs with a minimum lifetime of 0. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 42 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 43 | public int zeroLifetimeRas; |
| 44 | /** number of received RAs that could not be parsed. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 45 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 46 | public int parseErrors; |
| 47 | /** number of APF program updates from receiving RAs.. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 48 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 49 | public int programUpdates; |
| 50 | /** total number of APF program updates. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 51 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 52 | public int programUpdatesAll; |
| 53 | /** number of APF program updates from allowing multicast traffic. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 54 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 55 | public int programUpdatesAllowingMulticast; |
| 56 | /** maximum APF program size advertised by hardware. */ |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 57 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 58 | public int maxProgramSize; |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 59 | |
Mathew Inwood | fa3a746 | 2018-08-08 14:52:47 +0100 | [diff] [blame] | 60 | @UnsupportedAppUsage |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 61 | public ApfStats() { |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | private ApfStats(Parcel in) { |
| 65 | this.durationMs = in.readLong(); |
| 66 | this.receivedRas = in.readInt(); |
| 67 | this.matchingRas = in.readInt(); |
| 68 | this.droppedRas = in.readInt(); |
| 69 | this.zeroLifetimeRas = in.readInt(); |
| 70 | this.parseErrors = in.readInt(); |
| 71 | this.programUpdates = in.readInt(); |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 72 | this.programUpdatesAll = in.readInt(); |
| 73 | this.programUpdatesAllowingMulticast = in.readInt(); |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 74 | this.maxProgramSize = in.readInt(); |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public void writeToParcel(Parcel out, int flags) { |
| 79 | out.writeLong(durationMs); |
| 80 | out.writeInt(receivedRas); |
| 81 | out.writeInt(matchingRas); |
| 82 | out.writeInt(droppedRas); |
| 83 | out.writeInt(zeroLifetimeRas); |
| 84 | out.writeInt(parseErrors); |
| 85 | out.writeInt(programUpdates); |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 86 | out.writeInt(programUpdatesAll); |
| 87 | out.writeInt(programUpdatesAllowingMulticast); |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 88 | out.writeInt(maxProgramSize); |
| 89 | } |
| 90 | |
| 91 | @Override |
| 92 | public int describeContents() { |
| 93 | return 0; |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public String toString() { |
| 98 | return new StringBuilder("ApfStats(") |
| 99 | .append(String.format("%dms ", durationMs)) |
| 100 | .append(String.format("%dB RA: {", maxProgramSize)) |
| 101 | .append(String.format("%d received, ", receivedRas)) |
| 102 | .append(String.format("%d matching, ", matchingRas)) |
| 103 | .append(String.format("%d dropped, ", droppedRas)) |
| 104 | .append(String.format("%d zero lifetime, ", zeroLifetimeRas)) |
Hugo Benichi | 22d9b2d | 2017-02-22 13:02:27 +0900 | [diff] [blame] | 105 | .append(String.format("%d parse errors}, ", parseErrors)) |
| 106 | .append(String.format("updates: {all: %d, RAs: %d, allow multicast: %d})", |
| 107 | programUpdatesAll, programUpdates, programUpdatesAllowingMulticast)) |
Hugo Benichi | 647c86d | 2016-06-07 15:35:16 +0900 | [diff] [blame] | 108 | .toString(); |
| 109 | } |
| 110 | |
| 111 | public static final Parcelable.Creator<ApfStats> CREATOR = new Parcelable.Creator<ApfStats>() { |
| 112 | public ApfStats createFromParcel(Parcel in) { |
| 113 | return new ApfStats(in); |
| 114 | } |
| 115 | |
| 116 | public ApfStats[] newArray(int size) { |
| 117 | return new ApfStats[size]; |
| 118 | } |
| 119 | }; |
| 120 | } |