Update Stopwatch to log fractional milliseconds.

This commit is contained in:
Greyson Parrelli
2023-08-30 16:14:03 -04:00
committed by Nicholas Tinsley
parent 95c6f569d6
commit e08e02ae80
7 changed files with 82 additions and 79 deletions

View File

@@ -94,7 +94,7 @@ class ConversationDataSource(
}
override fun load(start: Int, length: Int, totalSize: Int, cancellationSignal: PagedDataSource.CancellationSignal): List<ConversationElement> {
val stopwatch = Stopwatch("load($start, $length), thread $threadId")
val stopwatch = Stopwatch(title = "load($start, $length), thread $threadId", decimalPlaces = 2)
var records: MutableList<MessageRecord> = ArrayList(length)
MessageTable.mmsReaderFor(SignalDatabase.messages.getConversation(threadId, start.toLong(), length.toLong()))
@@ -150,7 +150,7 @@ class ConversationDataSource(
}
stopwatch.split("header")
val log = stopwatch.stopAndGetLogString(TAG)
val log = stopwatch.stopAndGetLogString()
Log.d(TAG, "$log || ${extraData.timeLog}")
return if (threadHeaders.isNotEmpty()) messages + threadHeaders else messages
@@ -166,7 +166,7 @@ class ConversationDataSource(
return null
}
val stopwatch = Stopwatch("load($key), thread $threadId")
val stopwatch = Stopwatch(title = "load($key), thread $threadId", decimalPlaces = 2)
var record = SignalDatabase.messages.getMessageRecordOrNull(key.id)
if ((record as? MediaMmsMessageRecord)?.parentStoryId?.isGroupReply() == true) {
@@ -201,7 +201,7 @@ class ConversationDataSource(
).toMappingModel()
}
} finally {
val log = stopwatch.stopAndGetLogString(TAG)
val log = stopwatch.stopAndGetLogString()
Log.d(TAG, "$log || ${extraData?.timeLog}")
}
}

View File

@@ -119,7 +119,7 @@ object MessageDataFetcher {
attachments = attachmentsResult.result,
payments = paymentsResult.result,
calls = callsResult.result,
timeLog = "mentions: ${mentionsResult.duration} is-quoted: ${hasBeenQuotedResult.duration} reactions: ${reactionsResult.duration} attachments: ${attachmentsResult.duration} payments: ${paymentsResult.duration} calls: ${callsResult.duration} >> cpuTime: ${cpuTimeMs.roundedString(2)} wallTime: ${wallTimeMs.roundedString(2)}"
timeLog = "mentions: ${mentionsResult.duration}, is-quoted: ${hasBeenQuotedResult.duration}, reactions: ${reactionsResult.duration}, attachments: ${attachmentsResult.duration}, payments: ${paymentsResult.duration}, calls: ${callsResult.duration} >> cpuTime: ${cpuTimeMs.roundedString(2)}, wallTime: ${wallTimeMs.roundedString(2)}"
)
}

View File

@@ -68,7 +68,7 @@ abstract class ConversationListDataSource implements PagedDataSource<Long, Conve
@Override
public @NonNull List<Conversation> load(int start, int length, int totalSize, @NonNull CancellationSignal cancellationSignal) {
SignalTrace.beginSection("ConversationListDataSource#load");
Stopwatch stopwatch = new Stopwatch("load(" + start + ", " + length + "), " + getClass().getSimpleName() + ", " + conversationFilter);
Stopwatch stopwatch = new Stopwatch("load(" + start + ", " + length + "), " + getClass().getSimpleName() + ", " + conversationFilter, 2);
List<Conversation> conversations = new ArrayList<>(length);
List<Recipient> recipients = new LinkedList<>();