Examples of Histogram


Examples of com.higherfrequencytrading.testing.Histogram

        t.start();

        Excerpt excerpt = tsc.createExcerpt();
        Excerpt excerpt2 = tsc2.createExcerpt();

        Histogram hist = new Histogram(100000, 1);
        long totalTime = 0, longDelays = 0;
        for (int i = 0; i < RUNS; i++) {
            excerpt.startExcerpt(8);
            excerpt.writeLong(nanoTime());
            excerpt.finish();

            while (!excerpt2.index(i)) {
                /* try again */
            }

            long time1 = nanoTime();
            long time0 = excerpt2.readLong();
            excerpt2.finish();
            if (i >= WARMUP) {
                final long latency = time1 - time0;
                if (latency < 0 || latency > 100000) {
                    longDelays++;
                    System.out.println(latency);
                }
                hist.sample(latency);
                totalTime += latency;
            }
        }

        t.join();
        tsc.close();
        tsc2.close();

        System.out.printf("The average RTT latency was %,d ns. The 50/99 / 99.9/99.99%%tile latencies were %,d/%,d / %,d/%,d. There were %,d delays over 100 μs%n",
                totalTime / RUNS, hist.percentile(0.5), hist.percentile(0.99), hist.percentile(0.999), hist.percentile(0.9999), longDelays);
    }
View Full Code Here

Examples of com.higherfrequencytrading.testing.Histogram

        al.bind();
        Excerpt excerpt = tsc.createExcerpt();
        Excerpt excerpt2 = tsc2.createExcerpt();

        Histogram hist = new Histogram(100000, 1);
        long totalTime = 0, longDelays = 0;
        for (int i = 0; i < RUNS; i++) {
            excerpt.startExcerpt(8);
            excerpt.writeLong(nanoTime());
            excerpt.finish();

            do {
                busyWait();
            } while (!excerpt2.index(i));

            long time1 = nanoTime();
            long time0 = excerpt2.readLong();
            excerpt2.finish();
            if (i >= WARMUP) {
                final long latency = time1 - time0;
                if (latency < 0 || latency > 100000) {
                    longDelays++;
                    System.out.println(latency);
                }
                hist.sample(latency);
                totalTime += latency;
            }
        }

        t.join();
        tsc.close();
        tsc2.close();

        System.out.printf("The average RTT latency was %,d ns. The 50/99 / 99.9/99.99%%tile latencies were %,d/%,d / %,d/%,d. There were %,d delays over 100 μs%n",
                totalTime / RUNS, hist.percentile(0.5), hist.percentile(0.99), hist.percentile(0.999), hist.percentile(0.9999), longDelays);
        al.release();
    }
View Full Code Here

Examples of com.jamieallen.sdisruptor.collections.Histogram

    }

    @Test(expected = IllegalArgumentException.class)
    public void shouldThrowExceptionWhenIntervalLessThanOrEqualToZero()
    {
        new Histogram(new long[]{-1, 10, 20});
    }
View Full Code Here

Examples of com.jgaap.util.Histogram

    knownCentroids = mapBuilder.build();
  }

  @Override
  public List<Pair<String, Double>> analyze(Document unknown) throws AnalyzeException {
    Histogram unknownHistogram = new EventMap(unknown);
    List<Pair<String, Double>> result = new ArrayList<Pair<String, Double>>(knownCentroids.size());
    for (Entry<String, Histogram> knownEntry : knownCentroids.entrySet()) {
      try {
        double current = distance.distance(unknownHistogram, knownEntry.getValue());
        logger.debug(unknown.getTitle()+" ("+unknown.getFilePath()+")"+" -> "+knownEntry.getKey()+":"+current);
View Full Code Here

Examples of com.lightcrafts.mediax.jai.Histogram

            // Property is not a Histogram.
            msg.append(getName() + " " +
                       JaiI18N.getString("MatchCDFDescriptor2"));
            return false;
  } else {
      Histogram hist = (Histogram)prop;
      int numBands = hist.getNumBands();

            if (CDF == null) {
                int[] numBins = hist.getNumBins();
                CDF = new float[numBands][];

                for (int b = 0; b < numBands; b++) {
                    CDF[b] = new float[numBins[b]];
                    for (int i = 0; i < numBins[b]; i++)
                        CDF[b][i] = (i + 1)/numBins[b];
                }
            }

      if(CDF.length != numBands) {
                // CDF length does not match Histogram.
          msg.append(getName() + " " +
         JaiI18N.getString("MatchCDFDescriptor3"));
    return false;
      }

      for(int b = 0; b < numBands; b++) {
          if(CDF[b].length != hist.getNumBins(b)) {
                    // Check that CDF length for this band matches Histogram.
        msg.append(getName() + " " +
             JaiI18N.getString("MatchCDFDescriptor4"));
        return false;
    }
View Full Code Here

Examples of com.lightcrafts.mediax.jai.Histogram

        return names;
    }

    protected Object createStatistics(String name) {
        if (name.equalsIgnoreCase("histogram")) {
            return new Histogram(numBins, lowValueFP, highValueFP);
        } else {
            return java.awt.Image.UndefinedProperty;
        }
    }
View Full Code Here

Examples of com.lightcrafts.mediax.jai.Histogram

    protected void accumulateStatistics(String name,
                                        Raster source,
                                        Object stats) {
        // Get the JAI histogram.
        Histogram histogram = (Histogram)stats;
        int numBands = histogram.getNumBands();
        int[][] histJAI = histogram.getBins();

        // Get the tile bounds.
        Rectangle tileRect = source.getBounds();

        // Get the tile bins.
        int[][] histo;
        if(!reorderBands && tileRect.equals(getBounds())) {
            // Entire image: use the global histogram bins directly.
            histo = histJAI;
        } else {
            // Sub-image: save results for this tile only.
            histo = new int[numBands][];
            for(int i = 0; i < numBands; i++) {
                histo[i] = new int[histogram.getNumBins(i)];
            }
        }

        // Get the mlib image.
        int formatTag = MediaLibAccessor.findCompatibleTag(null, source);
View Full Code Here

Examples of com.lightcrafts.mediax.jai.Histogram

        return names;
    }

    protected Object createStatistics(String name) {
        if (name.equalsIgnoreCase("histogram")) {
            return new Histogram(numBins, lowValue, highValue);
        } else {
            return java.awt.Image.UndefinedProperty;
        }
    }
View Full Code Here

Examples of com.lightcrafts.mediax.jai.Histogram

    }

    protected void accumulateStatistics(String name,
                                        Raster source,
                                        Object stats) {
        Histogram histogram = (Histogram)stats;
        histogram.countPixels(source, roi, xStart, yStart, xPeriod, yPeriod);
    }
View Full Code Here

Examples of com.lightcrafts.mediax.jai.Histogram

        ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
       

        // Derive breakpoints from the histogram and specified CDF.
  RenderedImage src = args.getRenderedSource(0);
  Histogram hist = (Histogram)src.getProperty("histogram");
  float[][] CDF = (float[][])args.getObjectParameter(0);
  float[][][] bp = createSpecificationMap(hist, CDF);

  return new PiecewiseOpImage(src, renderHints, layout, bp);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.