Add support for Poisson injector. Allows randomized load profiles.

This is a rewrite of #1987. Injection now runs for a fixed duration. As a consequence, the number of users can vary from run-to run, depending on the seed, but is deterministic for a given seed.

Also, some of the maths in the original PR was a little suspect, so I've switched to Lewis and Shedler's algorithm, which should be more accurate.
That's a bug in the auto-indent lib then :-(


On Tue, Jul 1, 2014 at 3:24 PM, James Pickering <notifications@github.com>
wrote:

> In
> gatling-core/src/main/scala/io/gatling/core/controller/inject/InjectionStep.scala:
>
> > + *
> > + * @param duration the length of time this injector should run for
> > + * @param startRate initial injection rate for users
> > + * @param endRate final injection rate for users
> > + * @param seed a seed for the randomization. If the same seed is re-used, the same timings will be obtained
> > + */
> > +case class PoissonInjection(duration: FiniteDuration, startRate: Double, endRate: Double, seed: Long = System.nanoTime) extends InjectionStep {
> > +  private val durationSecs = duration.toUnit(TimeUnit.SECONDS)
> > +  val users = chain(Iterator.empty).size
> > +
> > +  override def chain(chained: Iterator[FiniteDuration]): Iterator[FiniteDuration] = {
> > +    val rand = new Random(seed)
> > +
> > +    // Uses Lewis and Shedler's thinning algorithm: http://www.dtic.mil/dtic/tr/fulltext/u2/a059904.pdf
>
> > +    val maxLambda = startRate max endRate
> > +      def shouldKeep(d: Double) = {
>
> I know, right? Whenever I run sbt test some sort of auto-indenter moves
> shouldKeep two spaces to the right. I gave up fighting it, and figured it
> was probably part of some configured coding standard.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/excilys/gatling/pull/1990/files#r14402957>.
>