Package org.radargun.stats

Examples of org.radargun.stats.Statistics


               if (valueCategory.endsWith(" Throughput")) {
                  timeline.addValue(valueCategory, new Timeline.Value(now, 0));
               }
            }
         } else {
            Statistics aggregated = stats.get(0).copy();
            for (int i = 1; i < stats.size(); ++i) {
               aggregated.merge(stats.get(i));
            }
            for (Map.Entry<String, OperationStats> entry : aggregated.getOperationsStats().entrySet()) {
               Throughput throughput = entry.getValue().getRepresentation(Throughput.class, stats.size(), TimeUnit.MILLISECONDS.toNanos(aggregated.getEnd() - aggregated.getBegin()));
               if (throughput != null && (throughput.actual != 0 || timeline.getValues(entry.getKey() + " Throughput") != null)) {
                  timeline.addValue(entry.getKey() + " Throughput", new Timeline.Value(now, throughput.actual));
               }
            }
         }
View Full Code Here


         fileWriter = prepareOutputFile(report, test.name, "");
         int it = 0;
         Set<String> columns = new TreeSet<String>();
         ArrayList<Map<String, String>> rows = new ArrayList();
         for (Report.TestIteration iteration : test.getIterations()) {
            Statistics aggregated = null;
            for (Map.Entry<Integer, List<Statistics>> slaveStats : iteration.getStatistics()) {
               if (ignore != null && ignore.contains(slaveStats.getKey())) {
                  continue;
               }
               if (slaveStats.getValue().size() <= 0) {
                  continue;
               }
               Statistics nodeSummary = processRow(it, columns, rows, slaveStats);
               if (computeTotal) {
                  if (aggregated == null) aggregated = nodeSummary;
                  else aggregated.merge(nodeSummary);
               }
            }
View Full Code Here

      return new FileWriter(outputFile);
   }

   private Statistics processRow(int it, Set<String> columns, List<Map<String, String>> rows, Map.Entry<Integer, List<Statistics>> slaveStats) {
      // this reporter is merging statistics from all threads on each node
      Statistics summary = null;
      for (Statistics other : slaveStats.getValue()) {
         if (other == null) continue;
         if (summary == null) {
            summary = other.copy();
         } else {
            summary.merge(other);
         }
      }
      Map<String,OperationStats> operationStats = summary.getOperationsStats();
      Map<String, String> rowData = new HashMap<String, String>();
      rows.add(rowData);
      for (Map.Entry<String, OperationStats> os : operationStats.entrySet()) {
         addRepresentations(summary, slaveStats.getValue().size(), rowData, os.getKey(), os.getValue());
      }
      columns.addAll(rowData.keySet());

      rowData.put(SLAVE_INDEX, String.valueOf(slaveStats.getKey()));
      rowData.put(ITERATION, String.valueOf(it));
      rowData.put(PERIOD, String.valueOf(summary.getEnd() - summary.getBegin()));
      rowData.put(THREAD_COUNT, String.valueOf(slaveStats.getValue().size()));
      return summary;
   }
