package net.northking.cctp.upperComputer.driver.agent.command.data;

import java.util.HashMap;

/**
 * 进程内存信息<br>
 * 单位均为kB<br>
 * totalPss+totalPrivateDirty可得到进程使用的总内存<br>
 * 详细请见<a href="https://developer.android.google.cn/reference/android/os/Debug.MemoryInfo">MemoryInfo</a>
 */
public class ProcessMemoryInfo {
    int pid;
    int dalvikPss;
    int dalvikPrivateDirty;
    int dalvikSharedDirty;
    int nativePss;
    int nativePrivateDirty;
    int nativeSharedDirty;
    int otherPss;
    int otherPrivateDirty;
    int otherSharedDirty;
    /**
     * 进程的总共享内存，以 KB 为单位。这是进程占用的物理内存，包括共享和私有的部分。
     */
    int totalPss;
    int totalSwappablePss;
    /**
     * 进程的私有脏页内存，以 KB 为单位。这是进程修改过的私有内存，不能被其他进程共享。
     */
    int totalPrivateDirty;
    /**
     * 进程的共享脏页内存，以 KB 为单位。这是进程修改过的共享内存，可以被其他进程共享。
     */
    int totalSharedDirty;
    /**
     * 进程的私有干净页内存，以 KB 为单位。这是进程未修改过的私有内存，不能被其他进程共享。
     */
    int totalPrivateClean;
    /**
     * 进程的共享干净页内存，以 KB 为单位。这是进程未修改过的共享内存，可以被其他进程共享。
     */
    int totalSharedClean;

    final HashMap<String, String> memoryStats = new HashMap<>();

    public int getPid() {
        return pid;
    }

    public void setPid(int pid) {
        this.pid = pid;
    }

    public int getDalvikPss() {
        return dalvikPss;
    }

    public void setDalvikPss(int dalvikPss) {
        this.dalvikPss = dalvikPss;
    }

    public int getDalvikPrivateDirty() {
        return dalvikPrivateDirty;
    }

    public void setDalvikPrivateDirty(int dalvikPrivateDirty) {
        this.dalvikPrivateDirty = dalvikPrivateDirty;
    }

    public int getDalvikSharedDirty() {
        return dalvikSharedDirty;
    }

    public void setDalvikSharedDirty(int dalvikSharedDirty) {
        this.dalvikSharedDirty = dalvikSharedDirty;
    }

    public int getNativePss() {
        return nativePss;
    }

    public void setNativePss(int nativePss) {
        this.nativePss = nativePss;
    }

    public int getNativePrivateDirty() {
        return nativePrivateDirty;
    }

    public void setNativePrivateDirty(int nativePrivateDirty) {
        this.nativePrivateDirty = nativePrivateDirty;
    }

    public int getNativeSharedDirty() {
        return nativeSharedDirty;
    }

    public void setNativeSharedDirty(int nativeSharedDirty) {
        this.nativeSharedDirty = nativeSharedDirty;
    }

    public int getOtherPss() {
        return otherPss;
    }

    public void setOtherPss(int otherPss) {
        this.otherPss = otherPss;
    }

    public int getOtherPrivateDirty() {
        return otherPrivateDirty;
    }

    public void setOtherPrivateDirty(int otherPrivateDirty) {
        this.otherPrivateDirty = otherPrivateDirty;
    }

    public int getOtherSharedDirty() {
        return otherSharedDirty;
    }

    public void setOtherSharedDirty(int otherSharedDirty) {
        this.otherSharedDirty = otherSharedDirty;
    }

    public int getTotalPss() {
        return totalPss;
    }

    public void setTotalPss(int totalPss) {
        this.totalPss = totalPss;
    }

    public int getTotalSwappablePss() {
        return totalSwappablePss;
    }

    public void setTotalSwappablePss(int totalSwappablePss) {
        this.totalSwappablePss = totalSwappablePss;
    }

    public int getTotalPrivateDirty() {
        return totalPrivateDirty;
    }

    public void setTotalPrivateDirty(int totalPrivateDirty) {
        this.totalPrivateDirty = totalPrivateDirty;
    }

    public int getTotalSharedDirty() {
        return totalSharedDirty;
    }

    public void setTotalSharedDirty(int totalSharedDirty) {
        this.totalSharedDirty = totalSharedDirty;
    }

    public int getTotalPrivateClean() {
        return totalPrivateClean;
    }

    public void setTotalPrivateClean(int totalPrivateClean) {
        this.totalPrivateClean = totalPrivateClean;
    }

    public int getTotalSharedClean() {
        return totalSharedClean;
    }

    public void setTotalSharedClean(int totalSharedClean) {
        this.totalSharedClean = totalSharedClean;
    }

    public HashMap<String, String> getMemoryStats() {
        return memoryStats;
    }

    @Override
    public String toString() {
        return "ProcessMemoryInfo{" +
                "pid=" + pid +
                ", dalvikPss=" + dalvikPss +
                ", dalvikPrivateDirty=" + dalvikPrivateDirty +
                ", dalvikSharedDirty=" + dalvikSharedDirty +
                ", nativePss=" + nativePss +
                ", nativePrivateDirty=" + nativePrivateDirty +
                ", nativeSharedDirty=" + nativeSharedDirty +
                ", otherPss=" + otherPss +
                ", otherPrivateDirty=" + otherPrivateDirty +
                ", otherSharedDirty=" + otherSharedDirty +
                ", totalPss=" + totalPss +
                ", totalSwappablePss=" + totalSwappablePss +
                ", totalPrivateDirty=" + totalPrivateDirty +
                ", totalSharedDirty=" + totalSharedDirty +
                ", totalPrivateClean=" + totalPrivateClean +
                ", totalSharedClean=" + totalSharedClean +
                ", memoryStats=" + memoryStats +
                '}';
    }
}
