コード例 #1
0
        /// <summary>
        /// Generate new threshold colorcode values for all intermediate rows
        /// </summary>
        /// <param name="greenColorcode"></param>
        /// <param name="yellowColorcode"></param>
        /// <param name="redColorcode"></param>
        public void GenerateThresholdValues(string greenColorcode, string yellowColorcode, string redColorcode, bool storeMetrics = false)
        {
            Log.WriteLine("generate threshold values...");
            // load threshold config from database
            Thresholds thresholds = new Thresholds(project);

            // generate color values
            Intermediate thValues = thresholds.GenerateThresholdValuesForTransactions(intermediate, greenColorcode, yellowColorcode, redColorcode);

            // merge threshold colortransactions with dataset
            Log.WriteLine(string.Format("adding {0} threshold entries...", thValues.Count));
            intermediate.Add(thValues);

            // count threshold violations (add in separate series) by transactionname patter + red color
            Log.WriteLine("aggregate threshold violations...");
            Intermediate thresholdViolations = thValues.AggregateCount(THRESHOLDVIOLATIONSKEY, @"\d\d_.*_c$", redColorcode); // only evaluate script transactions!

            // store these newly generated metrics back to the database
            if (storeMetrics)
            {
                thresholdViolations.SaveToDatabase(this.project, this.testrun, Category.Transaction, Entity.None);
            }

            Log.WriteLine("adding threshold violations: " + thresholdViolations.GetValue(THRESHOLDVIOLATIONSKEY));
            this.intermediate.Add(thresholdViolations);
        }
コード例 #2
0
        public double[] ReadScaled(uint AIChannelNumber, Int64 AIStartBurst, Int64 AINumberOfBursts, bool AIHalveAmplitude)
        {
            if (AIChannelNumber >= ChannelCount)
            {
                return(null);
            }
            Array Intermediate;

            if (Is16Bit)
            {
                Intermediate = new Int16[AINumberOfBursts, ChannelCount];
            }
            else
            {
                Intermediate = new int[AINumberOfBursts, ChannelCount];
            }
            ReadRaw(AIStartBurst, AINumberOfBursts, ref Intermediate);
            List <double> retVal = new List <double>();

            for (int iKanal = 0; iKanal < ChannelCount; iKanal++)
            {
                for (int iWert = 0; iWert < AINumberOfBursts; iWert++)
                {
                    object o     = Intermediate.GetValue(iWert, iKanal);
                    double val   = Convert.ToDouble(o);
                    double slope = Slope[iKanal];
                    if (AIHalveAmplitude)
                    {
                        slope /= 2.0;
                    }
                    retVal.Add(val * slope + YOffset[iKanal]);
                }
            }
            return(retVal.ToArray());
        }
コード例 #3
0
        /// <summary>
        /// Get the right value out of intermediate strings name=value1;value;value3
        /// searchpattern name name:0 name:1 ... (name=name:0)
        /// </summary>
        /// <param name="intermediate"></param>
        /// <param name="templateVariable"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public bool GetValueFromIntermediate(Intermediate intermediate, string templateVariable, out string value)
        {
            bool result = true;

            value = "";
            Regex regex = new Regex("^(.*?):([0-9]+)"); // variabelenaam:valueIndex

            try
            {
                // als een index aan de variabele toegevoegd is, dan value opzoeken in de comma separated value-rij, zo niet: index 0 gebruiken
                if (regex.IsMatch(templateVariable))
                {
                    string varname = regex.Match(templateVariable).Groups[1].Value;
                    int    valueIndex;
                    if (!int.TryParse(regex.Match(templateVariable).Groups[2].Value, out valueIndex))
                    {
                        // als geen indexer meegeggeven: neem dan index 0
                        valueIndex = 0;
                    }
                    value = intermediate.GetValue(varname, valueIndex);
                }
                else // als geen indexer aan variabele is toegevoegd: geef alleen intermediate terug als het een singleton is (geen list)
                {
                    if (!intermediate.GetValue(templateVariable).Contains(Intermediate.LISTSEPARATOR))
                    {
                        value = intermediate.GetValue(templateVariable);
                    }
                    else
                    {
                        result = false;
                    }
                }
            }
            // als fout ontstaat is variabele niet gevonden in dit intermediate bestand, niet ernstig, value wordt dan niet aangeraakt!
            // het is aan aanroepend niveau om een defaultwaarde toe te kennen aan value
            catch { result = false; }

            return(result);
        }
コード例 #4
0
        /// <summary>
        /// Perform baselining and generate extra baseline tags
        /// ${Appbeheer_01_Inloggen_br // reference (baseline value)
        /// ${Appbeheer_01_Inloggen_be // evaluated value (difference from baseline in %)
        /// ${Appbeheer_01_Inloggen_be_c // colorcode, mark when current value exceeds threshold th1, green when diff > -15%, red when diff > +15%
        /// </summary>
        /// <param name="currentTestrun"></param>
        /// <param name="baselineTestrun"></param>
        /// <param name="colorcodeBetter"></param>
        /// <param name="colorcodeWorse"></param>
        public void GenerateBaselineValues(string currentTestrun, string baselineTestrun, string colorcodeBetter, string colorcodeWorse, bool storeMetrics = false)
        {
            Thresholds thresholds = new Thresholds(this.project);

            // First, collect current and baseline run info and threshold violations:

            // lees baseline data, kies alternatief als baseline run niet gezet
            Log.WriteLine("read baseline values...");
            Intermediate baselineValues = ReadBaselineData(currentTestrun, baselineTestrun);

            Log.WriteLine("generate threshold evaluation on baseline run...");
            Intermediate baselineThresholdValues = thresholds.GenerateThresholdValuesForTransactions(baselineValues, Baselining.belowLowThreshold, "y", "r");

            // baseline: merge values with threshold colorcodes
            baselineThresholdValues.Add(baselineValues);

            Log.WriteLine("generate threshold evaluation on current run...");
            Intermediate currentThresholdValues = thresholds.GenerateThresholdValuesForTransactions(this.intermediate, Baselining.belowLowThreshold, "y", "r");

            // current testrun: merge values (this.intermediate) with threshold colorcodes
            currentThresholdValues.Add(this.intermediate);

            // Second, compare current run with baseline run:

            Log.WriteLine("generate baseline evaluation values...");
            Baselining   baselining         = new Baselining();
            Intermediate baselineEvaluation = baselining.GenerateBaselineEvaluationValues(currentThresholdValues, baselineThresholdValues, baselineValues, colorcodeBetter, colorcodeWorse);

            this.intermediate.Add(baselineEvaluation);
            Log.WriteLine("entries: " + baselineEvaluation.Count);

            // Third: generate aggregated metrics

            // Count baseline violations (add in separate series)
            Log.WriteLine("aggregate baseline warnings...");
            Intermediate baselineWarnings = baselineEvaluation.AggregateCount(BASELINEWARNINGSKEY, @"\d\d_.*_be_c", colorcodeWorse); // only evaluate script transactions!

            Log.WriteLine("adding baseline warnings: " + baselineWarnings.GetValue(BASELINEWARNINGSKEY));
            this.intermediate.Add(baselineWarnings);

            // store generated high-level stats
            if (storeMetrics)
            {
                // store baseline warning variables
                baselineWarnings.SaveToDatabase(this.project, this.testrun, Category.Transaction, Entity.None);

                // store calculated baseline reference chosen
                this.intermediate.SaveOneToDatabase(this.project, this.testrun, Category.Variable, Entity.Generic, BASELINEREFVARNAME);
            }
        }