Log classifier size

pull/211/head
M66B 2 years ago
parent bba4e62b8c
commit f34dd3dfda

@ -521,6 +521,7 @@ public class Log {
event.addMetadata("extra", "memory_available", getAvailableMb()); event.addMetadata("extra", "memory_available", getAvailableMb());
event.addMetadata("extra", "native_allocated", Debug.getNativeHeapAllocatedSize() / 1024L / 1024L); event.addMetadata("extra", "native_allocated", Debug.getNativeHeapAllocatedSize() / 1024L / 1024L);
event.addMetadata("extra", "native_size", Debug.getNativeHeapSize() / 1024L / 1024L); event.addMetadata("extra", "native_size", Debug.getNativeHeapSize() / 1024L / 1024L);
event.addMetadata("extra", "classifier_size", MessageClassifier.getSize(context));
Boolean ignoringOptimizations = Helper.isIgnoringOptimizations(context); Boolean ignoringOptimizations = Helper.isIgnoringOptimizations(context);
event.addMetadata("extra", "optimizing", (ignoringOptimizations != null && !ignoringOptimizations)); event.addMetadata("extra", "optimizing", (ignoringOptimizations != null && !ignoringOptimizations));

@ -758,6 +758,11 @@ public class MessageClassifier {
backup ? "classifier.backup" : "classifier.json"); backup ? "classifier.backup" : "classifier.json");
} }
static long getSize(Context context) {
File file = getFile(context, false);
return (file.exists() ? file.length() : -1L);
}
private static class State { private static class State {
private final List<String> words = new ArrayList<>(); private final List<String> words = new ArrayList<>();
private final Map<String, Stat> classStats = new HashMap<>(); private final Map<String, Stat> classStats = new HashMap<>();

Loading…
Cancel
Save