refactor: Replace HighPerformanceTimer w/ Stopwatch

This is needed to build DataStreamSuite on Linux.

'Stopwatch' is a platform independent timer class included with the
System.Runtime library in modern dotnet. 'HighPerformanceTimer' is a BTS
class that predates Stopwatch, and is NOT platform independent as it
relies on Windows kernel32.dll QueryPerformanceCounter/Frequency fns.
This commit is contained in:
John Colvin committed 2024-06-03 13:46:51 +00:00
1 parent 7ee6933789
commit 9050318ceb
18 files changed
+110 -184

No files matched your search

@@ -300,10 +300,10 @@ namespace BCG {
return Math.Max(header_width, min_width);
}
}
private HighPerformanceTimer _timer = new HighPerformanceTimer();
// this is the stream callback
private void myCallback(object o) {
_timer.start();
var timer = Stopwatch.StartNew();
DataPacket dp = o as DataPacket;
myCrono.stop();
Log.Ui.diag($"Received callback for {dp.schema.tableName}");
@@ -342,9 +342,9 @@ namespace BCG {
myConsoleRichTextBox.Clear();
// this was was very very slow
//myConsoleRichTextBox.Text = BlueDataUtility.get_printed_rows(dp.newRows, (col) => 30);
_timer.stop();
var msecs = _timer.lastIntervalTime;
bts.Log.Gen.info($"DSQA MainForm.myCallback table: {dp.schema.tableName} rows: {dp.newRows.Count} time: {msecs}");
timer.Stop();
Log.Gen.info(
$"DSQA MainForm.myCallback table: {dp.schema.tableName} rows: {dp.newRows.Count} time: {timer.Elapsed.TotalMilliseconds:0.00}ms");
}
private Crono myCrono;
@@ -646,7 +646,7 @@ namespace BCG {
}
private void testGridToolStripMenuItem_Click(object sender, EventArgs e) {
HighPerformanceTimer timer = new HighPerformanceTimer();
var timer = new Stopwatch();
//while (true)
//{
// Random rnd = new Random(DateTime.Now.Millisecond);
@@ -668,12 +668,12 @@ namespace BCG {
rows.Add(r);
for (int i = 0; i < 100; i++) {
timer.start();
timer.Restart();
rows.Sort(delegate (IBlueRow r1, IBlueRow r2) {
return _sort_dicts_index(r1, r2, 5, true);
});
timer.stop();
Log.Ui.diag($"nrows = {rows.Count} sorting time = {timer.lastIntervalTime}");
timer.Stop();
Log.Ui.diag($"nrows = {rows.Count} sorting time = {timer.Elapsed.TotalMilliseconds:0.00}ms");
}
}