Iterate over the k range.

@param prefix Prefix string
@param mink Minimum value of k for this method
@param maxk Maximum value of k for this method
@param runner Runner to run
@param out Output function
964765
private void runForEachK(String prefix, int mink, int maxk, IntFunction<OutlierResult> runner, BiConsumer<String, OutlierResult> out) {
    if(isDisabled(prefix)) {
      LOG.verbose("Skipping (disabled): " + prefix);
      return; // Disabled
    }
    LOG.verbose("Running " + prefix);
    final int digits = (int) FastMath.ceil(FastMath.log10(krange.getMax() + 1));
    final String format = "%s-%0" + digits + "d";
    krange.forEach(k -> {
      if(k >= mink && k <= maxk) {
        Duration time = LOG.newDuration(this.getClass().getCanonicalName() + "." + prefix + ".k" + k + ".runtime").begin();
        OutlierResult result = runner.apply(k);
        LOG.statistics(time.end());
        if(result != null) {
          out.accept(String.format(Locale.ROOT, format, prefix, k), result);
          result.getHierarchy().removeSubtree(result);
        }
      }
    });
  }
488100
public void run(String... args) {
        int maxIteration = 10;
        int totalMoreFast = 0;
        int totalMoreFastWithThreadPool = 0;
        int totalMoreFastPacketThreadPool = 0;
        for (int i = 0; i < maxIteration; i++) {
            LOGGER.info("**********************************");
            long jxnetRunnerRes = jxnetRunner.run();
            long jxnetWithThreadPoolRunnerRes = jxnetWithThreadPoolRunner.run();
            long jxnetPacketThreadPoolRunnerRes = springJxnetWithThreadPoolRunner.run();
            long pcap4jRunnerRes = pcap4jRunner.run();
            long pcap4jWithThreadPoolRunnerRes = pcap4jWithThreadPoolRunner.run();
            long pcap4jPacketThreadPoolRunnerRes = pcap4jPacketWithThreadPoolRunner.run();
            LOGGER.info("Jxnet x Pcap4j");
            boolean moreFast = jxnetRunnerRes < pcap4jRunnerRes;
            boolean moreFastWithThreadPool = jxnetWithThreadPoolRunnerRes < pcap4jWithThreadPoolRunnerRes;
            boolean moreFastPacketThreadPool = jxnetPacketThreadPoolRunnerRes < pcap4jPacketThreadPoolRunnerRes;
            if (moreFast) {
                totalMoreFast++;
            }
            if (moreFastWithThreadPool) {
                totalMoreFastWithThreadPool++;
            }
            if (moreFastPacketThreadPool) {
                totalMoreFastPacketThreadPool++;
            }
            LOGGER.info("Is Jxnet runner more fast? {} : {}",
                     moreFast ? "YES" : "NO",
                    jxnetRunnerRes + " and " + pcap4jRunnerRes);
            LOGGER.info("Is Jxnet with thread pool runner more fast? {} : {}",
                    moreFastWithThreadPool ? "YES" : "NO",
                    jxnetWithThreadPoolRunnerRes + " and " + pcap4jWithThreadPoolRunnerRes);
            LOGGER.info("IS Jxnet packet with thread pool runner more fast? {} : {}",
                    moreFastPacketThreadPool ? "YES" : "NO",
                    jxnetPacketThreadPoolRunnerRes + " and " + pcap4jPacketThreadPoolRunnerRes);
            LOGGER.info("**********************************\n");
        }
        LOGGER.info("Total jxnet more fast                                 : {}/{}", totalMoreFast, maxIteration);
        LOGGER.info("Total jxnet more fast with thread pool                : {}/{}", totalMoreFastWithThreadPool, maxIteration);
        LOGGER.info("Total jxnet more fast packet decoder with thread pool : {}/{}", totalMoreFastPacketThreadPool, maxIteration);
        executorService.shutdownNow();
    }
890584
@Override
	protected void onFirstOutput() throws IOException
	{
		if(prefix != null && prefix.length() > 0)
		{
			print(prefix);
			prefix = null;	// no need to keep a ref
		}
	}
62475
public static void main(String[] args) throws RunnerException {

    for (String benchmark : benchmarks.keySet()) {
      String[] parts = benchmark.split("-");
      Options opt = new OptionsBuilder()
          .include(ArrayListBenchmark.class.getSimpleName())

          // Warmup, and then run test iterations
          .warmupIterations(2).measurementIterations(5)

          // Each iteration call the test repeatedly for ~60 seconds
          .mode(Mode.AverageTime)
          .warmupTime(TimeValue.seconds(10))
          .measurementTime(TimeValue.seconds(60))

          // The size of the list
          .param("size", "80000000", "20000000", "5000000")
          .param("list", parts[0])
          .param("type", parts[1])

          .forks(1).jvmArgs("-Xmx16g")
          //.addProfiler(MemoryProfiler.class)
          //.addProfiler(StackProfiler.class)
          //.addProfiler(GCProfiler.class)

          .build();

      new Runner(opt).run();
    }
  }
403008
public void setMinMax(int min, int max)
    {
        if(min >= max)
            throw new IllegalArgumentException("The input minimum (" + min + ") must be less than the given max (" + max  + ")");
        this.min = min;
        this.max = max;
    }
823453
protected void ensureCapacity(int minNbRuns) {
    final int minCapacity = 2 * minNbRuns;
    if (valueslength.capacity() < minCapacity) {
      int newCapacity = valueslength.capacity();
      while (newCapacity < minCapacity) {
        newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE
            : newCapacity < 64 ? newCapacity * 2
                : newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4;
      }
      final ShortBuffer nv = ShortBuffer.allocate(newCapacity);
      valueslength.rewind();
      nv.put(valueslength);
      valueslength = nv;
    }
  }
