Example #1
0
 protected internal override void processResults(PerfTestResults results, TabularResultSet tabularResultSet)
 {
     foreach (PerfTestResult passResult in results.PassResults)
     {
         tabularResultSet.Results.Add(processRow(passResult, results));
     }
 }
Example #2
0
        public static void Main(string[] args)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String resultsFolder = "target"+java.io.File.separatorChar+"results";
            string resultsFolder = "target" + Path.DirectorySeparatorChar + "results";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String reportsFolder = "target"+java.io.File.separatorChar+"reports";
            string reportsFolder = "target" + Path.DirectorySeparatorChar + "reports";

            string longTermBenchmarkResultFilename = System.getProperty("longTermBenchmarkResultFile");

            if (!string.ReferenceEquals(longTermBenchmarkResultFilename, null))
            {
                File longTermBenchmarkResultFile = new File(longTermBenchmarkResultFilename);
                longTermBenchmarkResultFile.ParentFile.mkdirs();
                if (longTermBenchmarkResultFile.exists())
                {
                    // Do nothing, append current results later
                }
                else
                {
                    FileUtil.appendStringToFile("name;" + "number of runs;" + "database;" + "history level;" + "starttime;" + "platform;" + "number of threads;" + "duration;" + "throughput", longTermBenchmarkResultFilename);
                }
                TabularResultSet longTermResultTable = (new BenchmarkLongtermAggregator(resultsFolder)).execute();
                FileUtil.appendStringToFile(CsvUtil.resultSetAsCsv(longTermResultTable), longTermBenchmarkResultFilename);
            }

            writeReport(resultsFolder, reportsFolder, "benchmark", new BenchmarkAggregator(resultsFolder), "Benchmark Duration Report");
        }
Example #3
0
        private static string resultSetAsCsv(TabularResultSet resultSet, bool writeHeadline)
        {
            StringBuilder builder = new StringBuilder();

            if (writeHeadline)
            {
                // write headline
                IList <string> resultColumnNames = resultSet.ResultColumnNames;
                for (int i = 0; i < resultColumnNames.Count; i++)
                {
                    builder.Append(resultColumnNames[i]);
                    builder.Append(";");
                }
                builder.Append("\n");
            }

            // write results
            IList <IList <object> > results = resultSet.Results;

            foreach (IList <object> row in results)
            {
                foreach (object @object in row)
                {
                    builder.Append(@object.ToString());
                    builder.Append(";");
                }
                builder.Append("\n");
            }

            return(builder.ToString());
        }
