fix build: Remove references to HighPerformanceTimer

An old custom timer class from Edge that we no longer need. We're
replacing it w/ a dotnet builtin timer class called 'Stopwatch'.
This commit is contained in:
John Colvin committed 2024-06-06 09:15:15 -05:00
1 parent c425145fc9
commit 8d22e91c0d
21 files changed
+126 -123

No files matched your search

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -23,7 +24,6 @@ namespace mbts.spark {
private readonly ITag<VolSurfaceStandardTime> _in_vs_standard_time_tag;
private readonly ITag<VolSurfaceOutput> _out_bb_computed_vol_tag;
private readonly ThreadedBlackboard _bb;
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private readonly PerfStatsLogger _logger = new PerfStatsLogger(50, 100);
private readonly string _log_id;
@@ -55,18 +55,18 @@ namespace mbts.spark {
VolSurfaceNonVolData vs_nonvol_data = _bb.read_state(_in_bb_nonvol_data_tag);
VolSurfaceStandardTime vs_standard_time = _bb.read_state(_in_vs_standard_time_tag);
if (vs_input != null && vs_nonvol_data != null && vs_standard_time != null) {
_timer.start();
var timer = Stopwatch.StartNew();
IDictionary<VolSurfaceExpiration, VolSurfaceExpirationAuxiliaryData> aux_data_map =
VolSurfaceUtilityFunctions.compute_aux_data(vs_input,
vs_nonvol_data.input, vs_nonvol_data.driver_price_map, vs_standard_time);
VolSurfaceOutput vs_output = GeneralVolSurfaceCalculator.compute(
vs_input, vs_nonvol_data.contracts, aux_data_map);
_timer.stop();
timer.Stop();
var tag_str = tag == null ? "Null" : tag.ToString();
// bts.Log.Gen.info($"SingleVolSurfaceCommittedOutputRetriever._recompute_and_publish " +
// $"vs_id: {_vs_id} time:{_timer.lastIntervalTime} ms tag:{tag_str} " +
// $"tid:{_tid()}"); //output: {vs_output.log_string()}*/");
_logger.log(_log_id, _log_id, _timer.lastIntervalTime);
_logger.log(_log_id, _log_id, timer.Elapsed.TotalMilliseconds);
_bb.post(_out_bb_computed_vol_tag, vs_output);
}
}
@@ -75,4 +75,4 @@ namespace mbts.spark {
public void Dispose() { _bb.data_callback -= _on_bb_data; }
#endregion
}
}
}
@@ -11,6 +11,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
@@ -25,7 +26,6 @@
private readonly ThreadedBlackboard _bb;
private readonly ITag<VolSurfaceInput> _in_bb_committ_tag;
private readonly AnalyticsService _analytics_service;
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private readonly List<IDisposable> _disposables = new List<IDisposable>();
private IDictionary<UInt64, VolSurfaceInputSnapshot> _snp_shot_map = new
Dictionary<UInt64, VolSurfaceInputSnapshot>();
@@ -93,7 +93,7 @@
private void _on_bb_data(object tag, object data) {
if (_in_bb_committ_tag.Equals(tag)) {
try {
_timer.start();
var timer = Stopwatch.StartNew();
VolSurfaceInput vs_input = data as VolSurfaceInput;
var user_tup = _bb.read_state(SparkTags.CurrentUser);
string current_user = user_tup.name;
@@ -107,17 +107,17 @@
_sanitize_input(ref vs_input);
vs_input = VolSurfaceDataFunctions.unset_driver_overrides(vs_input);
VolSurfaceUtilityFunctions.save_volsurface(vs_input, _analytics_service, current_user);
_timer.stop();
timer.Stop();
Log.Gen.info(String.Format(
"SingleVolSurfaceGateway._on_bb_data Time to commit volsurface {0} {1} msecs",
_volsurface_id, _timer.lastIntervalTime));
_volsurface_id, timer.Elapsed.TotalMilliseconds));
var archived_theos = _get_theos();
if (archived_theos != null) {
_timer.start();
timer.Restart();
_analytics_service.archive_theos(archived_theos);
_timer.stop();
timer.Stop();
Log.Gen.info($"SingleVolSurfaceGateway._on_bb_data archiving theos vs_id: {_volsurface_id} size: " +
$"{archived_theos.SecTheo.Count} time: {_timer.lastIntervalTime} msecs");
$"{archived_theos.SecTheo.Count} time: {timer.Elapsed.TotalMilliseconds} msecs");
}
} catch (Exception ex) {
Log.Gen.warn(ex.ToString());
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Collections;
@@ -64,7 +65,6 @@
private readonly ITag<bool> _in_bb_ignore_market_implied_vol_source_settings_tag;
private CachedExpMD _cached_exp_md = new CachedExpMD();
private readonly ThreadedBlackboard _bb;
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private readonly PerfStatsLogger _logger = new PerfStatsLogger(50, 50);
private TimeSpan _compute_period = TimeSpan.FromMilliseconds(333);
private bool _is_dirty = true;
@@ -137,7 +137,7 @@
symbol = sel_exp.Item1.symbol,
expiration = sel_exp.Item1.expiration
};
_timer.start();
var timer = Stopwatch.StartNew();
VolSurfaceExpiration md_exp;
VolCurveMarketImpliedVolData exp_impl_vol_map =
VolSurfaceCoreFunctions.compute_implied_vols(
@@ -147,10 +147,11 @@
impliedvol_side,
_ignore_market_implied_vol_source_settings(_bb, _vs_id),
out md_exp);
_timer.stop();
_logger.log("SingleVolSurfaceMarketImpliedVolSource",
"SingleVolSurfaceMarketImpliedVolSource",
_timer.lastIntervalTime);
timer.Stop();
_logger.log(
"SingleVolSurfaceMarketImpliedVolSource",
"SingleVolSurfaceMarketImpliedVolSource",
timer.Elapsed.TotalMilliseconds);
if (exp_impl_vol_map is null) {
return;
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -32,7 +33,6 @@ namespace mbts.spark {
private readonly ITag<VolSurfaceStandardTime> _in_bb_vs_standard_time_tag;
private readonly ITag<VolSurfaceEnums.MarketSide> _in_bb_market_impliedvol_side_tag;
private readonly ITag<bool> _in_bb_dirty_tag;
private HighPerformanceTimer _timer = new HighPerformanceTimer();
/// data
private VolSurfaceOutput _last_output;
@@ -83,7 +83,7 @@ namespace mbts.spark {
VolSurfaceNonVolData nonvol_data = _bb.read_state(_in_bb_nonvol_data_tag);
VolSurfaceStandardTime vs_standard_time = _bb.read_state(_in_bb_vs_standard_time_tag);
if (is_dirty && nonvol_data != null) {
_timer.start();
var timer = Stopwatch.StartNew();
VolSurfaceCalculationRequest curr_req = _bb.read_state(_in_bb_request_tag),
effective_req = null;
if (is_new_request)
@@ -108,9 +108,9 @@ namespace mbts.spark {
null,
effective_req.cascade_up,
effective_req.cascade_down);
_timer.stop();
timer.Stop();
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator._recompute_and_publish vs_id: {_vs_id} " +
$"time: {_timer.lastIntervalTime}");
$"time: {timer.Elapsed.TotalMilliseconds}");
_bb.post(SparkTags.VolSurfaceCalculationResponseTag(_vs_id),
new VolSurfaceCalculationResponse(_last_output, effective_req.request_id));
}
@@ -127,7 +127,7 @@ namespace mbts.spark {
if (is_dirty || nonvol_data == null || vs_standard_time == null || auto_req == null) {
return;
}
_timer.start();
var timer = Stopwatch.StartNew();
IDictionary<VolSurfaceExpiration, VolSurfaceExpirationAuxiliaryData> aux_data_map =
VolSurfaceUtilityFunctions.compute_aux_data(auto_req.volsurface_input,
nonvol_data.input,
@@ -142,9 +142,9 @@ namespace mbts.spark {
null,
auto_req.cascade_up,
auto_req.cascade_down);
_timer.stop();
timer.Stop();
bts.Log.Gen.info($"SingleVolSurfaceRequestCalculator._serve_auto_request vs_id: {_vs_id} " +
$"time: {_timer.lastIntervalTime}");
$"time: {timer.Elapsed.TotalMilliseconds}");
_bb.post(SparkTags.VolSurfaceAutoCalculationResponseTag(_vs_id),
new VolSurfaceCalculationResponse(vs_output, auto_req.request_id));
}
@@ -219,4 +219,4 @@ namespace mbts.spark {
}
#endregion
}
}
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -27,7 +28,6 @@ namespace mbts.spark {
private readonly ITag<VolSurfaceCalculationResponse> _in_candidate_vol_output_tag;
private readonly ITag<bool> _in_input_dirty_tag;
private readonly ITag<bool> _in_window_state_tag;
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private bool _is_dirty = true;
private static readonly IDictionary<VolSurfaceExpiration, IEnumerable<Theos>>
_empty_theos = new Dictionary<VolSurfaceExpiration, IEnumerable<Theos>>();
@@ -113,23 +113,23 @@ namespace mbts.spark {
VolSurfaceOutput vs_output,
IDictionary<VolSurfaceExpiration, HashSet<double>> exp_strikes) {
if (vs_output != null) {
_timer.start();
var timer = Stopwatch.StartNew();
var exp_volmat_map = VolSurfaceVolMatrixCalculator.generate_volmatrix(
vs_output.volsurface_input,
exp_strikes.ToDictionary(kv => kv.Key,
kv => kv.Value as IEnumerable<double>),
vs_output.aux_data_map,
new double[] { 0.0 }, false, true, false, false, false);
_timer.stop();
timer.Stop();
_n_comps++;
Log.Gen.info($"SingleVolSurfaceTheoSource._compute_theos vs_id:{_vs_id} " +
$"vol time:{ _timer.lastIntervalTime} msecs n_comps: {_n_comps}");
_timer.start();
$"vol time:{ timer.Elapsed.TotalMilliseconds} msecs n_comps: {_n_comps}");
timer.Start();
var theo_map = VolSurfaceTheoCalculator.compute_standard_greeks(
vs_output.volsurface_input.surface_settings, exp_volmat_map, true);
_timer.stop();
timer.Stop();
Log.Gen.info($"SingleVolSurfaceTheoSource._compute_theos vs_id:{_vs_id} " +
$"theo time:{ _timer.lastIntervalTime} msecs n_comps: {_n_comps}");
$"theo time:{timer.Elapsed.TotalMilliseconds} msecs n_comps: {_n_comps}");
return theo_map;
}
return new Dictionary<VolSurfaceExpiration, IEnumerable<Theos>>();
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -82,7 +83,6 @@ namespace mbts.spark
new Queue<mbts.analytics.VolSurfaceSettings>();
private bts.api.IBus _bus;
private List<IDisposable> _subs = new List<IDisposable>();
private HighPerformanceTimer _timer = new HighPerformanceTimer();
public VolSurfaceBusManager(bts.api.IBus bus,
bts.api.analytics.AnalyticsService analytics_service,
@@ -188,8 +188,7 @@ namespace mbts.spark
return new Dictionary<uint, VolSurfaceTheoPoint>(0);
}
HighPerformanceTimer timer = new HighPerformanceTimer();
timer.start();
var timer = Stopwatch.StartNew();
Dictionary<uint, VolSurfaceTheoPoint> rv = new Dictionary<uint, VolSurfaceTheoPoint>();
foreach (var kv in theos)
{
@@ -220,9 +219,9 @@ namespace mbts.spark
}
}
}
timer.stop();
timer.Stop();
Log.Gen.info($"VolSurfaceBusManager keyed theos count: {rv.Count} " +
$"time: {timer.lastIntervalTime}");
$"time: {timer.Elapsed.TotalMilliseconds}");
return rv;
}
@@ -327,10 +326,10 @@ namespace mbts.spark
}
bts.Log.Ui.info($"VolSurfaceBusManager ArchivedTheoRetrieval id: {client_req.id} save_time: {ret.SaveTime} " +
$"sec_tup: {ret.SecTup.Venue}_{ret.SecTup.Type}_{ret.SecTup.Symbol}");
_timer.start();
var timer = Stopwatch.StartNew();
ArchivedTheoList arch_theos = _analytics_service.get_archived_theos(ret);
_timer.stop();
bts.Log.Ui.info($"VolSurfaceBusManager ArchivedTheoRetrieval time: {_timer.lastIntervalTime} " +
timer.Stop();
bts.Log.Ui.info($"VolSurfaceBusManager ArchivedTheoRetrieval time: {timer.Elapsed.TotalMilliseconds}ms " +
$"n_entries: {arch_theos.SecTheo.Count}");
_bb.post(SparkTags.ResponseArchivedVols, Tuple.Create(client_req, arch_theos));
}
@@ -366,9 +365,9 @@ namespace mbts.spark
}
bts.Log.Gen.info(String.Format("VSBusManager, successfully obtained new vs_id:{0}", reply.NewId));
vs_input.surface_settings.core_settings.vol_surface_id = reply.NewId;
_timer.start();
var timer = Stopwatch.StartNew();
ResultMessage res = VolSurfaceUtilityFunctions.save_volsurface(vs_input, _analytics_service);
_timer.stop();
timer.Stop();
if (!res.Success)
{
report_err(res.ErrorMessage);
@@ -376,7 +375,7 @@ namespace mbts.spark
}
Log.Gen.info(String.Format("VSBusManager, successfully created vol surface, vs_id:{0} ts:{1} msecs",
vs_input.surface_settings.core_settings.vol_surface_id,
_timer.lastIntervalTime.ToString()));
timer.Elapsed.TotalMilliseconds));
_bb.post(SparkTags.VolSurfaceActivationTag(reply.NewId), true, false);
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using mbts.analytics;
using bts.api;
using bts.collections;
@@ -14,7 +15,6 @@ namespace mbts.spark {
public class InterpTheosServerPublisher : IDisposable {
private readonly ThreadedBlackboard _bb;
private readonly bts.api.orderman.OrderService _order_service;
private HighPerformanceTimer _timer = new HighPerformanceTimer();
public InterpTheosServerPublisher(ThreadedBlackboard bb,
bts.api.orderman.OrderService order_service) {
@@ -87,7 +87,7 @@ namespace mbts.spark {
_bb.read_state(SparkTags.AllOptionDriverBBOTag, null);
if (sc_data == null || all_theos == null || all_drivers == null)
return;
_timer.start();
var timer = Stopwatch.StartNew();
all_theos = _filter_for_publish(all_theos);
if (all_theos.Count == 0) {
bts.Log.Gen.info($"InterpTheosServerPublisher._publish_data all_theos.Count == 0");
@@ -120,12 +120,12 @@ namespace mbts.spark {
}
bts.api.orderman.PrecomputedTheos server_theos = new PrecomputedTheos();
server_theos.Theos.AddRange(ptp_list);
_timer.stop();
var comp_time = _timer.lastIntervalTime;
_timer.start();
timer.Stop();
var comp_time = timer.Elapsed.TotalMilliseconds;
timer.Start();
_order_service.set_precomputed_theos(server_theos);
_timer.stop();
var pub_time = _timer.lastIntervalTime;
timer.Stop();
var pub_time = timer.Elapsed.TotalMilliseconds;
bts.Log.Gen.info($"InterpTheosServerPublisher._publish_data symbols: {all_theos.Count} " +
$"size: {server_theos.Theos.Count} comp_time: {comp_time} msecs " +
$"pub_time: {pub_time}");
+4 -4
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using mbts.analytics;
using bts.api;
using mbts.ui;
@@ -16,7 +17,6 @@ namespace mbts.spark {
_greeks_tag = SparkTags.AllInterpGreeks;
private readonly ITag<IReadOnlyDictionary<string, OptionDriverPriceMap>>
_drivers_tag = SparkTags.AllOptionDriverBBOTag;
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private readonly PerfStatsLogger _logger = new PerfStatsLogger(50, 100);
private readonly string _log_id = "LiveTheoPublisher";
private DateTime _last_future_theos_published = DateTime.MinValue;
@@ -120,7 +120,7 @@ namespace mbts.spark {
private void _interp_and_publish() {
_timer.start();
var timer = Stopwatch.StartNew();
var res = new Dictionary<uint, GreeksTuple>();
IReadOnlyDictionary<string, OptionDriverPriceMap> driver_map =
_bb.read_state(_drivers_tag);
@@ -165,8 +165,8 @@ namespace mbts.spark {
IReadOnlyDictionary<uint, GreeksTuple> res_ro = res;
bts.Log.Gen.info($"LiveTheoPublisher._interp_and_publish posting " +
$"count: {res_ro.Count}");
_timer.stop();
_logger.log(_log_id, _log_id, _timer.lastIntervalTime);
timer.Stop();
_logger.log(_log_id, _log_id, timer.Elapsed.TotalMilliseconds);
_bb.post(SparkTags.Greeks, res_ro);
// oh and those TC2 theos for comptability
_publish_tc2_theos(k_theos);
+5 -4
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Text;
using System.Linq;
using System.Text;
@@ -18,7 +19,7 @@ namespace mbts.spark {
private readonly int _log_period_updates, _max_size;
private DateTime _last_write_time = DateTime.Now;
private readonly string _default_id = String.Empty;
private readonly HighPerformanceTimer _defaut_timer = new HighPerformanceTimer();
private readonly Stopwatch _defaut_timer = new();
public PerfStatsLogger() : this(100, 200) { }
@@ -36,14 +37,14 @@ namespace mbts.spark {
}
public void start_default_timer() {
_defaut_timer.start();
_defaut_timer.Start();
}
public void stop_default_timer() {
if (String.IsNullOrEmpty(_default_id))
return;
_defaut_timer.stop();
log(_default_id, _default_id, _defaut_timer.lastIntervalTime);
_defaut_timer.Stop();
log(_default_id, _default_id, _defaut_timer.Elapsed.TotalMilliseconds);
}
public void log_default(double time) {
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -18,7 +19,6 @@ using bts.api.orderman;
namespace mbts.ui {
internal class NMSheetAllTaskingDataSource {
private IBus _bus;
HighPerformanceTimer _timer = new HighPerformanceTimer();
private Nullable<DynamicOrderDefinitionImmutable> get_tasking_order(
OrderDefinitionImmutable def) {
@@ -66,7 +66,7 @@ namespace mbts.ui {
bts.Log.Gen.info("NMSheetAllTaskingDataSource constructed");
_bus = bus;
orders_model.on_orders.Subscribe(ords => {
_timer.start();
var timer = Stopwatch.StartNew();
NMSheetAllTaskingData t_data = new NMSheetAllTaskingData();
bts.Log.Gen.info($"NMSheetAllTaskingDataSource on_orders n_orders: {ords.state.Values.Count()}");
foreach (var k in ords.state.Values) {
@@ -78,11 +78,11 @@ namespace mbts.ui {
add_task_secs(ref t_data, order.Def.Side, t_dyn.Value);
}
}
_timer.stop();
timer.Stop();
bts.Log.Gen.info($"NMSheetAllTaskingDataSource n_bids: {t_data.bids.Count()} " +
$"n_asks: {t_data.asks.Count()} t_msecs: {_timer.lastIntervalTime}");
$"n_asks: {t_data.asks.Count()} t_msecs: {timer.Elapsed.TotalMilliseconds}ms");
bus.post(SparkTags.TC2Tags.TaskData, t_data);
});
}
}
}
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using mbts.ui;
using mbts.spark;
@@ -102,8 +103,7 @@ namespace BCG {
private void _compute_and_fire() {
if (_is_main_sheet_active()) {
HighPerformanceTimer timer = new HighPerformanceTimer();
timer.start();
var timer = Stopwatch.StartNew();
NMSheetDataRequest data_request = _threaded_bb.read_state(_in_bb_main_sheet_request_tag) ?? new NMSheetDataRequest(new List<Triplet<NMSheetExpiration, bool, double>>());
data_request = NMSheetDataRequest.restrict_for_symbol(data_request, _nmsheet_symbol);
OptionDriverPriceMap live_driver_map = _threaded_bb.read_state(_in_bb_live_driver_bbo_tag);
@@ -130,9 +130,9 @@ namespace BCG {
null,
_threaded_bb.read_state(_in_bb_secmap_tag),
sheet_settings);
timer.stop();
timer.Stop();
_cb(new Pair<NMSheetSymbol, NMSheetSingleOptionData>(_nmsheet_symbol, theo_data));
_logger.log(_log_msg_id, _log_msg_id, timer.lastIntervalTime);
_logger.log(_log_msg_id, _log_msg_id, timer.Elapsed.TotalMilliseconds);
}
}
}
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -22,7 +23,6 @@ namespace BCG {
private bool _is_dirty = true;
private PerfStatsLogger _stats_logger = new PerfStatsLogger();
private HighPerformanceTimer _timer = new HighPerformanceTimer();
public NMSheetDataCoalescer(ThreadedBlackboard threaded_bb, object req_id, List<NMSheetSymbol> nmsheet_symbol_list, NMSheetSettings settings) {
_threaded_bb = threaded_bb;
@@ -44,13 +44,13 @@ namespace BCG {
public NMSheetData get_data() {
if (_is_dirty) {
_is_dirty = false;
_timer.start();
var timer = Stopwatch.StartNew();
NMSheetAllTaskingData d = _threaded_bb.read_state(
SparkTags.TC2Tags.TaskData, new NMSheetAllTaskingData());
NMSheetData rv = new NMSheetData(_main_data_source.get_data(), _bbo_data_source.get_all_data(), _ticker_data_source.get_data(), d);
rv = _filter_data(rv, _threaded_bb.read_state(_in_bb_settings_tag));
_timer.stop();
_stats_logger.log(String.Format("NMSheetDataCoalescer_{0}", _req_id), "NMSheetData.cons", _timer.lastIntervalTime);
timer.Stop();
_stats_logger.log(String.Format("NMSheetDataCoalescer_{0}", _req_id), "NMSheetData.cons", timer.Elapsed.TotalMilliseconds);
return rv;
} else {
return null;
@@ -78,4 +78,4 @@ namespace BCG {
}
#endregion
}
}
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Text;
@@ -30,7 +31,6 @@ namespace BCG {
private ThreadedBlackboard _threaded_bb;
private Action<NMSheetExpiration> _scroll_to_atm_cb;
private IDictionary<NMSheetExpiration, ATMData> _header_data;
private HighPerformanceTimer _timer = new HighPerformanceTimer();
private NMSheetExpirationHeaderControlStrip() { InitializeComponent(); }
private PerfStatsLogger _logger = new PerfStatsLogger();
private readonly string _log_id;
@@ -63,7 +63,7 @@ namespace BCG {
}
public void set_header_data(IDictionary<NMSheetExpiration, ATMData> header_data) {
_timer.start();
var timer = Stopwatch.StartNew();
_header_data = header_data;
NMSheetSettings settings = _threaded_bb.read_state(_in_bb_nmsheet_settings_tag) ?? new NMSheetSettings();
bool control_list_modified = false;
@@ -95,8 +95,8 @@ namespace BCG {
_reallign_controls(this, _vol_controls.Values, _threaded_bb.read_state(_in_bb_nmsheet_viewable_area_tag));
_publish_vol_shift_data();
}
_timer.stop();
_logger.log(_log_id, "NMSheetExpirationHeaderControlStrip.set_header_data", _timer.lastIntervalTime);
timer.Stop();
_logger.log(_log_id, "NMSheetExpirationHeaderControlStrip.set_header_data", timer.Elapsed.TotalMilliseconds);
}
private void _scroll_to_atm_event(NMSheetExpiration nmsheet_exp) { _scroll_to_atm_cb(nmsheet_exp); }
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Text;
@@ -35,7 +36,6 @@ namespace BCG {
// HighDPI - multiplying Taha's magic number by the _dpi_ratio
// fixes the up/down arrows overlaping the driver price
private static readonly int _single_driver_control_width = (105).MultipliedByDPIRatio();
private HighPerformanceTimer _timer = new HighPerformanceTimer();
private ThreadedBlackboard _threaded_bb;
private readonly ITag<NMSheetSettings> _in_bb_nmsheet_settings_tag;
@@ -124,7 +124,7 @@ namespace BCG {
/// dictated whats being painted on the grid, this keeps this control
/// in sync with the grid in terms of expiration.
private void _handle_sheet_theo_data(NMSheetData nmsheet_data) {
_timer.start();
var timer = Stopwatch.StartNew();
bool control_list_modified = false;
NMSheetSettings settings = _threaded_bb.read_state(_in_bb_nmsheet_settings_tag) ?? new NMSheetSettings();
if (nmsheet_data != null) {
@@ -159,8 +159,8 @@ namespace BCG {
if (control_list_modified) {
_reallign_controls(_price_controls, _threaded_bb.read_state(_in_bb_nmsheet_viewable_area_tag));
}
_timer.stop();
_logger.log(_log_id, "NMSheetDriverControlStrip._handle_sheet_data", _timer.lastIntervalTime);
timer.Stop();
_logger.log(_log_id, "NMSheetDriverControlStrip._handle_sheet_data", timer.Elapsed.TotalMilliseconds);
}
#region Price control events
@@ -247,4 +247,4 @@ namespace BCG {
}
#endregion
}
}
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Linq;
@@ -876,22 +877,20 @@ namespace BCG {
out NMSheetFormattedTheos formatted_theos,
out NMSheetGeometricLayout geo_lo_info,
PerfStatsLogger recorder) {
HighPerformanceTimer timer = new HighPerformanceTimer();
timer.start();
var timer = Stopwatch.StartNew();
visual_lo_info = new NMSheetVisualLayout(nmsheet_settings);
timer.stop();
double visual_layout_time = timer.lastIntervalTime;
timer.Stop();
double visual_layout_time = timer.Elapsed.TotalMilliseconds;
timer.start();
timer.Start();
formatted_theos = new NMSheetFormattedTheos(sheet_data, visual_lo_info.visible_cols, formatter);
timer.stop();
double format_theo_time = timer.lastIntervalTime;
timer.Stop();
double format_theo_time = timer.Elapsed.TotalMilliseconds;
timer.start();
timer.Start();
geo_lo_info = new NMSheetGeometricLayout(graphics, nmsheet_settings, visual_lo_info, formatted_theos, prev_geo_lo_info, false);
timer.stop();
double geometric_layout_time = timer.lastIntervalTime;
timer.Stop();
double geometric_layout_time = timer.Elapsed.TotalMilliseconds;
recorder.log("NMSheetTheoControl.VisualLayout", "NMSheetTheoControl.VisualLayout", visual_layout_time);
recorder.log("NMSheetTheoControl.Formatting", "NMSheetTheoControl.Formatting", format_theo_time);
@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
@@ -24,7 +25,6 @@ namespace BCG {
private readonly bool _is_remoted =
mbts.config.Configuration.get<bts.config.SystemConfig>().IsRemoteApp;
private readonly PerfStatsLogger _recorder = new PerfStatsLogger();
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private System.ComponentModel.Container components = null;
private NMSheetFormattedTheos _formatted_theos;
@@ -74,16 +74,16 @@ namespace BCG {
_formatted_theos = formatted_theos;
_geo_layout_info = geometric_lo_info;
_timer.start();
var timer = Stopwatch.StartNew();
/// if the cache is invalidated, the selection is cleared
if (new MyCacheInvalidationHelperData(_formatted_theos, _geo_layout_info, _settings).is_cache_invalidated(_cache_invalidation_data))
_selected_items_map = NMSheetTheoGridSelectionMap.get_empty_map();
_scroller.reset_settings(_settings);
double hit_ratio = _draw_on_bitmap();
Invalidate();
_timer.stop();
timer.Stop();
_recorder.log("NMSheetTheoGridDraw.HitRatio", "NMSheetTheoGridDraw.HitRatio", hit_ratio);
_recorder.log("NMSheetTheoGridDraw.DrawTime", "NMSheetTheoGridDraw.DrawTime", _timer.lastIntervalTime);
_recorder.log("NMSheetTheoGridDraw.DrawTime", "NMSheetTheoGridDraw.DrawTime", timer.Elapsed.TotalMilliseconds);
}
}
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
@@ -94,7 +95,7 @@ namespace BCG {
}
private void _draw_header(IGraphicsWrapper w) {
double start_ms = _timer.runningMilliseconds(), stop_ms;
var timer = Stopwatch.StartNew();
w.selectPen(w.createPen(_settings.setting_grid_internal.row_seperator_line_color /*cfg.lineColor*/));
w.selectFont(_settings.setting_expiration_header.expiration_font /*cfg.HeaderFont*/);
w.set_text_align(_convert_horizontal_alignment_setting_to_mask(NMSheetSettingGridInternal.NMSheetGridHorizontalTextAlignment.Left));
@@ -117,12 +118,12 @@ namespace BCG {
w.drawString(_formatted_theos.sorted_formatted_expirations[i], x + adjx, 0 + adjy);
}
stop_ms = _timer.runningMilliseconds();
_recorder.log("Header draw time", "Header draw time", stop_ms - start_ms);
timer.Stop();
_recorder.log("Header draw time", "Header draw time", timer.Elapsed.TotalMilliseconds);
}
private void _paint_seperate_areas(IGraphicsWrapper w) {
double start_ms = _timer.runningMilliseconds();
var timer = Stopwatch.StartNew();
foreach (NMSheetColumnName col in _visual_layout_info.visible_cols) {
int element_width = (int)_geo_layout_info.get_item_cell_size(col).Width,
element_offset = _geo_layout_info.get_item_x_in_exp(_visual_layout_info, col);
@@ -134,8 +135,8 @@ namespace BCG {
_geo_layout_info.cell_size.Height * _formatted_theos.sorted_formatted_strikes.Length);
}
}
double stop_ms = _timer.runningMilliseconds();
_recorder.log("NMSheetTheosGrid._paint_seperate_areas", "NMSheetTheosGrid._paint_seperate_areas", stop_ms - start_ms);
timer.Stop();
_recorder.log("NMSheetTheosGrid._paint_seperate_areas", "NMSheetTheosGrid._paint_seperate_areas", timer.Elapsed.TotalMilliseconds);
w.selectPen(w.createPen(Color.Black));
}
@@ -275,4 +276,4 @@ namespace BCG {
return new Point((int)(cell_size.Width / 2.0), 0);
}
}
}
}
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
@@ -94,13 +95,13 @@ namespace BCG
if (Math.Abs(dp.Width - _move_since_dragging_start.Width) >= _selection_drag_move_threshold.Width || Math.Abs(dp.Height - _move_since_dragging_start.Height) >= _selection_drag_move_threshold.Height)
{
_move_since_dragging_start = dp;
_timer.start();
var timer = Stopwatch.StartNew();
Rectangle selected_rectangle = _get_selected_rectangle(dp);
_selected_items_map = new NMSheetTheoGridSelectionMap(_formatted_theos, _visual_layout_info, _geo_layout_info, _settings, selected_rectangle, _data_at_drag_start);
Invalidate();
_timer.stop();
timer.Stop();
System.Diagnostics.Trace.WriteLine(String.Format("{0}:{1}:{2}:{3} , Time {4} msecs , Rect {5} dp {6}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second,
DateTime.Now.Millisecond, _timer.lastIntervalTime, selected_rectangle, dp));
DateTime.Now.Millisecond, timer.Elapsed.TotalMilliseconds, selected_rectangle, dp));
}
}
}
@@ -132,4 +133,4 @@ namespace BCG
return bm_rect;
}
}
}
}
@@ -1,6 +1,7 @@
using mbts.utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using mbts.spark;
using bts.api;
@@ -102,7 +103,7 @@ namespace mbts.analytics {
public PNLReportCalculator(bts.api.IBus bus) {
Log.Ui.info("PNLReportCalculator init'ed");
_bus = bus;
HighPerformanceTimer timer = new HighPerformanceTimer();
var timer = new Stopwatch();
_dispose =
bus.subscribe(SparkTags.TradeLogTag)
.CombineLatest(
@@ -112,16 +113,16 @@ namespace mbts.analytics {
(trades, opt_theos, fut_theos, secs) => (trades, opt_theos, fut_theos, secs))
.BufferLatest(TimeSpan.FromSeconds(2))
.Subscribe(tup => {
timer.start();
timer.Start();
var opt_theos_cleaned = tup.opt_theos.ToDictionary(
kv => kv.Key, kv => kv.Value == null ? new ExpStrikeKeyedData<TheoPoint>() : kv.Value);
var fut_theos_cleaned = tup.fut_theos.ToDictionary(
kv => kv.Key, kv => kv.Value == null ? FutureTheoStructure.get_empty(kv.Key.expiration) : kv.Value);
var pnl_trades = _create_pnl_rows(tup.trades, opt_theos_cleaned, fut_theos_cleaned, tup.secs);
var output = _create_output(pnl_trades);
timer.stop();
timer.Stop();
Log.Ui.info($"PNLReportCalculator n_pos: {output.position_data.Count()} " +
$"n_day_trades: {output.day_trades.Count()} time(msecs): {timer.lastIntervalTime}");
$"n_day_trades: {output.day_trades.Count()} time(msecs): {timer.Elapsed.TotalMilliseconds}");
//_log_before_posting(output.position_data);
_bus.post(SparkTags.ReportBlackboardTags.PNL.PNLData, output);
});
@@ -3,6 +3,7 @@ using mbts.analytics;
using mbts.utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using mbts.spark;
using bts.api;
@@ -40,7 +41,6 @@ namespace mbts.analytics {
private SlideModelUIOverrides _ui_override = null;
private VolSurfaceStandardTime _vs_standard_time = null;
// Support Data
private HighPerformanceTimer _timer = new HighPerformanceTimer();
private bool _compute_dirty = false;
private HashSet<bts.api.SecurityTuple> _sec_tups;
@@ -205,7 +205,7 @@ namespace mbts.analytics {
private bool _compute_and_fire() {
if (_is_data_ready) {
_timer.start();
var timer = Stopwatch.StartNew();
VolSurfaceInput vs_input = _vs_effective_input;
// aux:
var aux_data_map = VolSurfaceUtilityFunctions.compute_aux_data(vs_input,
@@ -228,9 +228,9 @@ namespace mbts.analytics {
account_option_pos_map.ToDictionary(kv => kv.Key, kv => new HashSet<double>(kv.Value.Keys)),
_report.Handles);
VolSurfaceSlideCalculator.change_vol_dervs_to_percentages(ref option_theo_map);
_timer.stop();
bts.Log.Gen.info(String.Format("Slide Theo Comp time {0}", _timer.lastIntervalTime));
_timer.start();
timer.Stop();
bts.Log.Gen.info(String.Format("Slide Theo Comp time {0}ms", timer.Elapsed.TotalMilliseconds));
timer.Start();
var cpp_map = _vs_nonvol_data.get_cpp_map();
// future theos:
var fut_theo_map = VolSurfaceUtilityFunctions.compute_future_theos(
@@ -254,8 +254,8 @@ namespace mbts.analytics {
new HashSet<VolSurfaceExpiration>(_vs_nonvol_data.get_associated_non_options().Select(
e => new VolSurfaceExpiration(e))),
_ui_override);
_timer.stop();
bts.Log.Gen.info(String.Format("Slide Theo*Pos time {0}", _timer.lastIntervalTime));
timer.Stop();
bts.Log.Gen.info(String.Format("Slide Theo*Pos time {0}ms", timer.Elapsed.TotalMilliseconds));
Log.Gen.info($"SlideReportCalculator publishing calculated slide: {full_data.log_string()}");
// not supporting overrides (5/5/22)
Log.assert(full_data.ui_override == null);
@@ -3,6 +3,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using bts.api;
@@ -53,8 +54,7 @@ namespace BCG {
try {
_last_fire_time = DateTime.Now;
_compute_all_dirty = false;
HighPerformanceTimer perf_timer = new HighPerformanceTimer();
perf_timer.start();
var perf_timer = Stopwatch.StartNew();
IEnumerable<string> spread_ids = _bb.read_state(_all_ids_tag);
if (spread_ids == null || spread_ids.Count() == 0)
return;
@@ -66,10 +66,10 @@ namespace BCG {
_compute_and_publish_single_spread(id, ss);
}
}
perf_timer.stop();
perf_timer.Stop();
bts.Log.Ui.info(
$"SpreadCalculationSynchronizer calculation compute_all {count} spreads "
+ $"{perf_timer.lastIntervalTime} msecs");
+ $"{perf_timer.Elapsed.TotalMilliseconds} msecs");
} catch (Exception ex) {
bts.Log.Ui.error(ex.Message);
bts.Log.assert(false);