summaryrefslogtreecommitdiff
path: root/impls/monero.dart/lib
diff options
context:
space:
mode:
Diffstat (limited to 'impls/monero.dart/lib')
-rw-r--r--impls/monero.dart/lib/monero.dart18
-rw-r--r--impls/monero.dart/lib/wownero.dart18
2 files changed, 36 insertions, 0 deletions
diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart
index 997f1b6..ab4210e 100644
--- a/impls/monero.dart/lib/monero.dart
+++ b/impls/monero.dart/lib/monero.dart
@@ -105,8 +105,26 @@ void Function(String call)? debugStart = (call) {
debugCallLength[call] ??= <int>[];
debugCallLength[call]!.add(sw.elapsedMicroseconds);
};
+void debugChores() {
+ for (var key in debugCallLength.keys) {
+ if (debugCallLength[key]!.length > 1000000) {
+ final elm =
+ debugCallLength[key]!.reduce((value, element) => value + element);
+ debugCallLength[key]!.clear();
+ debugCallLength["${key}_1M"] ??= <int>[];
+ debugCallLength["${key}_1M"]!.add(elm);
+ }
+ }
+}
+
+int debugCount = 0;
+
void Function(String call)? debugEnd = (call) {
final id = debugCallLength[call]!.length - 1;
+ if (++debugCount > 1000000) {
+ debugCount = 0;
+ debugChores();
+ }
debugCallLength[call]![id] =
sw.elapsedMicroseconds - debugCallLength[call]![id];
};
diff --git a/impls/monero.dart/lib/wownero.dart b/impls/monero.dart/lib/wownero.dart
index e87488c..9e2cb3b 100644
--- a/impls/monero.dart/lib/wownero.dart
+++ b/impls/monero.dart/lib/wownero.dart
@@ -105,8 +105,26 @@ void Function(String call)? debugStart = (call) {
debugCallLength[call] ??= <int>[];
debugCallLength[call]!.add(sw.elapsedMicroseconds);
};
+void debugChores() {
+ for (var key in debugCallLength.keys) {
+ if (debugCallLength[key]!.length > 1000000) {
+ final elm =
+ debugCallLength[key]!.reduce((value, element) => value + element);
+ debugCallLength[key]!.clear();
+ debugCallLength["${key}_1M"] ??= <int>[];
+ debugCallLength["${key}_1M"]!.add(elm);
+ }
+ }
+}
+
+int debugCount = 0;
+
void Function(String call)? debugEnd = (call) {
final id = debugCallLength[call]!.length - 1;
+ if (++debugCount > 1000000) {
+ debugCount = 0;
+ debugChores();
+ }
debugCallLength[call]![id] =
sw.elapsedMicroseconds - debugCallLength[call]![id];
};