Example #4
0
        protected internal virtual TabularResultSet processPassResult(IList <string> watchActivities, PerfTestResult passResult)
        {
            TabularResultSet tabularResultSet = new TabularResultSet();

            addTableHeaders(tabularResultSet, watchActivities);
            addTableBody(tabularResultSet, watchActivities, passResult);
            return(tabularResultSet);
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") protected void processResults(org.camunda.bpm.qa.performance.engine.framework.PerfTestResults results, org.camunda.bpm.qa.performance.engine.framework.aggregate.TabularResultSet tabularResultSet)
        protected internal override void processResults(PerfTestResults results, TabularResultSet tabularResultSet)
        {
            List <object> row = new List <object>();

            row.Add(results.TestName);

            int insertCount = 0;
            int deleteCount = 0;
            int updateCount = 0;
            int selectCount = 0;

            if (results.PassResults.Count == 0)
            {
                return;
            }

            IList <PerfTestStepResult> stepResults = results.PassResults[0].StepResults;

            foreach (PerfTestStepResult stepResult in stepResults)
            {
                IList <LinkedHashMap <string, string> > statementLogs = (IList <LinkedHashMap <string, string> >)stepResult.ResultData;
                foreach (LinkedHashMap <string, string> statementLog in statementLogs)
                {
                    string           type          = statementLog.get("statementType");
                    SqlStatementType statementType = Enum.Parse(typeof(SqlStatementType), type);

                    switch (statementType)
                    {
                    case SqlStatementType.DELETE:
                        deleteCount++;
                        break;

                    case SqlStatementType.INSERT:
                        insertCount++;
                        break;

                    case SqlStatementType.UPDATE:
                        updateCount++;
                        break;

                    default:
                        selectCount++;
                        break;
                    }
                }
            }

            row.Add(insertCount);
            row.Add(deleteCount);
            row.Add(updateCount);
            row.Add(selectCount);

            tabularResultSet.addResultRow(row);
        }
Example #6
0
        protected internal override void processResults(PerfTestResults results, TabularResultSet tabularResultSet)
        {
            PerfTestConfiguration configuration   = results.Configuration;
            IList <string>        watchActivities = configuration.WatchActivities;

            foreach (PerfTestResult passResult in results.PassResults)
            {
                string           passTitle = getPassTitle(results.TestName, configuration, passResult);
                TabularResultSet result    = processPassResult(watchActivities, passResult);
                htmlBuilder.addSection(passTitle, result);
            }
        }
Example #7
0
        protected internal override void processResults(PerfTestResults results, TabularResultSet tabularResultSet)
        {
            IList <object> row = new List <object>();

            row.Add(results.TestName);

            foreach (PerfTestResult passResult in results.PassResults)
            {
                processRow(row, passResult, results);
            }

            tabularResultSet.Results.Add(row);
        }
Example #8
0
        protected internal override TabularResultSet createAggregatedResultsInstance()
        {
            TabularResultSet tabularResultSet = new TabularResultSet();

            IList <string> resultColumnNames = tabularResultSet.ResultColumnNames;

            resultColumnNames.Add(TEST_NAME);
            resultColumnNames.Add(INSERTS);
            resultColumnNames.Add(DELETES);
            resultColumnNames.Add(UPDATES);
            resultColumnNames.Add(SELECTS);

            return(tabularResultSet);
        }
Example #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") protected void addHtmlSection(org.camunda.bpm.engine.impl.form.engine.HtmlDocumentBuilder builder, String title, Object section, int level)
        protected internal virtual void addHtmlSection(HtmlDocumentBuilder builder, string title, object section, int level)
        {
            // add heading
            builder.startElement((new HtmlElementWriter("h" + level)).textContent(title)).endElement();
            if (section is System.Collections.IDictionary)
            {
                IDictionary <string, object> sections = (IDictionary <string, object>)section;
                addHtmlSections(builder, sections, level + 1);
            }
            else
            {
                TabularResultSet resultSet = (TabularResultSet)section;
                addHtmlTable(builder, resultSet);
            }
        }
Example #10
0
        protected internal virtual void addHtmlTable(HtmlDocumentBuilder builder, TabularResultSet resultSet)
        {
            /// <summary>
            /// <table> </summary>
            builder.startElement((new HtmlElementWriter("table")).attribute("class", "table table-condensed table-hover table-bordered"));

            /// <summary>
            /// <tr> </summary>

            HtmlDocumentBuilder tableHeadRowBuilder = builder.startElement(new HtmlElementWriter("tr"));

            foreach (string columnName in resultSet.ResultColumnNames)
            {
                tableHeadRowBuilder.startElement((new HtmlElementWriter("th")).textContent(columnName)).endElement();
            }

            /// <summary>
            /// </tr> </summary>
            tableHeadRowBuilder.endElement();

            foreach (IList <object> resultRow in resultSet.Results)
            {
                /// <summary>
                /// <tr> </summary>
                HtmlDocumentBuilder tableRowBuilder = builder.startElement(new HtmlElementWriter("tr"));

                foreach (object value in resultRow)
                {
                    if (value is TableCell)
                    {
                        tableRowBuilder.startElement(((TableCell)value).toHtmlElementWriter()).endElement();
                    }
                    else
                    {
                        tableRowBuilder.startElement((new HtmlElementWriter("td")).textContent(value.ToString())).endElement();
                    }
                }

                /// <summary>
                /// </tr> </summary>
                tableRowBuilder.endElement();
            }

            /// <summary>
            /// </table> </summary>
            builder.endElement();
        }
Example #11
0
        public static void Main(string[] args)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String resultsFolder = "target"+java.io.File.separatorChar+"results";
            string resultsFolder = "target" + Path.DirectorySeparatorChar + "results";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String reportsFolder = "target"+java.io.File.separatorChar+"reports";
            string reportsFolder = "target" + Path.DirectorySeparatorChar + "reports";

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String htmlReportFilename = reportsFolder + java.io.File.separatorChar + "sql-statement-log-report.html";
            string htmlReportFilename = reportsFolder + Path.DirectorySeparatorChar + "sql-statement-log-report.html";

            const string jsonReportFilename = "sql-statement-log-report.json";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String jsonReportPath = reportsFolder + java.io.File.separatorChar + jsonReportFilename;
            string jsonReportPath = reportsFolder + Path.DirectorySeparatorChar + jsonReportFilename;

            const string csvReportFilename = "sql-statement-log-report.csv";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String csvReportPath = reportsFolder + java.io.File.separatorChar + csvReportFilename;
            string csvReportPath = reportsFolder + Path.DirectorySeparatorChar + csvReportFilename;

            // make sure reports folder exists
            File reportsFolderFile = new File(reportsFolder);

            if (!reportsFolderFile.exists())
            {
                reportsFolderFile.mkdir();
            }

            SqlStatementCountAggregator aggregator        = new SqlStatementCountAggregator(resultsFolder);
            TabularResultSet            aggregatedResults = aggregator.execute();

            // write Json report
            JsonUtil.writeObjectToFile(jsonReportPath, aggregatedResults);
            // write CSV Report
            CsvUtil.saveResultSetToFile(csvReportPath, aggregatedResults);

            // format HTML report
            HtmlReportBuilder reportWriter = (new HtmlReportBuilder(aggregatedResults)).name("Sql Statement Log Report").resultDetailsFolder(".." + Path.DirectorySeparatorChar + "results" + Path.DirectorySeparatorChar).createImageLinks(true).jsonSource(jsonReportFilename).csvSource(csvReportFilename);

            string report = reportWriter.execute();

            FileUtil.writeStringToFile(report, htmlReportFilename);
        }
