Return-Path: X-Original-To: apmail-jmeter-dev-archive@minotaur.apache.org Delivered-To: apmail-jmeter-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A762F10794 for ; Sun, 28 Dec 2014 14:10:15 +0000 (UTC) Received: (qmail 14795 invoked by uid 500); 28 Dec 2014 14:10:15 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 14767 invoked by uid 500); 28 Dec 2014 14:10:15 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 14736 invoked by uid 99); 28 Dec 2014 14:10:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Dec 2014 14:10:13 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of philippe.mouawad@gmail.com designates 209.85.213.169 as permitted sender) Received: from [209.85.213.169] (HELO mail-ig0-f169.google.com) (209.85.213.169) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Dec 2014 14:09:46 +0000 Received: by mail-ig0-f169.google.com with SMTP id hl2so11486352igb.4 for ; Sun, 28 Dec 2014 06:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=kZQsNaOqEu6aNjIHBjwFDGfMtnF+dI8B6KmSZAdxpBU=; b=uN+7O6j66EzjZ5aXqlolQC9gleJ5ugApK21T7tw3B6ZyMZQBPFY/HNeb8Na8/V6KpY 82dPIrjOwM89S7jGNHTSmJHVDeRrdPK3UILMBphQdGr5ABnWlT/boRPBlXg4bCtIB7Pz 5XeXQ7061LR662/4bbwtlA8HS43Yiho2t1siJYkgMFteUh5zT8oj9NXpDCXGSsdxcWf3 yqlKlidJa4elRZqhtjVjRS7VRHoUS3f0J1u1G5OCe6UKwrasdUb6KLT2Tiz5WqvWGGDh cnsfJoxCAcfPH8A1bjL4LNYKmPRzfgbYOzm6QXwmHZJLFFoHWvO5r0+tyUZtRvZT61Xs GPtA== MIME-Version: 1.0 X-Received: by 10.107.130.30 with SMTP id e30mr45158913iod.87.1419775740123; Sun, 28 Dec 2014 06:09:00 -0800 (PST) Received: by 10.42.62.202 with HTTP; Sun, 28 Dec 2014 06:09:00 -0800 (PST) In-Reply-To: References: <20141228025524.B217CAC092E@hades.apache.org> Date: Sun, 28 Dec 2014 15:09:00 +0100 Message-ID: Subject: Re: svn commit: r1648146 - in /jmeter/trunk: src/core/org/apache/jmeter/reporters/Summariser.java src/core/org/apache/jmeter/reporters/SummariserRunningSample.java xdocs/changes.xml From: Philippe Mouawad To: "dev@jmeter.apache.org" Content-Type: multipart/alternative; boundary=001a113ece50a6a217050b474c5a X-Virus-Checked: Checked by ClamAV on apache.org --001a113ece50a6a217050b474c5a Content-Type: text/plain; charset=ISO-8859-1 Hi, I also think Summariser is not accurate anymore now . As you have analyzed it more deeply, would you mind updating it as per your new implementation details ? Thanks On Sun, Dec 28, 2014 at 3:03 PM, Philippe Mouawad < philippe.mouawad@gmail.com> wrote: > Hi sebb, > Nice you fixed it. > > Few notes: > - I have updated javadocs and removed index useless field > - Any reason for keeping AccumListener and RunningSample ? They do not > look to be used ? > > Regards > Philippe > > > On Sun, Dec 28, 2014 at 3:55 AM, wrote: > >> Author: sebb >> Date: Sun Dec 28 02:55:22 2014 >> New Revision: 1648146 >> >> URL: http://svn.apache.org/r1648146 >> Log: >> Summariser : The + (difference) reports show wrong elapsed time and >> throughput >> Bugzilla Id: 57346 >> >> Added: >> >> jmeter/trunk/src/core/org/apache/jmeter/reporters/SummariserRunningSample.java >> Modified: >> jmeter/trunk/src/core/org/apache/jmeter/reporters/Summariser.java >> jmeter/trunk/xdocs/changes.xml >> >> Modified: >> jmeter/trunk/src/core/org/apache/jmeter/reporters/Summariser.java >> URL: >> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/reporters/Summariser.java?rev=1648146&r1=1648145&r2=1648146&view=diff >> >> ============================================================================== >> --- jmeter/trunk/src/core/org/apache/jmeter/reporters/Summariser.java >> (original) >> +++ jmeter/trunk/src/core/org/apache/jmeter/reporters/Summariser.java Sun >> Dec 28 02:55:22 2014 >> @@ -35,7 +35,6 @@ import org.apache.jmeter.testelement.Tes >> import org.apache.jmeter.threads.JMeterContextService; >> import org.apache.jmeter.threads.JMeterContextService.ThreadCounts; >> import org.apache.jmeter.util.JMeterUtils; >> -import org.apache.jmeter.visualizers.RunningSample; >> import org.apache.jorphan.logging.LoggingManager; >> import org.apache.jorphan.util.JOrphanUtils; >> import org.apache.log.Logger; >> @@ -147,9 +146,9 @@ public class Summariser extends Abstract >> /** Time of last summary (to prevent double reporting) */ >> private long last = 0; >> >> - private final RunningSample delta = new RunningSample("DELTA",0); >> + private final SummariserRunningSample delta = new >> SummariserRunningSample("DELTA",0); >> >> - private final RunningSample total = new RunningSample("TOTAL",0); >> + private final SummariserRunningSample total = new >> SummariserRunningSample("TOTAL",0); >> >> /** >> * Add the delta values to the total values and clear the delta >> @@ -172,8 +171,8 @@ public class Summariser extends Abstract >> >> long now = System.currentTimeMillis() / 1000;// in seconds >> >> - RunningSample myDelta = null; >> - RunningSample myTotal = null; >> + SummariserRunningSample myDelta = null; >> + SummariserRunningSample myTotal = null; >> boolean reportNow = false; >> >> /* >> @@ -190,9 +189,9 @@ public class Summariser extends Abstract >> reportNow = true; >> >> // copy the data to minimise the synch time >> - myDelta = new RunningSample(myTotals.delta); >> + myDelta = new SummariserRunningSample(myTotals.delta); >> myTotals.moveDelta(); >> - myTotal = new RunningSample(myTotals.total); >> + myTotal = new SummariserRunningSample(myTotals.total); >> >> myTotals.last = now; // stop double-reporting >> } >> @@ -239,7 +238,7 @@ public class Summariser extends Abstract >> * @param string >> * @return the sunnary information >> */ >> - private static String format(String name, RunningSample s, String >> type) { >> + private static String format(String name, SummariserRunningSample s, >> String type) { >> DecimalFormat dfDouble = new DecimalFormat("#0.0"); // >> $NON-NLS-1$ >> StringBuilder tmp = new StringBuilder(20); // for intermediate >> use >> StringBuilder sb = new StringBuilder(100); // output line buffer >> @@ -369,6 +368,7 @@ public class Summariser extends Abstract >> String str; >> String name = entry.getKey(); >> Totals total = entry.getValue(); >> + total.delta.setEndTime(); // ensure delta has correct end >> time >> // Only print final delta if there were some samples in the >> delta >> // and there has been at least one sample reported previously >> if (total.delta.getNumSamples() > 0 && >> total.total.getNumSamples() > 0) { >> @@ -380,7 +380,7 @@ public class Summariser extends Abstract >> System.out.println(str); >> } >> } >> - total.moveDelta(); >> + total.moveDelta(); // This will update the total endTime >> str = format(name, total.total, "="); >> if (TOLOG) { >> log.info(str); >> >> Added: >> jmeter/trunk/src/core/org/apache/jmeter/reporters/SummariserRunningSample.java >> URL: >> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/reporters/SummariserRunningSample.java?rev=1648146&view=auto >> >> ============================================================================== >> --- >> jmeter/trunk/src/core/org/apache/jmeter/reporters/SummariserRunningSample.java >> (added) >> +++ >> jmeter/trunk/src/core/org/apache/jmeter/reporters/SummariserRunningSample.java >> Sun Dec 28 02:55:22 2014 >> @@ -0,0 +1,202 @@ >> +package org.apache.jmeter.reporters; >> + >> +import java.text.DecimalFormat; >> + >> +import org.apache.jmeter.samplers.SampleResult; >> + >> +class SummariserRunningSample { >> + >> + private final DecimalFormat errorFormatter = new >> DecimalFormat("#0.00%"); // $NON-NLS-1$ >> + >> + private long counter; >> + >> + private long runningSum; >> + >> + private long max; >> + >> + private long min; >> + >> + private long errorCount; >> + >> + private long startTime; >> + >> + private long endTime; >> + >> + private final String label; >> + >> + private final int index; >> + >> + public SummariserRunningSample(String label, int index) { >> + this.label = label; >> + this.index = index; >> + init(); >> + } >> + >> + /** >> + * Copy constructor >> + * @param src the instance to copy >> + */ >> + public SummariserRunningSample(SummariserRunningSample src) { >> + label = src.label; >> + index = src.index; >> + counter = src.counter; >> + errorCount = src.errorCount; >> + startTime = src.startTime; >> + endTime = src.endTime; >> + max = src.max; >> + min = src.min; >> + runningSum = src.runningSum; >> + } >> + >> + private void init() { >> + counter = 0L; >> + runningSum = 0L; >> + max = Long.MIN_VALUE; >> + min = Long.MAX_VALUE; >> + errorCount = 0L; >> + startTime = System.currentTimeMillis(); >> + endTime = startTime; >> + } >> + >> + public void clear() { >> + init(); >> + } >> + >> + public void addSample(SummariserRunningSample rs) { >> + counter += rs.counter; >> + errorCount += rs.errorCount; >> + runningSum += rs.runningSum; >> + if (max < rs.max) { >> + max = rs.max; >> + } >> + if (min > rs.min) { >> + min = rs.min; >> + } >> + // We want end time to be current time so sample rates reflect >> real time >> + endTime = System.currentTimeMillis(); >> + } >> + >> + public void addSample(SampleResult res) { >> + counter += res.getSampleCount(); >> + errorCount += res.getErrorCount(); >> + long aTimeInMillis = res.getTime(); >> + runningSum += aTimeInMillis; >> + if (aTimeInMillis > max) { >> + max = aTimeInMillis; >> + } >> + if (aTimeInMillis < min) { >> + min = aTimeInMillis; >> + } >> + // We want end time to be current time so sample rates reflect >> real time >> + endTime = System.currentTimeMillis(); >> + } >> + >> + /** >> + * Returns the number of samples that have been recorded by this >> instance of >> + * the RunningSample class. >> + * >> + * @return the number of samples that have been recorded by this >> instance of >> + * the RunningSample class. >> + */ >> + public long getNumSamples() { >> + return counter; >> + } >> + >> + /** >> + * Get the elapsed time for the samples >> + * >> + * @return how long the samples took >> + */ >> + public long getElapsed() { >> + if (counter == 0) { >> + return 0;// No samples collected ... >> + } >> + return endTime - startTime; >> + } >> + >> + /** >> + * Returns the throughput associated to this sampler in requests per >> second. >> + */ >> + public double getRate() { >> + if (counter == 0) { >> + return 0.0;// No samples collected ... >> + } >> + >> + long howLongRunning = endTime - startTime; >> + >> + if (howLongRunning == 0) { >> + return Double.MAX_VALUE; >> + } >> + >> + return (double) counter / howLongRunning * 1000.0; >> + } >> + >> + /** >> + * Returns the average time in milliseconds that samples ran in. >> + * >> + * @return the average time in milliseconds that samples ran in. >> + */ >> + public long getAverage() { >> + if (counter == 0) { >> + return 0; >> + } >> + return runningSum / counter; >> + } >> + >> + /** >> + * @return errorCount >> + */ >> + public long getErrorCount() { >> + return errorCount; >> + } >> + >> + /** >> + * Returns a String which represents the percentage of sample errors >> that >> + * have occurred. ("0.00%" through "100.00%") >> + * >> + * @return a String which represents the percentage of sample errors >> that >> + * have occurred. >> + */ >> + public String getErrorPercentageString() { >> + return errorFormatter.format(getErrorPercentage()); >> + } >> + >> + /** >> + * Returns the raw double value of the percentage of samples with >> errors >> + * that were recorded. (Between 0.0 and 1.0) If you want a nicer >> return >> + * format, see {@link #getErrorPercentageString()}. >> + * >> + * @return the raw double value of the percentage of samples with >> errors >> + * that were recorded. Returns 0.0 if there are no samples >> + */ >> + public double getErrorPercentage() { >> + if (counter == 0) { >> + return 0.0; >> + } >> + double rval = (double) errorCount / (double) counter; >> + return rval; >> + } >> + >> + /** >> + * Returns the time in milliseconds of the slowest sample. >> + * >> + * @return the time in milliseconds of the slowest sample. >> + */ >> + public long getMax() { >> + return max; >> + } >> + >> + /** >> + * Returns the time in milliseconds of the quickest sample. >> + * >> + * @return the time in milliseconds of the quickest sample. >> + */ >> + public long getMin() { >> + return min; >> + } >> + >> + public void setEndTime() { >> + endTime = System.currentTimeMillis(); >> + } >> + >> +} >> >> Modified: jmeter/trunk/xdocs/changes.xml >> URL: >> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1648146&r1=1648145&r2=1648146&view=diff >> >> ============================================================================== >> --- jmeter/trunk/xdocs/changes.xml (original) >> +++ jmeter/trunk/xdocs/changes.xml Sun Dec 28 02:55:22 2014 >> @@ -154,6 +154,7 @@ See 56357 for deta >>

Listeners

>>
    >>
  • 57262Aggregate Report, Aggregate Graph and Summary Report >> export : headers use keys instead of labels
  • >> +
  • 57346Summariser : The + (difference) reports show wrong >> elapsed time and throughput
  • >>
>> >>

Timers, Assertions, Config, Pre- & Post-Processors

>> >> >> > > > -- > Cordialement. > Philippe Mouawad. > > > -- Cordialement. Philippe Mouawad. --001a113ece50a6a217050b474c5a--