Пример #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 ProcessPerformancePartConfig(ProcessPerformancePartConfig other)
 {
     ProcessDeltaOccurrenceFileIndexUserRowFlagBits = other.ProcessDeltaOccurrenceFileIndexUserRowFlagBits;
     ActiveSetGroupsFileIndexUserRowFlagBits        = other.ActiveSetGroupsFileIndexUserRowFlagBits;
     ActiveSetMapGroupFileIndexUserRowFlagBits      = other.ActiveSetMapGroupFileIndexUserRowFlagBits;
     SampleInterval = other.SampleInterval;
     ActiveSetSize  = other.ActiveSetSize;
     CPUUsageEstimateThresholdInPercentPerCore = other.CPUUsageEstimateThresholdInPercentPerCore;
     WorkingSetUsageThreshold  = other.WorkingSetUsageThreshold;
     ForcedElevationHoldPeriod = other.ForcedElevationHoldPeriod;
 }