Example #12
0
        private static void writeReport(string resultsFolder, string reportsFolder, string benchmarkName, TabularResultAggregator aggregator, string reportDescription)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String htmlReportFilename = reportsFolder + java.io.File.separatorChar + benchmarkName+"-report.html";
            string htmlReportFilename = reportsFolder + Path.DirectorySeparatorChar + benchmarkName + "-report.html";

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String jsonReportFilename = benchmarkName+"-report.json";
            string jsonReportFilename = benchmarkName + "-report.json";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String jsonReportPath = reportsFolder + java.io.File.separatorChar + jsonReportFilename;
            string jsonReportPath = reportsFolder + Path.DirectorySeparatorChar + jsonReportFilename;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String csvReportFilename = benchmarkName+"-report.csv";
            string csvReportFilename = benchmarkName + "-report.csv";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String csvReportPath = reportsFolder + java.io.File.separatorChar + csvReportFilename;
            string csvReportPath = reportsFolder + Path.DirectorySeparatorChar + csvReportFilename;

            // make sure reports folder exists
            File reportsFolderFile = new File(reportsFolder);

            if (!reportsFolderFile.exists())
            {
                reportsFolderFile.mkdir();
            }

            TabularResultSet aggregatedResults = aggregator.execute();

            // write Json report
            JsonUtil.writeObjectToFile(jsonReportPath, aggregatedResults);

            // format HTML report
            HtmlReportBuilder reportWriter = (new HtmlReportBuilder(aggregatedResults)).name(reportDescription).resultDetailsFolder(".." + Path.DirectorySeparatorChar + "results" + Path.DirectorySeparatorChar).createImageLinks(true).jsonSource(jsonReportFilename).csvSource(csvReportFilename);

            string report = reportWriter.execute();

            FileUtil.writeStringToFile(report, htmlReportFilename);

            // write CSV report
            CsvUtil.saveResultSetToFile(csvReportPath, aggregatedResults);
        }
Example #13
0
        protected internal virtual void addTableHeaders(TabularResultSet tabularResultSet, IList <string> watchActivities)
        {
            IList <object> row1 = new List <object>();
            IList <object> row2 = new List <object>();

            row1.Add(new SectionedHtmlReportBuilder.TableCell("", true));
            row2.Add(new SectionedHtmlReportBuilder.TableCell("seconds", true));
            foreach (string activity in watchActivities)
            {
                row1.Add(new SectionedHtmlReportBuilder.TableCell(activity, 5, true));
                row2.Add(new SectionedHtmlReportBuilder.TableCell("started", true));
                row2.Add(new SectionedHtmlReportBuilder.TableCell("&sum; started", true));
                row2.Add(new SectionedHtmlReportBuilder.TableCell("ended", true));
                row2.Add(new SectionedHtmlReportBuilder.TableCell("&sum; ended", true));
                row2.Add(new SectionedHtmlReportBuilder.TableCell("&Oslash; duration", true));
            }

            row1.Add(new SectionedHtmlReportBuilder.TableCell("", 2, true));
            row2.Add(new SectionedHtmlReportBuilder.TableCell("act/s", true));
            row2.Add(new SectionedHtmlReportBuilder.TableCell("&Oslash; act/s", true));

            tabularResultSet.addResultRow(row1);
            tabularResultSet.addResultRow(row2);
        }
Example #14
0
        protected internal override void postProcessResultSet(TabularResultSet tabularResultSet)
        {
            if (tabularResultSet.Results.Count > 0)
            {
                int columnSize = tabularResultSet.Results[0].Count;

                List <string> columnNames = new List <string>();
                columnNames.Add(TEST_NAME);
                for (int i = 1; i < columnSize; i++)
                {
                    if ((i - 1) % 3 == 0)
                    {
                        int numberOfThreads = (i / 3) + 1;
                        columnNames.Add("T = " + numberOfThreads);
                    }
                    else
                    {
                        columnNames.Add(" ");
                    }
                }

                tabularResultSet.ResultColumnNames = columnNames;
            }
        }
