Пример #1
0
        public ProcessPerformancePart(string partID, ProcessPerformancePartConfig config, PartsLib.Tools.MDRF.Writer.IMDRFWriter mdrfWriter)
            : base(partID, initialSettings: SimpleActivePartBaseSettings.DefaultVersion0.Build(waitTimeLimit: (0.1).FromSeconds(), goOnlineAndOfflineHandling: GoOnlineAndGoOfflineHandling.All))
        {
            Config          = new ProcessPerformancePartConfig(config);
            this.mdrfWriter = mdrfWriter;

            sampleIntervalTimer = new QpcTimer()
            {
                TriggerInterval = config.SampleInterval, AutoReset = true
            }.Start();

            Log.SetDefaultNamedValueSetForEmitter(Logging.MesgType.All, new NamedValueSet()
            {
                { "noMDRF" }
            });

            ProcessDeltaOccurrenceInfo = new MDRF.Writer.OccurrenceInfo()
            {
                Name    = "{0}.ProcessDelta".CheckedFormat(PartID),
                Comment = "Used to record all process additions, removals, and migrations to/from the active set",
                FileIndexUserRowFlagBits = config.ProcessDeltaOccurrenceFileIndexUserRowFlagBits,
            };

            activeSetItemTrackerArray       = Enumerable.Range(1, Math.Max(config.ActiveSetSize, 1)).Select(groupNum => new ActiveSetItemTracker("{0}.ActSet{1:d2}".CheckedFormat(PartID, groupNum), Config.ActiveSetGroupsFileIndexUserRowFlagBits)).ToArray();
            activeSetItemTrackerArrayLength = activeSetItemTrackerArray.Length;

            activeSetMapGroup = new ActiveSetMapGroupTracker(config.ActiveSetSize, "{0}.ActSetMap".CheckedFormat(PartID), Config.ActiveSetMapGroupFileIndexUserRowFlagBits);

            GroupInfoArray = activeSetItemTrackerArray.Select(ast => ast.GroupInfo).ToArray();

            mdrfWriter.Add(ProcessDeltaOccurrenceInfo);
            mdrfWriter.Add(activeSetMapGroup.GroupInfo);
            mdrfWriter.AddRange(GroupInfoArray);
        }
Пример #2
0
        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" }
            });
        }