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
 * not threadsafe.
 */
public class StatCalculator implements Serializable {
        List values = new ArrayList();

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

        public void addValue(Number val) {
                addSortedValue(val);
                count++;
                double currentVal = val.doubleValue();
                sum += currentVal;
                sumOfSquares += currentVal * currentVal;
                mean = sum / count;
                deviation = Math.sqrt((sumOfSquares / count) - (mean * mean));
        }

        /**
         * @param val
         */
        private void addSortedValue(Number val) {
                int index = Collections.binarySearch(values, val);
                if (index >= 0 && index < values.size()) {
                        values.add(index, val);
                } else if (index == values.size() || values.size() == 0) {
                        values.add(val);
                } 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)
<[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
> 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
> Business Collaborator Developer
> Tel: +44 01189 028518
> [EMAIL PROTECTED]
> www.groupbc.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
diem perdidi

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to