# jmeter-user mailing list archives

##### Site index · List index
Message view
Top
Subject Re: Again about 90% line calculations
Date Thu, 07 Aug 2008 07:21:25 GMT
```Hi,

I looked into the code, and it seems that that graphs class is
org.apache.jmeter.visualizers.DistributionGraph.

It seems that in the end the 90% value is calculated by calling the
getPercentPoint(0.90) method of an instance of
org.apache.jorphan.math.StatCalculator class:

/**
* This class serves as a way to calculate the median of a list of values. It is
*/
public class StatCalculator implements Serializable {
List values = new ArrayList();

................

count++;
double currentVal = val.doubleValue();
sum += currentVal;
sumOfSquares += currentVal * currentVal;
mean = sum / count;
deviation = Math.sqrt((sumOfSquares / count) - (mean * mean));
}

/**
* @param val
*/
int index = Collections.binarySearch(values, val);
if (index >= 0 && index < values.size()) {
} else if (index == values.size() || values.size() == 0) {
} else {
values.add((index * (-1)) - 1, val);
}
}
..................

/**
* Get the value which %percent% of the values are less than. This works
* just like median (where median represents the 50% point). A typical
* desire is to see the 90% point - the value that 90% of the data points
* are below, the remaining 10% are above.
*
* @param percent
* @return number of values less than the percentage
*/
public Number getPercentPoint(float percent) {
if (count > 0) {
return (Number) values.get((int) (values.size() * percent));
}
return new Long(0);
}

.................

Long story short, the values passed to this class instance are cast to
Number and stored in the List sorted by their values.

If we have a List of N values, their indexes will be 0, 1 .... (N-1).

When the getPercentPoint(0.90) is called, float value (N * 0.9) is
cast to integer M so that "the fractional part of the floating point
number is truncated (not rounded)", and the element with index M is
returned.

For example, for a List with 155 values (indexed as 0, 1 ... 154)
float 155*0.9=139.5 cast to int will give us 139, and the value with
index 139 will be returned as "90%" value.

Regards,
Andrey

On Thu, Aug 7, 2008 at 1:24 AM, Oliver Erlewein (DSLWN)
<Oliver.Erlewein@datacom.co.nz> wrote:
> Hi,
>
> Some say that it is [0.9*len(values)]+1. I think the difference is probably not that
critical. What would be good to know is how JMeter itself arrives at the value.
>
> A good text on the subject's on Wikipedia. (http://en.wikipedia.org/wiki/Percentile)
>
> Regards
> Oliver
>
> -----Original Message-----
> From: Ronan Klyne [mailto:ronan.klyne@groupbc.com]
> Sent: Thursday, 7 August 2008 2:50 a.m.
> To: JMeter Users List
> Subject: Re: Again about 90% line calculations
>
> Andrew Melnyk wrote:
>> Hi gentleman,
>>
>> There were a lot of discussion about the meaning of 90% line property of
>> Aggregate graph.
>> I would like to know the exact formula which used to count this value.
>
> You get your values sorted in an array (called, say, 'values').
>
> The 90th percentile is then values[0.9*len(values)]
>
>
>        # r
>
> --
> Ronan Klyne
> Tel: +44 01189 028518
> ronan.klyne@groupbc.com
> www.groupbc.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

--
diem perdidi

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
{"ft_lang_label":"__label__en","ft_lang_prob":0.65607494,"math_prob":0.82636803,"size":3869,"snap":"2019-26-2019-30","text_gpt3_token_len":1014,"char_repetition_ratio":0.16170764,"word_repetition_ratio":0.043402776,"special_character_ratio":0.34892738,"punctuation_ratio":0.24704337,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9767115,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-07-20T21:07:30Z\",\"WARC-Record-ID\":\"<urn:uuid:c380edd2-02b6-4554-9ba4-7f1cc7d55c5a>\",\"Content-Length\":\"8035\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8880645b-3a41-4106-bd34-ad47d00cb298>\",\"WARC-Concurrent-To\":\"<urn:uuid:595ee3a6-9a99-4ca4-bfc4-6feaea98a2de>\",\"WARC-IP-Address\":\"207.244.88.142\",\"WARC-Target-URI\":\"http://mail-archives.apache.org/mod_mbox/jmeter-user/200808.mbox/%3C114417750808070021r2b3ce612l99ff2983fe6d4e1c@mail.gmail.com%3E\",\"WARC-Payload-Digest\":\"sha1:GM3XVQ2JBSFYD5S7GXYPWIZWTBQK2M35\",\"WARC-Block-Digest\":\"sha1:VGY7TL2PBUYKQAAD6IHTU7TEN3Y5V636\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-30/CC-MAIN-2019-30_segments_1563195526670.1_warc_CC-MAIN-20190720194009-20190720220009-00302.warc.gz\"}"}