Merge "Include real to elapsed time offset in transition trace" into udc-dev
This commit is contained in:
@@ -44,6 +44,10 @@ message TransitionTraceProto {
|
||||
// Additional debugging info only collected and dumped when explicitly requested to trace
|
||||
repeated TransitionState transition_states = 3;
|
||||
repeated TransitionInfo transition_info = 4;
|
||||
|
||||
/* offset between real-time clock and elapsed time clock in nanoseconds.
|
||||
Calculated as: 1000000 * System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() */
|
||||
optional fixed64 real_to_elapsed_time_offset_nanos = 5;
|
||||
}
|
||||
|
||||
message Transition {
|
||||
|
||||
@@ -21,6 +21,7 @@ import static android.os.Build.IS_USER;
|
||||
import static com.android.server.wm.shell.TransitionTraceProto.MAGIC_NUMBER;
|
||||
import static com.android.server.wm.shell.TransitionTraceProto.MAGIC_NUMBER_H;
|
||||
import static com.android.server.wm.shell.TransitionTraceProto.MAGIC_NUMBER_L;
|
||||
import static com.android.server.wm.shell.TransitionTraceProto.REAL_TO_ELAPSED_TIME_OFFSET_NANOS;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
@@ -37,6 +38,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Helper class to collect and dump transition traces.
|
||||
@@ -395,6 +397,10 @@ public class TransitionTracer {
|
||||
try {
|
||||
ProtoOutputStream proto = new ProtoOutputStream();
|
||||
proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE);
|
||||
long timeOffsetNs =
|
||||
TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis())
|
||||
- SystemClock.elapsedRealtimeNanos();
|
||||
proto.write(REAL_TO_ELAPSED_TIME_OFFSET_NANOS, timeOffsetNs);
|
||||
int pid = android.os.Process.myPid();
|
||||
LogAndPrintln.i(pw, "Writing file to " + file.getAbsolutePath()
|
||||
+ " from process " + pid);
|
||||
|
||||
Reference in New Issue
Block a user