Example #15
0
 public static void saveResultSetToFile(string fileName, TabularResultSet resultSet)
 {
     FileUtil.writeStringToFile(resultSetAsCsv(resultSet), fileName);
 }
Example #16
0
        protected internal virtual void addTableBody(TabularResultSet tabularResultSet, IList <string> watchActivities, PerfTestResult passResult)
        {
            // get first and last timestamp
            DateTime firstStartTime = null;
            DateTime lastEndTime    = null;

            foreach (IList <ActivityPerfTestResult> activityResults in passResult.ActivityResults.Values)
            {
                foreach (ActivityPerfTestResult activityResult in activityResults)
                {
                    if (firstStartTime == null || activityResult.StartTime < firstStartTime)
                    {
                        firstStartTime = activityResult.StartTime;
                    }

                    if (lastEndTime == null || activityResult.EndTime > lastEndTime)
                    {
                        lastEndTime = activityResult.EndTime;
                    }
                }
            }

            long firstTimestamp = firstStartTime.Ticks;
            long lastTimestamp  = lastEndTime.Ticks;
            IList <IDictionary <string, ActivityCount> > resultTable = new List <IDictionary <string, ActivityCount> >();

            for (long t = firstTimestamp; t <= lastTimestamp + INTERVAL; t += INTERVAL)
            {
                IDictionary <string, ActivityCount> activitiesMap = new Dictionary <string, ActivityCount>();
                foreach (string activity in watchActivities)
                {
                    activitiesMap[activity] = new ActivityCount(this);
                }
                resultTable.Add(activitiesMap);
            }


            foreach (IList <ActivityPerfTestResult> activityResults in passResult.ActivityResults.Values)
            {
                foreach (ActivityPerfTestResult activityResult in activityResults)
                {
                    string activityId = activityResult.ActivityId;
                    int    startSlot  = calculateTimeSlot(activityResult.StartTime, firstTimestamp);
                    int    endSlot    = calculateTimeSlot(activityResult.EndTime, firstTimestamp);
                    resultTable[startSlot][activityId].incrementStarted();
                    resultTable[endSlot][activityId].incrementEnded();
                    resultTable[endSlot][activityId].addDuration(activityResult.Duration);
                }
            }

            List <object> row = null;
            IDictionary <string, ActivityCount> sumMap = new Dictionary <string, ActivityCount>();

            foreach (string activity in watchActivities)
            {
                sumMap[activity] = new ActivityCount(this);
            }

            long sumActivitiesEnded = 0;

            for (int i = 0; i < resultTable.Count; i++)
            {
                row = new List <object>();
                row.Add(i * INTERVAL / TIME_UNIT);
                long currentActivitiesEnded = 0;
                foreach (string activity in watchActivities)
                {
                    sumMap[activity].addStarted(resultTable[i][activity].Started);
                    sumMap[activity].addEnded(resultTable[i][activity].Ended);
                    sumMap[activity].addDuration(resultTable[i][activity].Duration);
                    currentActivitiesEnded += resultTable[i][activity].Ended;
                }
                foreach (string activity in watchActivities)
                {
                    long   started       = resultTable[i][activity].Started;
                    long   ended         = resultTable[i][activity].Ended;
                    double endedFraction = 0;
                    long   avgDuration   = 0;

                    if (sumMap[activity].Ended > 0)
                    {
                        avgDuration = sumMap[activity].Duration / sumMap[activity].Ended;
                    }

                    if (currentActivitiesEnded > 0)
                    {
                        endedFraction = ended * 100.0 / currentActivitiesEnded;
                    }

                    row.Add(started);
                    row.Add(sumMap[activity].Started);
                    row.Add(string.Format("{0:D} ({1:F1}%)", ended, endedFraction));
                    row.Add(sumMap[activity].Ended);
                    row.Add(avgDuration + " ms");
                }
                sumActivitiesEnded += currentActivitiesEnded;
                row.Add(currentActivitiesEnded / INTERVAL_SECONDS);
                row.Add(sumActivitiesEnded / ((i + 1) * INTERVAL_SECONDS));
                tabularResultSet.addResultRow(row);
            }
        }
Example #17
0
 public static string resultSetAsCsv(TabularResultSet resultSet)
 {
     return(resultSetAsCsv(resultSet, true));
 }
Example #18
0
 public HtmlReportBuilder(TabularResultSet resultSet)
 {
     this.resultSet = resultSet;
 }
Example #19
0
 public static string resultSetAsCsvLine(TabularResultSet resultSet)
 {
     return(resultSetAsCsv(resultSet, false));
 }