180036
public void encode(DerOutputStream out) throws IOException {
        DerOutputStream seq = new DerOutputStream();

        name.encode(seq);

        if (minimum != MIN_DEFAULT) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putInteger(minimum);
            seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
                              false, TAG_MIN), tmp);
        }
        if (maximum != -1) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putInteger(maximum);
            seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
                              false, TAG_MAX), tmp);
        }
        out.write(DerValue.tag_Sequence, seq);
    }
728357
@Override
	public void setX(double min, double max) {
		if (min <= max) {
			this.minx = min;
			this.maxx = max;
		} else {
			this.minx = max;
			this.maxx = min;
		}
	}
763910
private boolean toBoundedNext() throws FetchException {
        if (!toNext()) {
            return false;
        }

        if (mEndBound != null) {
            byte[] currentKey = getCurrentKey();
            if (currentKey == null) {
                return false;
            }
            int result = compareKeysPartially(currentKey, mEndBound);
            if (result >= 0) {
                if (result > 0 || !mInclusiveEnd) {
                    return false;
                }
            }
        }

        return prefixMatches();
    }
977140
@Override
    public void run(Context context) throws IOException, InterruptedException {
        outer = context;
        int numberOfThreads = getThreadCount(context);
        mapClass = getMapperClass(context);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Running with " + numberOfThreads + " threads");
        }        
        // current mapper takes 1 thread
        numberOfThreads--;
        
        InputSplit split = context.getInputSplit();

        // submit runners
        try {
	        List<Future<?>> taskList = null;
	        if (threadPool != null) {
            	taskList = new ArrayList<Future<?>>();
                synchronized (threadPool) {
                    for (int i = 0; i < numberOfThreads; ++i) {
                        MapRunner runner = new MapRunner();
                        BaseMapper<K1,V1,K2,V2> mapper = runner.getMapper();
                        if (!threadPool.isShutdown()) {
                            Collection<Future<Object>> tasks = 
                                mapper.submitTasks(threadPool, split);
                            taskList.addAll(tasks);
                            numberOfThreads -= tasks.size();
                            Future<?> future = threadPool.submit(runner);
                            taskList.add(future);	                        
                        } else {
                            throw new InterruptedException(
                                "Thread Pool has been shut down");
                        }
                    }
                    threadPool.notify();
                }
	            
                // MapRunner that runs in current thread
                MapRunner r = new MapRunner();
                r.run();
    
                for (Future<?> f : taskList) {
                    f.get();
                }
	        } else {
	            runners = new ArrayList<MapRunner>(numberOfThreads);
                for (int i = 0; i < numberOfThreads; ++i) {
                    MapRunner thread;
                    thread = new MapRunner();
                    thread.start();
                    runners.add(i, thread);
                }
                // MapRunner runs in current thread
                MapRunner r = new MapRunner();
                r.run();
                
                for (int i = 0; i < numberOfThreads; ++i) {
                    MapRunner thread = runners.get(i);
                    thread.join();
                    Throwable th = thread.throwable;
                    if (th != null) {
                        if (th instanceof IOException) {
                            throw (IOException) th;
                        } else if (th instanceof InterruptedException) {
                            throw (InterruptedException) th;
                        } else {
                            throw new RuntimeException(th);
                        }
                    }
                }
            }       
        } catch (ClassNotFoundException e) {
            LOG.error("MapRunner class not found", e);
        } catch (ExecutionException e) {
        	LOG.error("Error waiting for MapRunner threads to complete", e);
		}        
    }
63271
public void setRunner(Class<? extends OperaRunner> runner) {
    options.get(RUNNER).setValue(runner.getName());
  }
966635
protected void log(
        String prefix, // nullable
        String message
    ) {

        final PrintWriter out = this.writer;

        if (out != null) {
            if (prefix == null) {
                out.println(message);
            } else {
                out.println(prefix + message);
            }
        }

    }
646020
public ValidatorBuilderBigInteger<PARENT> range(BigInteger min, BigInteger max) {

    return range(new Range<>(min, max));
  }
183692
public final void println(CharSequence prefix) {
        for (T v : this) {
            System.out.print(prefix);
            System.out.println(v);
        }
    }
1267337
static HeapUpdateDoublesSketch newInstance(final int k) {
    final HeapUpdateDoublesSketch hqs = new HeapUpdateDoublesSketch(k);
    final int baseBufAlloc = 2 * Math.min(DoublesSketch.MIN_K, k); //the min is important
    hqs.n_ = 0;
    hqs.combinedBuffer_ = new double[baseBufAlloc];
    hqs.baseBufferCount_ = 0;
    hqs.bitPattern_ = 0;
    hqs.minValue_ = Double.NaN;
    hqs.maxValue_ = Double.NaN;
    return hqs;
  }
1019415
function (runner) {
    var
      suites = runner.suites(), idx, counter = 0, keyIdx,
      results = { suites: [ ], passed: 0, failed: 0, skipped: 0, total: 0, duration: 0 };
    for(idx = 0; idx < suites.length; ++idx) {
      if(null === suites[idx].parentSuite) {
        results.suites.push(__processSuite(suites[idx]));
        for(keyIdx = 0; keyIdx < __keys.length; ++keyIdx) {
          results[__keys[keyIdx]] += results.suites[counter][__keys[keyIdx]];
        }
        ++counter;
      }
    }
    /** global: CrossBrowserTestsRunner */
    CrossBrowserTestsRunner.runEnd(results, function() {
      // do nothing
    })
  }
1128704
private function setOutputPrefix($prefix)
    {
        if (!($this->output->getFormatter() instanceof PrefixFormatter)) {
            return;
        }

        $this->output->getFormatter()->prefix = $prefix;
    }