blob: 95d5d193c29ad7f4dc0ed052b28bd9796c9b3743 [file] [log] [blame]
Rajeev Kumar22d92b72018-02-07 18:38:36 -08001/*
2 * Copyright (C) 2018 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
17package android.app;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * The memory stats for a process.
24 * {@hide}
25 */
Rafal Slawik5c1263e2018-09-12 17:20:31 +010026public final class ProcessMemoryState implements Parcelable {
27 public final int uid;
28 public final String processName;
29 public final int oomScore;
30 public final long pgfault;
31 public final long pgmajfault;
32 public final long rssInBytes;
33 public final long cacheInBytes;
34 public final long swapInBytes;
Rafal Slawikbf67d072018-10-23 11:07:54 +010035 public final long startTimeNanos;
Rajeev Kumar22d92b72018-02-07 18:38:36 -080036
37 public ProcessMemoryState(int uid, String processName, int oomScore, long pgfault,
38 long pgmajfault, long rssInBytes, long cacheInBytes,
Rafal Slawikd03ae422018-11-20 11:27:45 +000039 long swapInBytes, long startTimeNanos) {
Rajeev Kumar22d92b72018-02-07 18:38:36 -080040 this.uid = uid;
41 this.processName = processName;
42 this.oomScore = oomScore;
43 this.pgfault = pgfault;
44 this.pgmajfault = pgmajfault;
45 this.rssInBytes = rssInBytes;
46 this.cacheInBytes = cacheInBytes;
47 this.swapInBytes = swapInBytes;
Rafal Slawikbf67d072018-10-23 11:07:54 +010048 this.startTimeNanos = startTimeNanos;
Rajeev Kumar22d92b72018-02-07 18:38:36 -080049 }
50
51 private ProcessMemoryState(Parcel in) {
52 uid = in.readInt();
53 processName = in.readString();
54 oomScore = in.readInt();
55 pgfault = in.readLong();
56 pgmajfault = in.readLong();
57 rssInBytes = in.readLong();
58 cacheInBytes = in.readLong();
59 swapInBytes = in.readLong();
Rafal Slawikbf67d072018-10-23 11:07:54 +010060 startTimeNanos = in.readLong();
Rajeev Kumar22d92b72018-02-07 18:38:36 -080061 }
62
63 public static final Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
64 @Override
65 public ProcessMemoryState createFromParcel(Parcel in) {
66 return new ProcessMemoryState(in);
67 }
68
69 @Override
70 public ProcessMemoryState[] newArray(int size) {
71 return new ProcessMemoryState[size];
72 }
73 };
74
75 @Override
76 public int describeContents() {
77 return 0;
78 }
79
80 @Override
81 public void writeToParcel(Parcel parcel, int i) {
82 parcel.writeInt(uid);
83 parcel.writeString(processName);
84 parcel.writeInt(oomScore);
85 parcel.writeLong(pgfault);
86 parcel.writeLong(pgmajfault);
87 parcel.writeLong(rssInBytes);
88 parcel.writeLong(cacheInBytes);
89 parcel.writeLong(swapInBytes);
Rafal Slawikbf67d072018-10-23 11:07:54 +010090 parcel.writeLong(startTimeNanos);
Rajeev Kumar22d92b72018-02-07 18:38:36 -080091 }
92}