public FileRWPerformancePartConfig(FileRWPerformancePartConfig other)
 {
     SampleGroupsFileIndexUserRowFlagBits    = other.SampleGroupsFileIndexUserRowFlagBits;
     AggregateGroupsFileIndexUserRowFlagBits = other.AggregateGroupsFileIndexUserRowFlagBits;
     SampleInterval         = other.SampleInterval;
     AggregationInterval    = other.AggregationInterval;
     UseFileFlagNoBuffering = other.UseFileFlagNoBuffering;
     DisableReadThroughUseRandomWriteIOPsThreshold = other.DisableReadThroughUseRandomWriteIOPsThreshold;
     EnableContinuousWriting = other.EnableContinuousWriting;
     TestFilePath            = other.TestFilePath;
 }
        public FileRWPerformancePart(string partID, FileRWPerformancePartConfig config, PartsLib.Tools.MDRF.Writer.IMDRFWriter mdrfWriter)
            : base(partID, initialSettings: SimpleActivePartBaseSettings.DefaultVersion0.Build(waitTimeLimit: (0.10).FromSeconds(), goOnlineAndOfflineHandling: GoOnlineAndGoOfflineHandling.All))
        {
            Config          = new FileRWPerformancePartConfig(config);
            this.mdrfWriter = mdrfWriter;

            // we trigger acquiring a new sample two times a second
            sampleIntervalTimer = new QpcTimer()
            {
                TriggerInterval = Config.SampleInterval, AutoReset = true
            }.Start();
            aggregationIntervalTimer = new QpcTimer()
            {
                TriggerInterval = Config.AggregationInterval, AutoReset = true
            }.Start();

            AddExplicitDisposeAction(() => Release());

            ahReadNormal   = new Histogram(hReadNormal);
            ahReadThrough  = new Histogram(hReadThrough);
            ahWriteThrough = new Histogram(hWriteThrough);

            avgRatesGroup = new MDRF.Writer.GroupInfo()
            {
                Name = "{0}.avgRates".CheckedFormat(PartID),
                GroupBehaviorOptions     = MDRF.Writer.GroupBehaviorOptions.UseVCHasBeenSetForTouched | MDRF.Writer.GroupBehaviorOptions.IncrSeqNumOnTouched,
                FileIndexUserRowFlagBits = (ulong)Config.AggregateGroupsFileIndexUserRowFlagBits,
                GroupPointInfoArray      = new MDRF.Writer.GroupPointInfo[]
                {
                    peakReadNormalRateGPI = new MDRF.Writer.GroupPointInfo()
                    {
                        Name = "peakReadRate", ValueCST = ContainerStorageType.Double, VC = new ValueContainer(0.0)
                    },
                    peakReadThroughRateGPI = new MDRF.Writer.GroupPointInfo()
                    {
                        Name = "peakReadThroughRate", ValueCST = ContainerStorageType.Double, VC = new ValueContainer(0.0)
                    },
                    peakWriteThroughRateGPI = new MDRF.Writer.GroupPointInfo()
                    {
                        Name = "peakWriteThroughRate", ValueCST = ContainerStorageType.Double, VC = new ValueContainer(0.0)
                    },
                },
                Touched = true,
            };

            accumTupleArray = new Tuple <MDRFHistogramGroupSource, MDRFHistogramGroupSource> []
            {
                Tuple.Create(new MDRFHistogramGroupSource("{0}.hReadNormal".CheckedFormat(PartID), hReadNormal, Config.SampleGroupsFileIndexUserRowFlagBits),
                             new MDRFHistogramGroupSource("{0}.ahReadNormal".CheckedFormat(PartID), ahReadNormal, Config.AggregateGroupsFileIndexUserRowFlagBits)),
                Tuple.Create(new MDRFHistogramGroupSource("{0}.hReadThrough".CheckedFormat(PartID), hReadThrough, Config.SampleGroupsFileIndexUserRowFlagBits),
                             new MDRFHistogramGroupSource("{0}.ahReadThrough".CheckedFormat(PartID), ahReadThrough, Config.AggregateGroupsFileIndexUserRowFlagBits)),
                Tuple.Create(new MDRFHistogramGroupSource("{0}.hWriteThrough".CheckedFormat(PartID), hWriteThrough, Config.SampleGroupsFileIndexUserRowFlagBits),
                             new MDRFHistogramGroupSource("{0}.ahWriteThrough".CheckedFormat(PartID), ahWriteThrough, Config.AggregateGroupsFileIndexUserRowFlagBits)),
            };

            IEnumerable <Tuple <MDRFHistogramGroupSource, MDRFHistogramGroupSource> > registerGroupsSet = ((Config.UseFileFlagNoBuffering) ? accumTupleArray : new [] { accumTupleArray[0], accumTupleArray[2] });

            mdrfWriter.Add(avgRatesGroup);
            mdrfWriter.AddRange(registerGroupsSet.Select(t => t.Item1.GroupInfo).Concat(registerGroupsSet.Select(t => t.Item2.GroupInfo)));

            noMDRFLogger = new Logging.Logger(PartID).SetDefaultNamedValueSetForEmitter(Logging.LogGate.All, new NamedValueSet()
            {
                { "noMDRF" }
            });
        }