mirror of
https://github.com/syncthing/syncthing.git
synced 2025-12-23 22:18:14 -05:00
chore(db): benchmark output, migration blocks/s output (#10320)
Just minor tweaks
This commit is contained in:
@@ -31,10 +31,16 @@ func BenchmarkUpdate(b *testing.B) {
|
||||
})
|
||||
|
||||
fs := make([]protocol.FileInfo, 100)
|
||||
t0 := time.Now()
|
||||
|
||||
seed := 0
|
||||
size := 1000
|
||||
const numBlocks = 1000
|
||||
const numBlocks = 500
|
||||
|
||||
fdb, err := db.getFolderDB(folderID, true)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
for size < 200_000 {
|
||||
for {
|
||||
@@ -54,6 +60,17 @@ func BenchmarkUpdate(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
var files, blocks int
|
||||
if err := fdb.sql.QueryRowx(`SELECT count(*) FROM files`).Scan(&files); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
if err := fdb.sql.QueryRowx(`SELECT count(*) FROM blocks`).Scan(&blocks); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
d := time.Since(t0)
|
||||
b.Logf("t=%s, files=%d, blocks=%d, files/s=%.01f, blocks/s=%.01f", d, files, blocks, float64(files)/d.Seconds(), float64(blocks)/d.Seconds())
|
||||
|
||||
b.Run(fmt.Sprintf("n=Insert100Loc/size=%d", size), func(b *testing.B) {
|
||||
for range b.N {
|
||||
for i := range fs {
|
||||
|
||||
@@ -236,7 +236,7 @@ func TryMigrateDatabase(ctx context.Context, deleteRetention time.Duration, apiA
|
||||
if time.Since(t1) > 10*time.Second {
|
||||
d := time.Since(t0) + 1
|
||||
t1 = time.Now()
|
||||
slog.Info("Still migrating folder", "folder", folder, "files", files, "blocks", blocks, "duration", d.Truncate(time.Second), "filesrate", float64(files)/d.Seconds())
|
||||
slog.Info("Still migrating folder", "folder", folder, "files", files, "blocks", blocks, "duration", d.Truncate(time.Second), "blocksrate", float64(blocks)/d.Seconds(), "filesrate", float64(files)/d.Seconds())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user