Example #1
0
        private string warningUpDate(string message, bool isActive, reportPlugIn_workload plugin)
        {
            if (isActive)
            {
                terminationWarning++;
                if (terminationWarning >= plugin.plugin_settings.term_warningCount)
                {
                    plugin.loger.AppendLine("Termination initiated [" + message + "] :: warning (" + terminationWarning + " / " + plugin.plugin_settings.term_warningCount + ")");
                    comment = comment.add($"Termination:{ message}");
                }
                else
                {
                    plugin.loger.consoleAltColorToggle();
                    plugin.loger.AppendLine("Termination criterion met [" + message + "] :: warning (" + terminationWarning + " / " + plugin.plugin_settings.term_warningCount + ") issued.");

                    comment = comment.add($"Warninig {terminationWarning}:{message}");
                    plugin.loger.consoleAltColorToggle();
                }

                return(message);
            }
            else
            {
                plugin.loger.AppendLine("Termination warnings counter set to 0 .".add(message, " "));
                comment            = comment.add($"Warninig reset:{message}");
                terminationWarning = 0;
            }
            return("");
        }
Example #2
0
        public void doCheckCriteria(crawlerDomainTaskMachine _machine, modelSpiderTestRecord tRecord, reportPlugIn_workload plugin, experimentSessionEntry entry)
        {
            if (!tCPU.SampleState.HasFlag(measureTrendSampleState.macroMean))
            {
                pluginState = workloadPluginState.preparing;
            }

            if (plugin.plugin_settings.term_DLCFinished > 0) // <----- da li je aktiviran ovaj uslov
            {
                if (_machine.taskDone >= plugin.plugin_settings.term_DLCFinished)
                {
                    terminate(_machine);
                }
            }



            if (pluginState == workloadPluginState.active)
            {
                if (_machine.taskDone >= DLCDoneForNext)
                {
                    doStartNextGroup(_machine, tRecord, plugin, entry);

                    stateUpdate(_machine, tRecord, plugin, entry);

                    plugin.records.Save(getWritableFileMode.overwrite);
                }

                if (isSampleTail)
                {
                    if (plugin.plugin_settings.term_JLCinTail)
                    {
                        terminate(_machine);
                    }
                    else
                    {
                        pluginState = workloadPluginState.sampleTail;
                    }
                }

                if (isMemoryLimit)
                {
                    if (plugin.plugin_settings.term_availableMemory > 0)
                    {
                        terminate(_machine);
                    }
                    else
                    {
                        pluginState = workloadPluginState.cooldown;

                        cooldownIndex = plugin.plugin_settings.warmingUpTicks;
                    }
                }
            }
        }
Example #3
0
        private void doStartNextGroup(crawlerDomainTaskMachine _machine, modelSpiderTestRecord tRecord, reportPlugIn_workload plugin, experimentSessionEntry entry)
        {
            doReadData(_machine);

            DLCDoneForNext = _machine.taskDone + plugin.plugin_settings.stepUp_DLCCount;
            pluginState    = workloadPluginState.wormingUp;
            string msg = $"Measure group {measureGroup} completed -- DLCs done: {_machine.taskDone}";

            plugin.loger.log(msg);

            comment        = comment.add($"Group {measureGroup} done");
            wormingUpIndex = plugin.plugin_settings.warmingUpTicks;
            if (wormingUpIndex == 0)
            {
                pluginState = workloadPluginState.active;
            }
            measureGroup         = measureGroup + 1;
            _machine.maxThreads += plugin.plugin_settings.stepUp_step;
        }
Example #4
0
        private void doCheckFacts(crawlerDomainTaskMachine _machine, modelSpiderTestRecord tRecord, reportPlugIn_workload plugin, experimentSessionEntry entry)
        {
            if (mMemory < plugin.plugin_settings.term_availableMemory)
            {
                warningUpDate("Available RAM [" + mMemory.ToString("P2") + "] is below the termination limit [" + plugin.plugin_settings.term_availableMemory.ToString("P2") + "]", true, plugin);
                if (terminationWarning >= plugin.plugin_settings.term_warningCount)
                {
                    isMemoryLimit = true;
                }
                else
                {
                }
            }
            else if (_machine.taskWaiting == 0)
            {
                warningUpDate("There is no DLCs waiting [" + _machine.taskWaiting + "] - no way to run DLCs up to TC_max [" + _machine.maxThreads + "]", true, plugin);
                if (terminationWarning >= plugin.plugin_settings.term_warningCount)
                {
                    isSampleTail = true;
                }
            }
            else
            {
                if (terminationWarning > 0)
                {
                    warningUpDate("All termination criteria clean", false, plugin);
                }
            }

            if (_machine.taskRunning > _machine.maxThreads)
            {
                plugin.loger.log($" Running {_machine.taskRunning} more then TC_max {_machine.maxThreads} - switching to cooldown");
                cooldownIndex = plugin.plugin_settings.warmingUpTicks;
                pluginState   = workloadPluginState.cooldown;
            }
        }
