Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add helper method to track time taken

Neeraj Gupta9eb93f616ae7
diff --git a/pkg/remote_to_disk_file.go b/pkg/remote_to_disk_file.go
index c7e5e6e7e6..a5e77e6fba 100644
--- a/pkg/remote_to_disk_file.go
+++ b/pkg/remote_to_disk_file.go
@@ -4,6 +4,7 @@ import (
"cli-go/pkg/mapper"
"cli-go/pkg/model"
"cli-go/pkg/model/export"
+ "cli-go/utils"
"context"
"encoding/json"
"fmt"
@@ -11,6 +12,7 @@ import (
"os"
"path/filepath"
"strings"
+ "time"
)
func (c *ClICtrl) syncFiles(ctx context.Context) error {
@@ -29,6 +31,7 @@ func (c *ClICtrl) syncFiles(ctx context.Context) error {
}
log.Println("total entries", len(entries))
model.SortAlbumFileEntry(entries)
+ defer utils.TimeTrack(time.Now(), "process_files")
for i, entry := range entries {
if entry.SyncedLocally {
continue
diff --git a/utils/time.go b/utils/time.go
new file mode 100644
index 0000000000..fcb61f8422
--- /dev/null
+++ b/utils/time.go
@@ -0,0 +1,11 @@
+package utils
+
+import (
+ "log"
+ "time"
+)
+
+func TimeTrack(start time.Time, name string) {
+ elapsed := time.Since(start)
+ log.Printf("%s took %s", name, elapsed)
+}