Possible bug in StatisticsIndexMap - Grinder 3.7.1

田鸠 <[email protected]> Thu, 15 Mar 2012 03:16:50 +0000
Newsgroups gmane.comp.java.grinder.devel
Message-ID <[email protected]>
Hi Philip,

As I explore the user defined statistics for Grinder, I found some problem. The “userLong4” value is not set correctly in the test.

Here is the script and the data output. userLong4 has the same value as Test Time instead of 1004. After some investigation, I think the problem is with StatisticsIndexMap. When initialize the longIndexMap, it uses prefix of ++, which leaves out the index 0; but afterwards, when creating the sampleIndex, it uses postfix of ++ which causes index collision: timedTests.sum overwrites the index of userLong4.

for (String longName : longNames) {
m_longMap.put(longName, new LongIndex(++nextLongIndex));
}

createLongSampleIndex("timedTests",
                          new LongIndex(nextLongIndex++), //collision occurs
                          new LongIndex(nextLongIndex++),
                          new DoubleIndex(nextDoubleIndex++));

from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest

test1 = Test(1, "Request resource")
request1 = test1.wrap(HTTPRequest())

grinder.statistics.registerDataLogExpression("userLong0", "userLong0");
grinder.statistics.registerDataLogExpression("userLong1", "userLong1");
grinder.statistics.registerDataLogExpression("userLong2", "userLong2");
grinder.statistics.registerDataLogExpression("userLong3", "userLong3");
grinder.statistics.registerDataLogExpression("userLong4", "userLong4");

class TestRunner:
    def __call__(self):
        grinder.statistics.delayReports = 1
        request1.GET("http://www.taobao.ali.com/tbhome/")
        runNumber = grinder.getRunNumber()
        if(0 == (runNumber % 3)):
            grinder.statistics.forLastTest.success = 0
        grinder.statistics.forLastTest.setLong("userLong0",1000)
        grinder.statistics.forLastTest.setLong("userLong1",1001)
        grinder.statistics.forLastTest.setLong("userLong2",1002)
        grinder.statistics.forLastTest.setLong("userLong3",1003)
        grinder.statistics.forLastTest.setLong("userLong4",1004)
        grinder.statistics.report()
        grinder.statistics.delayReports = 0

Thread, Run, Test, Start time (ms since Epoch), Test time, Errors, HTTP response code, HTTP response length, HTTP response errors, Time to resolve host, Time to establish connection, Time to first byte, userLong0, userLong1, userLong2, userLong3, userLong4
0, 0, 1, 1331713365908, 30, 1, 401, 1327, 1, 3, 6, 22, 10000, 10001, 10002, 10003, 30
0, 1, 1, 1331713365941, 3, 0, 401, 1327, 1, 0, 1, 3, 10000, 10001, 10002, 10003, 3
0, 2, 1, 1331713365945, 2, 0, 401, 1327, 1, 0, 1, 2, 10000, 10001, 10002, 10003, 2

……

Thanks,
Fei

发件人: Philip Aston [mailto:[email protected]] 代表 Philip Aston
发送时间: 2012年2月12日 20:26
收件人: 田鸠
抄送: [email protected]
主题: Re: 答复: [Grinder-use] 3.7.1 - problem with TCPProxy - Recorded scripts contains unwanted logback log

On 10/02/12 01:35, 田鸠 wrote:
Thanks Philip. That solves my problem. Originally, I was appending all jar files in the grinder lib directory to CLASSPATH. It looks like below. I’ve been using Grinder 3 since its beta releases and am a big fan of it. I have another question though, now Grinder has multiple projects and multiple jar packages in the lib, to start agent/console/tcpproxy, do I only need to include grinder.jar in the CLASSPATH? I used to append all jars to CLASSPATH when I start them in previous versions. If this is true, how does Grinder resolve classes in other packages?

Yes, you only need to refer to grinder.jar.

It can locate the other jars because they are referenced in its MANIFEST.MF.

- Phil


________________________________

This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.

本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure

_______________________________________________
Grinder-development mailing list
Grinder-development-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/grinder-development