Example #5
0
        private void doPerform(crawlerDomainTaskMachine _machine, modelSpiderTestRecord tRecord, reportPlugIn_workload plugin, experimentSessionEntry entry)
        {
            switch (pluginState)
            {
            case workloadPluginState.active:



                break;

            case workloadPluginState.cooldown:
                if (cooldownIndex > 0)
                {
                    comment       = comment.add($"Coolingdown [{cooldownIndex}]");
                    cooldownIndex = cooldownIndex - (thisSampleID - lastSampleID);
                }
                else
                {
                    comment     = comment.add($"Cooldown finished");
                    pluginState = workloadPluginState.active;
                }
                break;

            case workloadPluginState.disabled:
                break;

            case workloadPluginState.none:
                break;

            case workloadPluginState.preparing:
                if (tCPU.SampleState.HasFlag(measureTrendSampleState.macroMean))
                {
                    pluginState = workloadPluginState.active;
                    plugin.loger.log("Workload plugin ready");
                }
                break;

            case workloadPluginState.sampleTail:
                break;

            case workloadPluginState.terminating:

                terminate(_machine);

                break;

            case workloadPluginState.wormingUp:
                if (wormingUpIndex > 0)
                {
                    comment        = comment.add($"WormingUp [{wormingUpIndex}]");
                    wormingUpIndex = wormingUpIndex - (thisSampleID - lastSampleID);
                }
                else
                {
                    comment     = comment.add($"WormingUp finished");
                    pluginState = workloadPluginState.active;
                }
                break;
            }
        }
Example #6
0
        public void stateUpdate(crawlerDomainTaskMachine _machine, modelSpiderTestRecord tRecord, reportPlugIn_workload plugin, experimentSessionEntry entry)
        {
            comment = "";

            doReadData(_machine);

            // <------------------ DATA COLLECTION



            // <------------------ STATE DECISION
            doCheckFacts(_machine, tRecord, plugin, entry);

            doPerform(_machine, tRecord, plugin, entry);

            doCreateEntry(_machine, tRecord, plugin, entry);



            doCheckCriteria(_machine, tRecord, plugin, entry);



            // <------------------ PRINTING OUT ----------------------------

            plugin.loger.AppendHorizontalLine();

            if (pluginState != workloadPluginState.disabled)
            {
                string st_in = pluginState.ToString();
                if (pluginState == workloadPluginState.active)
                {
                    st_in = "_" + st_in + "_";
                }
                plugin.loger.AppendLine(string.Format(STATUSLINE_ONE, st_in, lastEntry.RecordID.ToString("D3"), lastEntry.measureGroup, lastEntry.dlcMaximum, lastEntry.dlcRunning, lastEntry.dlcWaiting).toWidthExact(Console.BufferWidth - 11, "="));
            }

            plugin.loger.AppendLine(tMemory.GetTrendInline() + " | " + tCPU.GetTrendInline() + " | " + tCPUm.GetTrendInline());
            plugin.loger.AppendLine(tDataLoad.GetTrendInline() + " | " + tContentPages.GetTrendInline() + " | " + tIterations.GetTrendInline());

            //plugin.loger.AppendLine("--- Info: " );
            if (pluginState != workloadPluginState.disabled)
            {
                plugin.loger.AppendLine(string.Format(STATUSLINE_TWO, mMemory.ToString("P2"),
                                                      lastEntry.terminationWarning.ToString("D3"), lastEntry.dlcDone, DLCDoneForNext, thisSampleID, lastSampleID).toWidthExact(Console.BufferWidth - 11, "="));
                //  plugin.loger.AppendLine(String.Format(STATUSLINE_TWO, mMemory.ToString("P2"), g).toWidthExact(Console.BufferWidth-11, "="));
            }
        }
Example #7
0
        public string doCreateEntry(crawlerDomainTaskMachine _machine, modelSpiderTestRecord tRecord, reportPlugIn_workload plugin, experimentSessionEntry entry)
        {
            string recID = "";

            if (_machine != null)
            {
                thisSampleID = _machine.dataLoadTaker.CountTakes();
            }
            if (lastSampleID == -1)
            {
                lastSampleID = 0;
            }

            if (thisSampleID != lastSampleID)
            {
                RecordID++;

                // <------------------ RECORD CREATION
                recID                 = GetEntryID(RecordID, measureGroup);
                lastEntry             = plugin.records.GetOrCreate(recID);
                lastEntry.RecordID    = RecordID;
                lastEntry.pluginState = pluginState.ToString();

                switch (pluginState)
                {
                case workloadPluginState.active:
                    lastEntry.measureGroup = measureGroup;
                    break;

                default:
                    lastEntry.measureGroup = -1;
                    break;
                }

                lastEntry.SetTestIDAndSignature(tRecord.instance, entry.state, tRecord);

                lastEntry.terminationWarning = terminationWarning;
                lastEntry.availableMemory    = mMemory;

                lastEntry.ContentPages     = tContentPages.MicroMean;
                lastEntry.cpuRateOfMachine = tCPUm.MicroMean;
                lastEntry.cpuRateOfProcess = tCPU.MicroMean;
                lastEntry.physicalMemory   = tMemory.MicroMean;


                lastEntry.CrawlerIterations = tIterations.MicroMean;
                lastEntry.DataLoad          = tDataLoad.MicroMean;

                lastEntry.dlcDone    = _machine.taskDone;
                lastEntry.dlcRunning = _machine.taskRunning;
                lastEntry.dlcWaiting = _machine.taskWaiting;
                lastEntry.dlcMaximum = _machine.maxThreads;

                plugin.records.AddOrUpdate(lastEntry);
            }
            lastSampleID = thisSampleID;
            return(recID);
        }