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

@@ -1,35 +1,19 @@
namespace BCG {
using BCG.Utilities.General;
using bts.api;
using bts.api.domain;
using bts.api.synthetic;
using bts.md;
using bts.spark;
using bts.utils;
using mbts;
using mbts.co2;
using mbts.config;
using mbts.spark;
using mbts.ui;
using Spark.Core.Data;
using Spark.Core.Disposables;
using Spark.Core.Reactive;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using bts.api.core;
using Spark.Api.MarketData;
using SecurityKey = System.UInt32;
using System.Data;
using System.Reflection.Metadata;
using System.Diagnostics;
[DataStreamUserRespresentation("books")]
public class BookStream : ViewStream, IWorker {
@@ -39,7 +23,7 @@ namespace BCG {
private int _id = 0;
IReadOnlyDictionary<SecurityKey, BookTuple> _cached_state = null;
MarketDataClient _md_client;
HighPerformanceTimer _timer = new HighPerformanceTimer();
readonly Stopwatch _timer = new();
private readonly IBlueTableSchema _bbo_schema = BlueDataUtility.form_schema("books",
Tuple.Create("id", TypeCode.Int32),
Tuple.Create("sec_key", TypeCode.UInt32),
@@ -106,7 +90,7 @@ namespace BCG {
private void _scan_bbo() {
// this shouldn be made incremental using the TableUpdate
bts.Log.Gen.info("BookStream._scan_bbo");
_timer.start();
_timer.Restart();
if (_cached_state == null)
return;
BlueTable new_state = new BlueTable(_bbo_schema);
@@ -131,8 +115,8 @@ namespace BCG {
}
if (dp.addedRows.Count == 0 && dp.deletedRows.Count == 0)
return;
_timer.stop();
bts.Log.Gen.info($"BookStream._scan_bbo time: {_timer.lastIntervalTime} msecs");
_timer.Stop();
bts.Log.Gen.info($"BookStream._scan_bbo time: {_timer.Elapsed} msecs");
myFireEvent(dp);
}
@@ -143,4 +127,4 @@ namespace BCG {
}
}
}
}
}