Home | History | Annotate | Download | only in app
      1 /*
      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 
     17 package android.app;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 /**
     23  * The memory stats for a process.
     24  * {@hide}
     25  */
     26 public class ProcessMemoryState implements Parcelable {
     27     public int uid;
     28     public String processName;
     29     public int oomScore;
     30     public long pgfault;
     31     public long pgmajfault;
     32     public long rssInBytes;
     33     public long cacheInBytes;
     34     public long swapInBytes;
     35 
     36     public ProcessMemoryState(int uid, String processName, int oomScore, long pgfault,
     37                               long pgmajfault, long rssInBytes, long cacheInBytes,
     38                               long swapInBytes) {
     39         this.uid = uid;
     40         this.processName = processName;
     41         this.oomScore = oomScore;
     42         this.pgfault = pgfault;
     43         this.pgmajfault = pgmajfault;
     44         this.rssInBytes = rssInBytes;
     45         this.cacheInBytes = cacheInBytes;
     46         this.swapInBytes = swapInBytes;
     47     }
     48 
     49     private ProcessMemoryState(Parcel in) {
     50         uid = in.readInt();
     51         processName = in.readString();
     52         oomScore = in.readInt();
     53         pgfault = in.readLong();
     54         pgmajfault = in.readLong();
     55         rssInBytes = in.readLong();
     56         cacheInBytes = in.readLong();
     57         swapInBytes = in.readLong();
     58     }
     59 
     60     public static final Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
     61         @Override
     62         public ProcessMemoryState createFromParcel(Parcel in) {
     63             return new ProcessMemoryState(in);
     64         }
     65 
     66         @Override
     67         public ProcessMemoryState[] newArray(int size) {
     68             return new ProcessMemoryState[size];
     69         }
     70     };
     71 
     72     @Override
     73     public int describeContents() {
     74         return 0;
     75     }
     76 
     77     @Override
     78     public void writeToParcel(Parcel parcel, int i) {
     79         parcel.writeInt(uid);
     80         parcel.writeString(processName);
     81         parcel.writeInt(oomScore);
     82         parcel.writeLong(pgfault);
     83         parcel.writeLong(pgmajfault);
     84         parcel.writeLong(rssInBytes);
     85         parcel.writeLong(cacheInBytes);
     86         parcel.writeLong(swapInBytes);
     87     }
     88 }
     89