View Full Code Here

      }
      return false;
   }

   public boolean isSuspect(int node, String operation) {
      Statistics ns;
      if (node >= nodeStats.size() || (ns = nodeStats.get(node)) == null) {
         return false;
      }
      OperationStats nos = ns.getOperationsStats().get(operation);
      OperationStats tos = totalStats.getOperationsStats().get(operation);
      if (nos == null) {
         return tos != null;
      }
      DefaultOutcome ndo = nos.getRepresentation(DefaultOutcome.class);
View Full Code Here

         iterationsName = sb.toString();
      }
   }

   private void addIteration(Report.Test test, List<Aggregation> iterations, Report.TestIteration it) {
      Statistics totalStats = null;
      int totalThreads = 0;
      List<Statistics> nodeStats = new ArrayList<>();
      List<Integer> nodeThreads = new ArrayList<>();
      for (Map.Entry<Integer, List<Statistics>> entry : it.getStatistics()) {
         int slaveIndex = entry.getKey();
         List<Statistics> list = entry.getValue();

         Statistics ns = null;
         for (Statistics s : list) {
            if (ns == null) {
               ns = s.copy();
            } else {
               ns.merge(s);
            }
         }

         if (ns != null) {
            while (nodeStats.size() <= slaveIndex) {
               nodeStats.add(null);
               nodeThreads.add(0);
            }
            nodeStats.set(slaveIndex, ns);
            nodeThreads.set(slaveIndex, list.size());

            if (totalStats == null) {
               totalStats = ns.copy();
            } else {
               totalStats.merge(ns);
            }
         }
         totalThreads += list.size();
View Full Code Here

   }

   @Override
   public DistStageAck executeOnSlave() {
      // TODO: customize stats
      Statistics stats = new DefaultStatistics(new DefaultOperationStats());
      CountDownLatch startLatch = new CountDownLatch(1);
      ArrayList<IteratingStressor> stressors = new ArrayList<IteratingStressor>(numThreads);
      try {
         for (int i = 0; i < numThreads; ++i) {
            Iterable.Filter filter = null;
            Iterable.Converter converter = null;
            try {
               if (filterClass != null) {
                  filter = Utils.instantiateAndInit(slaveState.getClassLoader(), filterClass, filterParam);
               }
               if (converterClass != null) {
                  converter = Utils.instantiateAndInit(slaveState.getClassLoader(), converterClass, converterParam);
               }
            } catch (Exception e) {
               terminate(stressors);
               return errorResponse("Failed to create the filter or converter", e);
            }
            IteratingStressor stressor = new IteratingStressor(i, iterable, containerName, filter, converter,
                  maxNextFailures, numLoops, startLatch, stats.newInstance());
            stressors.add(stressor);
            stressor.start();
         }
      } finally {
         startLatch.countDown();
View Full Code Here

      }
      write(String.format("\">%s</th><th>%s</th>", report.getConfiguration().name, report.getCluster()));

      int iteration = 0;
      for (Aggregation aggregation : aggregations) {
         Statistics statistics = aggregation.totalStats;
         OperationStats operationStats = statistics == null ? null : statistics.getOperationsStats().get(operation);
         long period = TimeUnit.MILLISECONDS.toNanos(statistics.getEnd() - statistics.getBegin());
         writeRepresentations(operationStats, operation, report.getCluster().getClusterIndex(), iteration, "total",
                              aggregation.totalThreads, period, hasPercentiles, hasHistograms, false, aggregation.anySuspect(operation));
         ++iteration;
      }

      write("</tr>\n");
      for (int node = 0; node < nodeCount; ++node) {
         write(String.format("<tr id=\"e%d\" style=\"visibility: collapse;\"><th colspan=\"2\" style=\"text-align: right\">node%d</th>", elementCounter++, node));
         for (Aggregation aggregation : aggregations) {
            Statistics statistics = node >= aggregation.nodeStats.size() ? null : aggregation.nodeStats.get(node);

            OperationStats operationStats = null;
            long period = 0;
            if (statistics != null) {
               operationStats = statistics.getOperationsStats().get(operation);
               period = TimeUnit.MILLISECONDS.toNanos(statistics.getEnd() - statistics.getBegin());
            }
            int threads = node >= aggregation.nodeThreads.size() ? 0 : aggregation.nodeThreads.get(node);
            writeRepresentations(operationStats, operation, report.getCluster().getClusterIndex(), iteration, "node" + node,
                                 threads, period, hasPercentiles, hasHistograms, false, aggregation.anySuspect(operation));
         }
View Full Code Here

      StageResult result = super.processAckOnMaster(acks);
      if (result.isError()) return result;

      Report.Test test = getTest();
      testIteration = test == null ? 0 : test.getIterations().size();
      Statistics aggregated = createStatistics();
      int threads = 0;
      for (StatisticsAck ack : Projections.instancesOf(acks, StatisticsAck.class)) {
         if (ack.iterations != null) {
            int i = getTestIteration();
            for (List<Statistics> threadStats : ack.iterations) {
               if (test != null) {
                  // TODO: this looks like we could get same iteration value for all iterations reported
                  String iterationValue = resolveIterationValue();
                  if (iterationValue != null) {
                     test.setIterationValue(i, iterationValue);
                  }
                  test.addStatistics(i++, ack.getSlaveIndex(), threadStats);
               }
               threads = Math.max(threads, threadStats.size());
               for (Statistics s : threadStats) {
                  aggregated.merge(s);
               }
            }
         } else {
            log.trace("No statistics received from slave: " + ack.getSlaveIndex());
         }
View Full Code Here

      }
      List<Statistics> stats = new ArrayList<Statistics>(stressors.size());
      for (Stressor stressor : stressors) {
         try {
            stressor.join();
            Statistics s = stressor.getStats();
            if (s != null) { // stressor could have crashed during initialization
               stats.add(s);
            }
         } catch (InterruptedException e) {
            throw new IllegalStateException("Unexpected interruption", e);
View Full Code Here

   @InjectTrait(dependency = InjectTrait.Dependency.MANDATORY)
   private Queryable queryable;

   @Override
   public DistStageAck executeOnSlave() {
      Statistics stats = new DefaultStatistics(new DefaultOperationStats());
      long start = System.nanoTime();
      queryable.reindex(container);
      stats.registerRequest(System.nanoTime() - start, Queryable.REINDEX);
      return new StatisticsAck(slaveState, stats);
   }
View Full Code Here

TOP

Related Classes of org.radargun.stats.Statistics

Copyright © 2018 www.massapicom. 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.