public CPUPerformancePart(string partID, CPUPerformancePartConfig config, PartsLib.Tools.MDRF.Writer.IMDRFWriter mdrfWriter) : base(partID, initialSettings: SimpleActivePartBaseSettings.DefaultVersion0.Build(waitTimeLimit: (0.10).FromSeconds(), goOnlineAndOfflineHandling: GoOnlineAndGoOfflineHandling.All)) { Config = new CPUPerformancePartConfig(config); this.mdrfWriter = mdrfWriter; Log.SetDefaultNamedValueSetForEmitter(Logging.MesgType.All, new NamedValueSet() { { "noMDRF" } }); sampleIntervalTimer = new QpcTimer() { TriggerInterval = config.SampleInterval, AutoReset = true }.Start(); aggregationIntervalTimer = new QpcTimer() { TriggerInterval = config.AggregationInterval, AutoReset = true }.Start(); h1Grp = new MDRFHistogramGroupSource("{0}.h1".CheckedFormat(partID), h1, Config.SampleGroupsFileIndexUserRowFlagBits); h10Grp = new MDRFHistogramGroupSource("{0}.h10".CheckedFormat(partID), h10, Config.SampleGroupsFileIndexUserRowFlagBits); h30Grp = new MDRFHistogramGroupSource("{0}.h30".CheckedFormat(partID), h30, Config.SampleGroupsFileIndexUserRowFlagBits); ah1 = new Histogram(h1); ah10 = new Histogram(h10); ah30 = new Histogram(h30); ah1Grp = new MDRFHistogramGroupSource("{0}.ah1".CheckedFormat(partID), ah1, Config.AggregateGroupsFileIndexUserRowFlagBits); ah10Grp = new MDRFHistogramGroupSource("{0}.ah10".CheckedFormat(partID), ah10, Config.AggregateGroupsFileIndexUserRowFlagBits); ah30Grp = new MDRFHistogramGroupSource("{0}.ah30".CheckedFormat(partID), ah30, Config.AggregateGroupsFileIndexUserRowFlagBits); mdrfWriter.Add(h1Grp.GroupInfo, h10Grp.GroupInfo, h30Grp.GroupInfo, ah1Grp.GroupInfo, ah10Grp.GroupInfo, ah30Grp.GroupInfo); }
public SerialEchoTracker(string portPartID, string portTargetSpec, double[] binBoundariesArray, SerialEchoPerformancePartConfig config, INotifyable notifyOnDone, Logging.IBasicLogger logger) { PortTargetSpec = portTargetSpec; Config = config; NotifyOnDone = notifyOnDone; Logger = logger; h = new Histogram(binBoundariesArray); timeoutCountGPI = new MDRF.Writer.GroupPointInfo() { Name = "timeoutCount", ValueCST = ContainerStorageType.UInt64, VC = new ValueContainer(0L) }; failureCountGPI = new MDRF.Writer.GroupPointInfo() { Name = "failureCount", ValueCST = ContainerStorageType.UInt64, VC = new ValueContainer(0L) }; hGrp = new MDRFHistogramGroupSource("{0}".CheckedFormat(portPartID), h, (ulong)config.AggregateGroupsFileIndexUserRowFlagBits, extraClientNVS: new NamedValueSet() { { "SerialEcho" }, { "PortTargetSpec", PortTargetSpec } }, extraGPISet: new[] { timeoutCountGPI, failureCountGPI }); try { portConfig = new PortConfig(portPartID, portTargetSpec) { TxLineTerm = LineTerm.None, RxLineTerm = LineTerm.CR, ConnectTimeout = (2.0).FromSeconds(), WriteTimeout = (1.0).FromSeconds(), ReadTimeout = (1.0).FromSeconds(), IdleTime = (1.0).FromSeconds(), EnableAutoReconnect = true, }; port = MosaicLib.SerialIO.Factory.CreatePort(portConfig); portGetNextPacketAction = port.CreateGetNextPacketAction(); portFlushAction = port.CreateFlushAction(); portWriteAction = port.CreateWriteAction(portWriteActionParam = new WriteActionParam()); } catch (System.Exception ex) { Logger.Error.Emit("Port setup for '{0}' failed: {1}", portTargetSpec, ex.ToString(ExceptionFormat.TypeAndMessage)); } }
public PingTracker(string hostNameOrAddress, double[] binBoundariesArray, PingPerformancePartConfig config, INotifyable notifyOnDone) { HostNameOrAddress = hostNameOrAddress; NotifyOnDone = notifyOnDone; // calling GetHostAddresses can throw for many reasons (invalid app.config for example...) Func <System.Net.IPAddress []> getHostAddressesDelegate = () => System.Net.Dns.GetHostAddresses(hostNameOrAddress); IPAddressArray = getHostAddressesDelegate.TryGet(); IPAddress = IPAddressArray.SafeAccess(0, System.Net.IPAddress.None); h = new Histogram(binBoundariesArray); timeoutCountGPI = new MDRF.Writer.GroupPointInfo() { Name = "timeoutCount", ValueCST = ContainerStorageType.UInt64, VC = new ValueContainer(0L) }; failureCountGPI = new MDRF.Writer.GroupPointInfo() { Name = "failureCount", ValueCST = ContainerStorageType.UInt64, VC = new ValueContainer(0L) }; hGrp = new MDRFHistogramGroupSource("hPing_{0}".CheckedFormat(HostNameOrAddress), h, (ulong)config.AggregateGroupsFileIndexUserRowFlagBits, extraClientNVS: new NamedValueSet() { { "Ping" }, { "Host", HostNameOrAddress }, { "IPAddress", IPAddress.ToString() } }, extraGPISet: new[] { timeoutCountGPI, failureCountGPI }); extraData = new byte[config.ExtraLength]; responseTimeLimitInMSec = unchecked ((int)config.ResponseTimeLimit.TotalMilliseconds); responseWaitTimeLimit = (config.ResponseTimeLimit.TotalSeconds + 0.25).FromSeconds(); }