Skip to content

Commit a5e3dc5

Browse files
committed
Better stats and results
1 parent 608b2e3 commit a5e3dc5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/LightningDB.Tryout/Program.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ private static void DoTestImpl(LightningEnvironment env, bool useRandomKeys = fa
6363
}
6464
}
6565
tx.Commit();
66+
var stats = tx.GetStats(db);
67+
Console.WriteLine("Stats\n # Entries: {0:N0}\n Depth: {1}\n Page Size: {2}",
68+
stats.ms_entries.ToInt64(), stats.ms_depth, stats.ms_psize);
69+
Console.WriteLine(" Branch Pages: {0:N0}\n Leaf Pages: {1}\n Overflow Pages: {2}",
70+
stats.ms_branch_pages.ToInt64(), stats.ms_leaf_pages.ToInt64(), stats.ms_overflow_pages.ToInt64());
6671
}
6772
writeTimer.Stop();
68-
Console.WriteLine("Took {0,10:N2} ms ({1}) to WRITE {2:N0} values ({3,8:N2} WRITES/msec)",
73+
Console.WriteLine("Took {0,10:N2} ms ({1}) to WRITE {2:N0} values ({3,10:N0} WRITES/sec)",
6974
writeTimer.Elapsed.TotalMilliseconds, writeTimer.Elapsed, numItemsToWrite,
70-
numItemsToWrite / writeTimer.Elapsed.TotalMilliseconds);
75+
numItemsToWrite / writeTimer.Elapsed.TotalMilliseconds * 1000.0);
7176

7277
var readTimer = Stopwatch.StartNew();
7378
var readCounter = 0;
@@ -85,9 +90,9 @@ private static void DoTestImpl(LightningEnvironment env, bool useRandomKeys = fa
8590
}
8691
}
8792
readTimer.Stop();
88-
Console.WriteLine("Took {0,10:N2} ms ({1}) to READ {2:N0} values ({3,8:N2} READS/msec)",
93+
Console.WriteLine("Took {0,10:N2} ms ({1}) to READ {2:N0} values ({3,10:N0} READS/sec)",
8994
readTimer.Elapsed.TotalMilliseconds, readTimer.Elapsed, readCounter,
90-
readCounter / readTimer.Elapsed.TotalMilliseconds);
95+
readCounter / readTimer.Elapsed.TotalMilliseconds * 1000.0);
9196
Console.WriteLine();
9297
}
9398

@@ -98,6 +103,7 @@ private static string CreateNewDirectoryForTest()
98103
//var path = Path.Combine(Directory.GetParent(testProjectDir).Parent.FullName, "TestDb", guid);
99104
var path = Path.Combine(testProjectDir, "TestDb", guid);
100105
//Console.WriteLine("Creating folder: {0}\n{1}", guid, path);
106+
Console.WriteLine("Creating folder: {0}", guid);
101107
Directory.CreateDirectory(path);
102108
return path;
103109
}

0 commit comments

Comments
 (0)