java - why do we have to fix the duration for each measurement iteration? -


what timing iterations means ?

@measurement(iterations = 50, time = 2) 

should time of measurement fixed, if iteration of measurement takes longer 2 seconds, iteration stopped ? if true impact have on measurements.

the straightforward answer question is: "we have provide iteration time (or rely on default iteration time), because otherwise iteration never stop". depending on benchmark mode, meaning iteration time may different. example, javadoc says:

/**  * <p>throughput: operations per unit of time.</p>  *  * <p>runs continuously calling {@link benchmark} methods,  * counting total throughput on worker threads.   * mode time-based, , run until iteration  * time expires.</p>  */ throughput("thrpt", "throughput, ops/time"), 

there no way stop uncooperative execution in java, short of killing vm. (interrupting thread needs cooperation: there should check interruption). therefore, if @benchmark call takes longer requested iteration time, have no other option except waiting it.


Comments

Popular posts from this blog

How can we post XML strings along with text strings in iOS -

How to run C# code using mono without Xamarin in Android? -

c# - cefsharp app remember password option -