Examples of Ratio


Examples of clojure.lang.Ratio

  public Ratio read(Kryo kryo, Input input, Class<Ratio> ratioClass) {
    BigInteger num = big.read(kryo, input, null);
    BigInteger denom = big.read(kryo, input, null);

    return new Ratio(num, denom);
  }
View Full Code Here

Examples of clojure.lang.Ratio

    public Ratio read(Kryo kryo, Input input, Class<Ratio> ratioClass) {
        BigInteger num = big.read(kryo, input, null);
        BigInteger denom = big.read(kryo, input, null);

        return new Ratio(num, denom);
    }
View Full Code Here

Examples of com.cognitect.transit.Ratio

            return "ratio";
        }

        @Override
        public Object rep(Object o) {
            Ratio r = (Ratio)o;
            BigInteger[] l = {r.getNumerator(), r.getDenominator()};
            return TransitFactory.taggedValue("array", l);
        }
View Full Code Here

Examples of com.dianping.cat.consumer.matrix.model.entity.Ratio

        long duration = ((Transaction) message).getDurationInMicros();
        matrix.incCount();
        matrix.setTotalTime(matrix.getTotalTime() + duration);

        Map<String, Ratio> ratios = new HashMap<String, Ratio>();
        ratios.put("Call", new Ratio());
        ratios.put("SQL", new Ratio());
        ratios.put("Cache", new Ratio());

        processTransaction(tree, (Transaction) message, ratios);

        for (Entry<String, Ratio> entry : ratios.entrySet()) {
          String type = entry.getKey();
          Ratio ratio = entry.getValue();
          int count = ratio.getTotalCount();
          long time = ratio.getTotalTime();

          Ratio real = matrix.findOrCreateRatio(type);
          if (real.getMin() > count || real.getMin() == 0) {
            real.setMin(count);
          }
          if (real.getMax() < count) {
            real.setMax(count);
            real.setUrl(tree.getMessageId());
          }
          real.setTotalCount(real.getTotalCount() + count);
          real.setTotalTime(real.getTotalTime() + time);
        }
        if (matrix.getUrl() == null) {
          matrix.setUrl(tree.getMessageId());
        }
      }
View Full Code Here

Examples of com.dianping.cat.consumer.matrix.model.entity.Ratio

  }

  private void processTransaction(MessageTree tree, Transaction t, Map<String, Ratio> ratios) {
    List<Message> children = t.getChildren();
    String type = t.getType();
    Ratio ratio = null;

    if (type.equals("Call") || type.equals("PigeonCall")) {
      ratio = ratios.get("Call");
    } else if (type.equals("SQL")) {
      ratio = ratios.get("SQL");
    } else if (type.startsWith("Cache.")) {
      ratio = ratios.get("Cache");
    }
    if (ratio != null) {
      ratio.incTotalCount();
      ratio.setTotalTime(ratio.getTotalTime() + t.getDurationInMicros());
    }

    for (Message child : children) {
      if (child instanceof Transaction) {
        processTransaction(tree, (Transaction) child, ratios);
View Full Code Here

Examples of com.dianping.cat.consumer.matrix.model.entity.Ratio

      }
      m_url = matrix.getUrl();
    }

    public void setCacheInfo(Matrix matrix) {
      Ratio ratio = matrix.getRatios().get("Cache");
      if (ratio == null) {
        return;
      }

      m_cacheMin = ratio.getMin();
      m_cacheMax = ratio.getMax();
      m_cacheUrl = ratio.getUrl();
      if (matrix.getCount() > 0) {
        m_cacheAvg = (double) ratio.getTotalCount() / (double) matrix.getCount();
      }
      if (m_cacheAvg > 0) {
        m_cacheTime = (int) ((double) ratio.getTotalTime() / 1000 / m_cacheAvg / m_count);
      }
      if (matrix.getTotalTime() > 0) {
        m_cacheTimePercent = (double) ratio.getTotalTime() / (double) (matrix.getTotalTime());
      }
    }
View Full Code Here

Examples of com.dianping.cat.consumer.matrix.model.entity.Ratio

        m_cacheTimePercent = (double) ratio.getTotalTime() / (double) (matrix.getTotalTime());
      }
    }

    public void setCallInfo(Matrix matrix) {
      Ratio ratio = matrix.getRatios().get("Call");
      if (ratio == null) {
        return;
      }

      m_callMin = ratio.getMin();
      m_callMax = ratio.getMax();
      m_callUrl = ratio.getUrl();
      if (matrix.getCount() > 0) {
        m_callAvg = (double) ratio.getTotalCount() / (double) matrix.getCount();
      }
      if (m_callAvg > 0) {
        m_callTime = (int) ((double) ratio.getTotalTime() / 1000 / m_callAvg / m_count);
      }
      if (matrix.getTotalTime() > 0) {
        m_callTimePercent = (double) ratio.getTotalTime() / (double) (matrix.getTotalTime());
      }
    }
View Full Code Here

Examples of com.dianping.cat.consumer.matrix.model.entity.Ratio

        m_callTimePercent = (double) ratio.getTotalTime() / (double) (matrix.getTotalTime());
      }
    }

    public void setSQLInfo(Matrix matrix) {
      Ratio ratio = matrix.getRatios().get("SQL");
      if (ratio == null) {
        return;
      }

      m_sqlMin = ratio.getMin();
      m_sqlMax = ratio.getMax();
      m_sqlUrl = ratio.getUrl();
      if (matrix.getCount() > 0) {
        m_sqlAvg = (double) ratio.getTotalCount() / (double) matrix.getCount();
      }
      if (m_sqlAvg > 0) {
        m_sqlTime = (int) ((double) ratio.getTotalTime() / 1000 / m_sqlAvg / m_count);
      }
      if (matrix.getTotalTime() > 0) {
        m_sqlTimePercent = (double) ratio.getTotalTime() / (double) (matrix.getTotalTime());
      }
    }
View Full Code Here

Examples of hudson.plugins.cobertura.Ratio

            Map<CoverageMetric, Ratio> runningTotal) {
        Map<CoverageMetric, Ratio> result = new EnumMap<CoverageMetric, Ratio>(CoverageMetric.class);
        result.putAll(runningTotal);
        for (CoverageAggregationRule rule : INITIAL_RULESET) {
            if (rule.source == source && rule.input == input) {
                Ratio prevTotal = result.get(rule.output);
                if (prevTotal == null) {
                    prevTotal = rule.mode.ZERO;
                }

                result.put(rule.output, rule.mode.aggregate(prevTotal, inputResult));
View Full Code Here

Examples of hudson.plugins.cobertura.Ratio

      }
    }
   
    public void updateMetric(CoverageMetric metric, Ratio additionalResult) {
        if (localResults.containsKey(metric)) {
            Ratio existingResult = localResults.get(metric);
            localResults.put(metric, CoverageAggregationRule.combine(metric, existingResult, additionalResult));
        } else {
            localResults.put(metric, additionalResult);
        }
    }
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.