Skip to content

Commit d613cab

Browse files
Merge pull request #148 from backtrace-labs/feature/log-db-loading-time
Debug log db reports loading time and reports counter
2 parents a0b0863 + 132dc52 commit d613cab

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

backtrace-library/src/main/java/backtraceio/library/BacktraceDatabase.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public void start() {
258258
return;
259259
}
260260

261-
this.loadReports(); // load reports from internal storage
261+
this.loadReports();
262262

263263
this.removeOrphaned();
264264

@@ -437,6 +437,17 @@ public int count() {
437437
}
438438

439439
private void loadReports() {
440+
final long startLoadingReportsTime = System.currentTimeMillis();
441+
442+
this.loadReportsToDbContext();
443+
444+
final long endLoadingReportsTime = System.currentTimeMillis();
445+
446+
BacktraceLogger.d(LOG_TAG, "Loading " + backtraceDatabaseContext.count() +
447+
" reports took " + (endLoadingReportsTime - startLoadingReportsTime) + " milliseconds");
448+
}
449+
450+
private void loadReportsToDbContext() {
440451
Iterable<File> files = backtraceDatabaseFileContext.getRecords();
441452

442453
for (File file : files) {
@@ -453,6 +464,7 @@ private void loadReports() {
453464
validateDatabaseSize();
454465
record.close();
455466
}
467+
456468
}
457469

458470
/**

0 commit comments

Comments
 (0)