summaryrefslogtreecommitdiff
path: root/src/com/android/loganalysis/item
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/loganalysis/item')
-rw-r--r--src/com/android/loganalysis/item/DumpsysProcessMeminfoItem.java119
-rw-r--r--src/com/android/loganalysis/item/GfxInfoItem.java40
-rw-r--r--src/com/android/loganalysis/item/TraceFormatItem.java118
-rw-r--r--src/com/android/loganalysis/item/TransitionDelayItem.java44
4 files changed, 313 insertions, 8 deletions
diff --git a/src/com/android/loganalysis/item/DumpsysProcessMeminfoItem.java b/src/com/android/loganalysis/item/DumpsysProcessMeminfoItem.java
new file mode 100644
index 0000000..3abfd40
--- /dev/null
+++ b/src/com/android/loganalysis/item/DumpsysProcessMeminfoItem.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.loganalysis.item;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * An {@link IItem} used to store output from `dumpsys meminfo --checkin PROCESS` where PROCESS is
+ * from the output of `dumpsys meminfo`. Data is stored as a map of categories to a map of
+ * measurement types to values.
+ */
+public class DumpsysProcessMeminfoItem extends GenericMapItem<Map<String, Long>> {
+ // Should match value from ActivityThread
+ public static final int ACTIVITY_THREAD_CHECKIN_VERSION = 4;
+
+ // Default Categories
+ public static final String NATIVE = "NATIVE";
+ public static final String DALVIK = "DALVIK";
+ public static final String OTHER = "OTHER";
+ public static final String TOTAL = "TOTAL";
+
+ // Memory Measurement Types
+ public static final String PSS = "PSS";
+ public static final String SWAPPABLE_PSS = "SWAPPABLE_PSS";
+ public static final String SHARED_DIRTY = "SHARED_DIRTY";
+ public static final String SHARED_CLEAN = "SHARED_CLEAN";
+ public static final String PRIVATE_DIRTY = "PRIVATE_DIRTY";
+ public static final String PRIVATE_CLEAN = "PRIVATE_CLEAN";
+ public static final String SWAPPED_OUT = "SWAPPED_OUT";
+ public static final String SWAPPED_OUT_PSS = "SWAPPED_OUT_PSS";
+ // NATIVE, DALVIK, TOTAL only
+ public static final String MAX = "MAX";
+ public static final String ALLOCATED = "ALLOCATED";
+ public static final String FREE = "FREE";
+
+ public static final String[] MAIN_OUTPUT_ORDER = {
+ MAX,
+ ALLOCATED,
+ FREE,
+ PSS,
+ SWAPPABLE_PSS,
+ SHARED_DIRTY,
+ SHARED_CLEAN,
+ PRIVATE_DIRTY,
+ PRIVATE_CLEAN,
+ SWAPPED_OUT,
+ SWAPPED_OUT_PSS
+ };
+ public static final String[] OTHER_OUTPUT_ORDER = {
+ PSS,
+ SWAPPABLE_PSS,
+ SHARED_DIRTY,
+ SHARED_CLEAN,
+ PRIVATE_DIRTY,
+ PRIVATE_CLEAN,
+ SWAPPED_OUT,
+ SWAPPED_OUT_PSS
+ };
+
+ private int mPid;
+ private String mProcessName;
+
+ public DumpsysProcessMeminfoItem() {
+ this.put(NATIVE, new HashMap<>());
+ this.put(DALVIK, new HashMap<>());
+ this.put(OTHER, new HashMap<>());
+ this.put(TOTAL, new HashMap<>());
+ }
+
+ /** Get the pid */
+ public int getPid() {
+ return mPid;
+ }
+
+ /** Set the pid */
+ public void setPid(int pid) {
+ mPid = pid;
+ }
+
+ /** Get the process name */
+ public String getProcessName() {
+ return mProcessName;
+ }
+
+ /** Set the process name */
+ public void setProcessName(String processName) {
+ mProcessName = processName;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public JSONObject toJson() {
+ JSONObject result = super.toJson();
+ try {
+ result.put("pid", mPid);
+ result.put("process_name", mProcessName);
+ } catch (JSONException e) {
+ //ignore
+ }
+ return result;
+ }
+}
diff --git a/src/com/android/loganalysis/item/GfxInfoItem.java b/src/com/android/loganalysis/item/GfxInfoItem.java
index 482cea3..21ff245 100644
--- a/src/com/android/loganalysis/item/GfxInfoItem.java
+++ b/src/com/android/loganalysis/item/GfxInfoItem.java
@@ -38,6 +38,12 @@ public class GfxInfoItem implements IItem {
public static final String TOTAL_FRAMES_KEY = "total_frames";
/** Constant for JSON output */
public static final String JANKY_FRAMES_KEY = "janky_frames";
+ /** Constant for JSON output */
+ public static final String PERCENTILE_90_KEY = "percentile_90";
+ /** Constant for JSON output */
+ public static final String PERCENTILE_95_KEY = "percentile_95";
+ /** Constant for JSON output */
+ public static final String PERCENTILE_99_KEY = "percentile_99";
private Map<Integer, Row> mRows = new HashMap<Integer, Row>();
@@ -45,6 +51,9 @@ public class GfxInfoItem implements IItem {
public String name;
public long totalFrames;
public long jankyFrames;
+ public int percentile90;
+ public int percentile95;
+ public int percentile99;
}
/**
@@ -76,7 +85,9 @@ public class GfxInfoItem implements IItem {
proc.put(PID_KEY, pid);
proc.put(NAME_KEY, getName(pid));
proc.put(TOTAL_FRAMES_KEY, getTotalFrames(pid));
- proc.put(JANKY_FRAMES_KEY, getJankyFrames(pid));
+ proc.put(PERCENTILE_90_KEY, getPrecentile90(pid));
+ proc.put(PERCENTILE_95_KEY, getPrecentile95(pid));
+ proc.put(PERCENTILE_99_KEY, getPrecentile99(pid));
processes.put(proc);
} catch (JSONException e) {
// ignore
@@ -106,11 +117,21 @@ public class GfxInfoItem implements IItem {
* @param totalFrames The number of total frames rendered by the process
* @param jankyFrames The number of janky frames rendered by the process
*/
- public void addRow(int pid, String name, long totalFrames, long jankyFrames) {
+ public void addRow(
+ int pid,
+ String name,
+ long totalFrames,
+ long jankyFrames,
+ int percentile90,
+ int percentile95,
+ int percentile99) {
Row row = new Row();
row.name = name;
row.totalFrames = totalFrames;
row.jankyFrames = jankyFrames;
+ row.percentile90 = percentile90;
+ row.percentile95 = percentile95;
+ row.percentile99 = percentile99;
mRows.put(pid, row);
}
@@ -134,4 +155,19 @@ public class GfxInfoItem implements IItem {
public long getJankyFrames(int pid) {
return mRows.get(pid).jankyFrames;
}
+
+ /** Get the 90th percentile value of frame times (ms) */
+ public int getPrecentile90(int pid) {
+ return mRows.get(pid).percentile90;
+ }
+
+ /** Get the 95th percentile value of frame times (ms) */
+ public int getPrecentile95(int pid) {
+ return mRows.get(pid).percentile95;
+ }
+
+ /** Get the 99th percentile value of frame times (ms) */
+ public int getPrecentile99(int pid) {
+ return mRows.get(pid).percentile99;
+ }
}
diff --git a/src/com/android/loganalysis/item/TraceFormatItem.java b/src/com/android/loganalysis/item/TraceFormatItem.java
new file mode 100644
index 0000000..82944d5
--- /dev/null
+++ b/src/com/android/loganalysis/item/TraceFormatItem.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.loganalysis.item;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+/** A {@link GenericItem} of trace format. */
+public class TraceFormatItem extends GenericItem {
+ private static final String REGEX = "regex";
+ private static final String PARAMS = "params";
+ private static final String NUM_PARAMS = "num_params";
+ private static final String HEX_PARAMS = "hex_params";
+ private static final String STR_PARAMS = "str_params";
+ private static final Set<String> ATTRIBUTES =
+ new HashSet<>(Arrays.asList(REGEX, PARAMS, NUM_PARAMS, HEX_PARAMS, STR_PARAMS));
+
+ /** Create a new {@link TraceFormatItem} */
+ public TraceFormatItem() {
+ super(ATTRIBUTES);
+ }
+
+ @Override
+ /** TraceFormatItem doesn't support merge */
+ public IItem merge(IItem other) throws ConflictingItemException {
+ throw new ConflictingItemException("Trace format items cannot be merged");
+ }
+
+ /** Get a compiled regex that matches output of this trace format */
+ public Pattern getRegex() {
+ return (Pattern) getAttribute(REGEX);
+ }
+
+ /** Set a compiled regex that matches output of this trace format */
+ public void setRegex(Pattern regex) {
+ setAttribute(REGEX, regex);
+ }
+
+ /**
+ * Get all parameters found in this trace format. The parameters were converted to camel case
+ * and match the group names in the regex.
+ */
+ public List<String> getParameters() {
+ return (List<String>) getAttribute(PARAMS);
+ }
+
+ /**
+ * Set all parameters found in this trace format. The parameters were converted to camel case
+ * and match the group names in the regex.
+ */
+ public void setParameters(List<String> parameters) {
+ setAttribute(PARAMS, parameters);
+ }
+
+ /**
+ * Get numeric parameters found in this trace format. The parameters were converted to camel
+ * case and match the group names in the regex.
+ */
+ public List<String> getNumericParameters() {
+ return (List<String>) getAttribute(NUM_PARAMS);
+ }
+
+ /**
+ * Set numeric parameters found in this trace format. The parameters were converted to camel
+ * case and match the group names in the regex.
+ */
+ public void setNumericParameters(List<String> numericParameters) {
+ setAttribute(NUM_PARAMS, numericParameters);
+ }
+
+ /**
+ * Get hexadecimal parameters found in this trace format. The parameters were converted to camel
+ * case and match the group names in the regex.
+ */
+ public List<String> getHexParameters() {
+ return (List<String>) getAttribute(HEX_PARAMS);
+ }
+
+ /**
+ * Set hexadecimal parameters found in this trace format. The parameters were converted to camel
+ * case and match the group names in the regex.
+ */
+ public void setHexParameters(List<String> hexParameters) {
+ setAttribute(HEX_PARAMS, hexParameters);
+ }
+
+ /**
+ * Get string parameters found in this trace format. The parameters were converted to camel case
+ * and match the group names in the regex.
+ */
+ public List<String> getStringParameters() {
+ return (List<String>) getAttribute(STR_PARAMS);
+ }
+
+ /**
+ * Set string parameters found in this trace format. The parameters were converted to camel case
+ * and match the group names in the regex.
+ */
+ public void setStringParameters(List<String> stringParameters) {
+ setAttribute(STR_PARAMS, stringParameters);
+ }
+}
diff --git a/src/com/android/loganalysis/item/TransitionDelayItem.java b/src/com/android/loganalysis/item/TransitionDelayItem.java
index 33a1b93..6e09d4b 100644
--- a/src/com/android/loganalysis/item/TransitionDelayItem.java
+++ b/src/com/android/loganalysis/item/TransitionDelayItem.java
@@ -30,9 +30,19 @@ public class TransitionDelayItem extends GenericItem {
public static final String START_WINDOW_DELAY = "START_WINDOW_DELAY";
/** Constant for JSON output */
public static final String TRANSITION_DELAY = "TRANSITION_DELAY";
+ /** Constant for JSON output */
+ public static final String DATE_TIME = "DATE_TIME";
+ /** Constant for JSON output */
+ public static final String WINDOW_DRAWN_DELAY = "WINDOW_DRAWN_DELAY";
- private static final Set<String> ATTRIBUTES = new HashSet<String>(Arrays.asList(
- COMPONENT_NAME, START_WINDOW_DELAY, TRANSITION_DELAY));
+ private static final Set<String> ATTRIBUTES =
+ new HashSet<String>(
+ Arrays.asList(
+ COMPONENT_NAME,
+ START_WINDOW_DELAY,
+ TRANSITION_DELAY,
+ DATE_TIME,
+ WINDOW_DRAWN_DELAY));
/**
* The constructor for {@link TransitionDelayItem}.
@@ -49,20 +59,42 @@ public class TransitionDelayItem extends GenericItem {
setAttribute(COMPONENT_NAME, componentName);
}
- public long getStartingWindowDelay() {
- return (long) getAttribute(START_WINDOW_DELAY);
+ public Long getStartingWindowDelay() {
+ return getAttribute(START_WINDOW_DELAY) != null ? (Long) getAttribute(START_WINDOW_DELAY)
+ : null;
}
public void setStartingWindowDelay(long startingWindowDelay) {
setAttribute(START_WINDOW_DELAY, startingWindowDelay);
}
- public long getTransitionDelay() {
- return (long) getAttribute(TRANSITION_DELAY);
+ public Long getTransitionDelay() {
+ return (Long) getAttribute(TRANSITION_DELAY);
}
public void setTransitionDelay(long transitionDelay) {
setAttribute(TRANSITION_DELAY, transitionDelay);
}
+ /**
+ * @return date and time (MM-DD HH:MM:SS.mmm) in string format parsed from events log
+ * and used in AUPT test.
+ */
+ public String getDateTime() {
+ return (String) getAttribute(DATE_TIME);
+ }
+
+ public void setDateTime(String dateTime) {
+ setAttribute(DATE_TIME, dateTime);
+ }
+
+ public Long getWindowDrawnDelay() {
+ return getAttribute(WINDOW_DRAWN_DELAY) != null
+ ? (Long) getAttribute(WINDOW_DRAWN_DELAY)
+ : null;
+ }
+
+ public void setWindowDrawnDelay(long windowDrawnDelay) {
+ setAttribute(WINDOW_DRAWN_DELAY, windowDrawnDelay);
+ }
}