Loading core/java/com/android/internal/protolog/BaseProtoLogImpl.java +10 −2 Original line number Diff line number Diff line Loading @@ -72,11 +72,13 @@ public class BaseProtoLogImpl { private static final String TAG = "ProtoLog"; private static final long MAGIC_NUMBER_VALUE = ((long) MAGIC_NUMBER_H << 32) | MAGIC_NUMBER_L; static final String PROTOLOG_VERSION = "1.0.0"; private static final int DEFAULT_PER_CHUNK_SIZE = 0; private final File mLogFile; private final String mViewerConfigFilename; private final TraceBuffer mBuffer; protected final ProtoLogViewerConfigReader mViewerConfig; private final int mPerChunkSize; private boolean mProtoLogEnabled; private boolean mProtoLogEnabledLockFree; Loading Loading @@ -156,7 +158,7 @@ public class BaseProtoLogImpl { return; } try { ProtoOutputStream os = new ProtoOutputStream(); ProtoOutputStream os = new ProtoOutputStream(mPerChunkSize); long token = os.start(LOG); os.write(MESSAGE_HASH, messageHash); os.write(ELAPSED_REALTIME_NANOS, SystemClock.elapsedRealtimeNanos()); Loading Loading @@ -215,10 +217,16 @@ public class BaseProtoLogImpl { public BaseProtoLogImpl(File file, String viewerConfigFilename, int bufferCapacity, ProtoLogViewerConfigReader viewerConfig) { this(file, viewerConfigFilename, bufferCapacity, viewerConfig, DEFAULT_PER_CHUNK_SIZE); } public BaseProtoLogImpl(File file, String viewerConfigFilename, int bufferCapacity, ProtoLogViewerConfigReader viewerConfig, int perChunkSize) { mLogFile = file; mBuffer = new TraceBuffer(bufferCapacity); mViewerConfigFilename = viewerConfigFilename; mViewerConfig = viewerConfig; mPerChunkSize = perChunkSize; } /** Loading Loading @@ -364,7 +372,7 @@ public class BaseProtoLogImpl { try { long offset = (System.currentTimeMillis() - (SystemClock.elapsedRealtimeNanos() / 1000000)); ProtoOutputStream proto = new ProtoOutputStream(); ProtoOutputStream proto = new ProtoOutputStream(mPerChunkSize); proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE); proto.write(VERSION, PROTOLOG_VERSION); proto.write(REAL_TIME_TO_ELAPSED_TIME_OFFSET_MILLIS, offset); Loading core/java/com/android/internal/protolog/ProtoLogImpl.java +8 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ public class ProtoLogImpl extends BaseProtoLogImpl { private static final int BUFFER_CAPACITY = 1024 * 1024; private static final String LOG_FILENAME = "/data/misc/wmtrace/wm_log.winscope"; private static final String VIEWER_CONFIG_FILENAME = "/system/etc/protolog.conf.json.gz"; private static final int PER_CHUNK_SIZE = 1024; private static ProtoLogImpl sServiceInstance = null; Loading Loading @@ -94,7 +95,10 @@ public class ProtoLogImpl extends BaseProtoLogImpl { public static synchronized ProtoLogImpl getSingleInstance() { if (sServiceInstance == null) { sServiceInstance = new ProtoLogImpl( new File(LOG_FILENAME), BUFFER_CAPACITY, new ProtoLogViewerConfigReader()); new File(LOG_FILENAME) , BUFFER_CAPACITY , new ProtoLogViewerConfigReader() , PER_CHUNK_SIZE); } return sServiceInstance; } Loading @@ -105,8 +109,8 @@ public class ProtoLogImpl extends BaseProtoLogImpl { } public ProtoLogImpl(File logFile, int bufferCapacity, ProtoLogViewerConfigReader viewConfigReader) { super(logFile, VIEWER_CONFIG_FILENAME, bufferCapacity, viewConfigReader); ProtoLogViewerConfigReader viewConfigReader, int perChunkSize) { super(logFile, VIEWER_CONFIG_FILENAME, bufferCapacity, viewConfigReader, perChunkSize); } } tests/Internal/src/com/android/internal/protolog/ProtoLogImplTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class ProtoLogImplTest { mFile = testContext.getFileStreamPath("tracing_test.dat"); //noinspection ResultOfMethodCallIgnored mFile.delete(); mProtoLog = new ProtoLogImpl(mFile, 1024 * 1024, mReader); mProtoLog = new ProtoLogImpl(mFile, 1024 * 1024, mReader, 1024); } @After Loading Loading
core/java/com/android/internal/protolog/BaseProtoLogImpl.java +10 −2 Original line number Diff line number Diff line Loading @@ -72,11 +72,13 @@ public class BaseProtoLogImpl { private static final String TAG = "ProtoLog"; private static final long MAGIC_NUMBER_VALUE = ((long) MAGIC_NUMBER_H << 32) | MAGIC_NUMBER_L; static final String PROTOLOG_VERSION = "1.0.0"; private static final int DEFAULT_PER_CHUNK_SIZE = 0; private final File mLogFile; private final String mViewerConfigFilename; private final TraceBuffer mBuffer; protected final ProtoLogViewerConfigReader mViewerConfig; private final int mPerChunkSize; private boolean mProtoLogEnabled; private boolean mProtoLogEnabledLockFree; Loading Loading @@ -156,7 +158,7 @@ public class BaseProtoLogImpl { return; } try { ProtoOutputStream os = new ProtoOutputStream(); ProtoOutputStream os = new ProtoOutputStream(mPerChunkSize); long token = os.start(LOG); os.write(MESSAGE_HASH, messageHash); os.write(ELAPSED_REALTIME_NANOS, SystemClock.elapsedRealtimeNanos()); Loading Loading @@ -215,10 +217,16 @@ public class BaseProtoLogImpl { public BaseProtoLogImpl(File file, String viewerConfigFilename, int bufferCapacity, ProtoLogViewerConfigReader viewerConfig) { this(file, viewerConfigFilename, bufferCapacity, viewerConfig, DEFAULT_PER_CHUNK_SIZE); } public BaseProtoLogImpl(File file, String viewerConfigFilename, int bufferCapacity, ProtoLogViewerConfigReader viewerConfig, int perChunkSize) { mLogFile = file; mBuffer = new TraceBuffer(bufferCapacity); mViewerConfigFilename = viewerConfigFilename; mViewerConfig = viewerConfig; mPerChunkSize = perChunkSize; } /** Loading Loading @@ -364,7 +372,7 @@ public class BaseProtoLogImpl { try { long offset = (System.currentTimeMillis() - (SystemClock.elapsedRealtimeNanos() / 1000000)); ProtoOutputStream proto = new ProtoOutputStream(); ProtoOutputStream proto = new ProtoOutputStream(mPerChunkSize); proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE); proto.write(VERSION, PROTOLOG_VERSION); proto.write(REAL_TIME_TO_ELAPSED_TIME_OFFSET_MILLIS, offset); Loading
core/java/com/android/internal/protolog/ProtoLogImpl.java +8 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ public class ProtoLogImpl extends BaseProtoLogImpl { private static final int BUFFER_CAPACITY = 1024 * 1024; private static final String LOG_FILENAME = "/data/misc/wmtrace/wm_log.winscope"; private static final String VIEWER_CONFIG_FILENAME = "/system/etc/protolog.conf.json.gz"; private static final int PER_CHUNK_SIZE = 1024; private static ProtoLogImpl sServiceInstance = null; Loading Loading @@ -94,7 +95,10 @@ public class ProtoLogImpl extends BaseProtoLogImpl { public static synchronized ProtoLogImpl getSingleInstance() { if (sServiceInstance == null) { sServiceInstance = new ProtoLogImpl( new File(LOG_FILENAME), BUFFER_CAPACITY, new ProtoLogViewerConfigReader()); new File(LOG_FILENAME) , BUFFER_CAPACITY , new ProtoLogViewerConfigReader() , PER_CHUNK_SIZE); } return sServiceInstance; } Loading @@ -105,8 +109,8 @@ public class ProtoLogImpl extends BaseProtoLogImpl { } public ProtoLogImpl(File logFile, int bufferCapacity, ProtoLogViewerConfigReader viewConfigReader) { super(logFile, VIEWER_CONFIG_FILENAME, bufferCapacity, viewConfigReader); ProtoLogViewerConfigReader viewConfigReader, int perChunkSize) { super(logFile, VIEWER_CONFIG_FILENAME, bufferCapacity, viewConfigReader, perChunkSize); } }
tests/Internal/src/com/android/internal/protolog/ProtoLogImplTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class ProtoLogImplTest { mFile = testContext.getFileStreamPath("tracing_test.dat"); //noinspection ResultOfMethodCallIgnored mFile.delete(); mProtoLog = new ProtoLogImpl(mFile, 1024 * 1024, mReader); mProtoLog = new ProtoLogImpl(mFile, 1024 * 1024, mReader, 1024); } @After Loading