Felix Frank-2 wrote: > > On 01/05/2011 12:09 PM, zhouyuan wrote: >> >> Hi guys, >> >> I want to use a BeanShell Timer to get dynamical think time in >> transactions. >> Now I'm trying to use BeanShell PreProcessor and BeanShell PostProcessor >> in >> a transaction to get the start and end timestamp like the following: >> >> long time2; >> ${__time(,time2)}; >> ${__log(${time2},OUT)}; >> long response = Long.parseLong(${time2})-Long.parseLong(${time1}); >> long response1 = ${time2}-${time1}; >> ${__log(${response},OUT)}; >> ${__log(${response1},OUT)}; >> >> But it always logs an error like this: >> >> 2011/01/05 17:53:20 WARN - jmeter.extractor.BeanShellPostProcessor: P >> roblem in BeanShell script org.apache.jorphan.util.JMeterException: Error >> invoking bsh method: eval Parse error at line 2, column 1 : Error or >> number too big for integer type: 1294221200196 >> >> How could I defined the variables in long format or is there other ways >> to >> get transaction time and use it in a timer? > > I cannot really see where you're going with this, but I do note that you > are probably working with a milliseconds timestamp there. Try chopping > off the last three digits to convert it to a seconds timestamp. That > way, it should parse to a long just fine. > > Otherwise, doesn't Java have a "long long" type? Don't ask me how to > parse those, though. > > HTH, > Felix > > --------------------------------------------------------------------- > To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org > For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org > > >
No, I'm not trying to chopping off the last three digits, I just want to get the transaction time through subtracting the 2 timestamps...but i couldn't do any operations on time1 and time2 directly. It seems that the time1 and time2 are int variables by default? There are some extra lines just because I tried to debug this problem. Thanks, Yuan -- View this message in context: http://jmeter.512774.n5.nabble.com/How-to-get-transaction-time-into-a-user-defined-variable-tp3328587p3328614.html Sent from the JMeter - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org