mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add a system for locally tracking performance on-device.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package org.thoughtcrime.securesms.logsubmit;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.database.LocalMetricsDatabase;
|
||||
import org.thoughtcrime.securesms.database.LocalMetricsDatabase.EventMetrics;
|
||||
import org.thoughtcrime.securesms.database.LocalMetricsDatabase.SplitMetrics;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
final class LogSectionLocalMetrics implements LogSection {
|
||||
@Override
|
||||
public @NonNull String getTitle() {
|
||||
return "LOCAL METRICS";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull CharSequence getContent(@NonNull Context context) {
|
||||
List<EventMetrics> metrics = LocalMetricsDatabase.getInstance(ApplicationDependencies.getApplication()).getMetrics();
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (EventMetrics metric : metrics) {
|
||||
builder.append(metric.getName()).append('\n')
|
||||
.append(" ").append("count: ").append(metric.getCount()).append('\n')
|
||||
.append(" ").append("p50: ").append(metric.getP50()).append('\n')
|
||||
.append(" ").append("p90: ").append(metric.getP90()).append('\n')
|
||||
.append(" ").append("p99: ").append(metric.getP99()).append('\n');
|
||||
|
||||
for (SplitMetrics split : metric.getSplits()) {
|
||||
builder.append(" ").append(split.getName()).append('\n')
|
||||
.append(" ").append("p50: ").append(split.getP50()).append('\n')
|
||||
.append(" ").append("p90: ").append(split.getP90()).append('\n')
|
||||
.append(" ").append("p99: ").append(split.getP99()).append('\n');
|
||||
}
|
||||
builder.append("\n\n");
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -73,12 +73,13 @@ public class SubmitDebugLogRepository {
|
||||
add(new LogSectionSystemInfo());
|
||||
add(new LogSectionJobs());
|
||||
add(new LogSectionConstraints());
|
||||
add(new LogSectionCapabilities());
|
||||
add(new LogSectionLocalMetrics());
|
||||
add(new LogSectionFeatureFlags());
|
||||
add(new LogSectionPin());
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
add(new LogSectionPower());
|
||||
}
|
||||
add(new LogSectionPin());
|
||||
add(new LogSectionCapabilities());
|
||||
add(new LogSectionFeatureFlags());
|
||||
add(new LogSectionNotifications());
|
||||
add(new LogSectionKeyPreferences());
|
||||
add(new LogSectionPermissions());
|
||||
|
||||
Reference in New Issue
Block a user