From ae8f977d6b8232848d15921d5ee6a3ccd12ad7e6 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Wed, 13 Jul 2022 13:55:22 +0200
Subject: [PATCH] Log the end of the migration and it's duration

---
 .../android/sdk/internal/util/database/RealmMigrator.kt     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt
index 8da1bed97e..1992d3b918 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt
@@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.util.database
 import io.realm.DynamicRealm
 import io.realm.RealmObjectSchema
 import timber.log.Timber
+import kotlin.system.measureTimeMillis
 
 internal abstract class RealmMigrator(
         private val realm: DynamicRealm,
@@ -26,7 +27,10 @@ internal abstract class RealmMigrator(
 ) {
     fun perform() {
         Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion")
-        doMigrate(realm)
+        val duration = measureTimeMillis {
+            doMigrate(realm)
+        }
+        Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion took $duration ms.")
     }
 
     abstract fun doMigrate(realm: DynamicRealm)