Merge "Include pid of ANRing process in perfetto traces" into udc-dev

This commit is contained in:
Ben Miles
2023-03-27 14:15:45 +00:00
committed by Android (Google) Code Review
3 changed files with 8 additions and 5 deletions

View File

@@ -880,7 +880,8 @@ public class Watchdog implements Dumpable {
CriticalEventLog.getInstance().logLinesForSystemServerTraceFile();
final UUID errorId = mTraceErrorLogger.generateErrorId();
if (mTraceErrorLogger.isAddErrorIdEnabled()) {
mTraceErrorLogger.addErrorIdToTrace("system_server", errorId);
mTraceErrorLogger.addProcessInfoAndErrorIdToTrace("system_server", Process.myPid(),
errorId);
mTraceErrorLogger.addSubjectToTrace(subject, errorId);
}

View File

@@ -348,7 +348,8 @@ class ProcessErrorStateRecord {
if (mService.mTraceErrorLogger != null
&& mService.mTraceErrorLogger.isAddErrorIdEnabled()) {
errorId = mService.mTraceErrorLogger.generateErrorId();
mService.mTraceErrorLogger.addErrorIdToTrace(mApp.processName, errorId);
mService.mTraceErrorLogger.addProcessInfoAndErrorIdToTrace(
mApp.processName, pid, errorId);
mService.mTraceErrorLogger.addSubjectToTrace(annotation, errorId);
} else {
errorId = null;

View File

@@ -45,12 +45,13 @@ public class TraceErrorLogger {
* can be uniquely identified. We also add the same id to the dropbox entry of the error, so
* that we can join the trace and the error server-side.
*
* @param processName The process name to include in the error id.
* @param processName The name of the ANRing process.
* @param pid The pid of the ANRing process.
* @param errorId The unique id with which to tag the trace.
*/
public void addErrorIdToTrace(String processName, UUID errorId) {
public void addProcessInfoAndErrorIdToTrace(String processName, int pid, UUID errorId) {
Trace.traceCounter(Trace.TRACE_TAG_ACTIVITY_MANAGER,
COUNTER_PREFIX + processName + "#" + errorId.toString(),
COUNTER_PREFIX + processName + " " + pid + "#" + errorId.toString(),
PLACEHOLDER_VALUE);
}