Examples of Average


Examples of org.glassfish.flashlight.statistics.Average

* @author hsingh
*/
public class AverageFactory {
   
    public static Average createAverage (){
        Average average = new AverageImpl ();
        return average;
    }
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Average

  public static Average getInstanceAverage(List<Event> events)
  {
    assert events.size()>0 : "Empty event list";
    assert events.size()%2==0 : "Parity error: "+events.size() +" events. Every event should have closing counterpart!";

    Average stat = new Average(events.get(0).getProcessDefinitionID());

    Map<String, Long> duration = new HashMap<String,Long>(events.size()/2);
    for(Event e : events)
    {
      String processInstance = e.getProcessInstanceID();
      Long l0 = duration.get(processInstance);
      if(l0!=null)
      {
        long l1 = e.getTimestamp();
        if(l0<l1)
          duration.put(processInstance, (l1-l0));   // not necessarily in order
        else
          duration.put(processInstance, (l0-l1));
      }
      else
      {
        duration.put(processInstance, e.getTimestamp());
      }
    }

    long sum = 0;
    for(String processInstance : duration.keySet())
    {
      long l3 = duration.get(processInstance);
      if(stat.getMin()==-1) // first iteration
        stat.setMin(l3);
      else if(l3<stat.getMin())
        stat.setMin(l3);
      else if(l3>stat.getMax())
        stat.setMax(l3);

      sum+=l3;
    }

    stat.setAvg(sum/duration.entrySet().size());

    return stat;
  }
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Average

  public static Average getActivityAverage(List<Event> events, String activityDefinition)
  {
    assert events.size()>0 : "Empty event list";
    assert events.size()%2==0 : "Parity error: "+events.size() +" events. Every event should have closing counterpart!";

    Average stat = new Average(activityDefinition);

    Map<String, Long> in = new HashMap<String,Long>(events.size()/2);
    List<Long> out = new ArrayList<Long>();
    for(Event e : events)
    {
      String activity = e.getActivityDefinitionID();

      if(!activity.equals(activityDefinition)) // skip non related events
        continue;
     
      Long l0 = in.get(activity);
      if(l0!=null)
      {
        long l1 = e.getTimestamp();
        if(l0<l1)
          out.add(l1-l0);   // not necessarily in order
        else
          out.add(l0-l1);
      }
      else
      {
        in.put(activity, e.getTimestamp());
      }
    }

    long sum = 0;
    for(Long l3: out)
    {     
      if(stat.getMin()==-1) // first iteration
      {
        stat.setMin(l3);
        stat.setMax(l3);
      }
      else if(l3<stat.getMin())
        stat.setMin(l3);
      else if(l3>stat.getMax())
        stat.setMax(l3);

      sum+=l3;
    }

    stat.setAvg(sum/out.size());

    return stat;
  }
View Full Code Here

Examples of org.jgroups.util.Average

    @ManagedAttribute(description="Average latency in ms")
    public double latencyInMs() {return avg.getAverage() / 1000000.0;}

    public void init() throws Exception {
        super.init();
        avg=new Average(avg_size);
    }
View Full Code Here

Examples of ptolemy.actor.lib.Average

        FIR fir = new FIR(this, "fir");
        fir.taps.setExpression("{0.7, 0.3}");

        Quantizer quan = new Quantizer(this, "Quantizer");
        Average accumulator = new Average(this, "accumulator");
        Sampler sampler = new Sampler(this, "sampler");
        Clock clk = new Clock(this, "ADClock");
        clk.offsets.setExpression("{0.0}");
        clk.period.setToken(new DoubleToken(1.0));
        clk.values.setExpression("{true}");
View Full Code Here

Examples of systole.domain.analysis.results.averages.Average

                AverageWs averageWs = itaod.next();
                AverageByDecade averageByDecade = averageWs.isSex()
                        ? new AverageByDecadeMale(averageWs.getDecade())
                        : new AverageByDecadeFemale(averageWs.getDecade());
                averageByDecade.setSamples(averageWs.getSamples());
                Average averageIAR = new Average();
                averageIAR.setAvg(averageWs.getIarAvg());
                averageIAR.setTrustInterval(averageWs.getIarTrustInterval());
                averageByDecade.setAverageIAR(averageIAR);
                Average averageAOD = new Average();
                averageAOD.setAvg(averageWs.getAodAvg());
                averageAOD.setTrustInterval(averageWs.getAodTrustInterval());
                averageByDecade.setAverageAOD(averageAOD);
                Average averageAOS = new Average();
                averageAOS.setAvg(averageWs.getAosAvg());
                averageAOS.setTrustInterval(averageWs.getAosTrustInterval());
                averageByDecade.setAverageAOS(averageAOS);
                FacadeDB.getInstance().getAveragesBroker().save(averageByDecade);
            }
        }
View Full Code Here

Examples of timing.Average

    super(name);
  }

  int N = 10;
  public void testScaleOffset() throws IOException, InvalidRangeException {
    Average all = new Average();
    Average alldefer = new Average();
    Average sm = new Average();
    Average smNoNans = new Average();
    Average coords = new Average();
    Average none = new Average();
    Average file = new Average();

    // warm up
    openDataset(NetcdfDataset.getEnhanceAll(), null);
    openFile(null);
View Full Code Here

Examples of timing.Average

      }
    }
  }

  public void testWriteNcml() throws IOException, InvalidRangeException {
    final Average fileAvg = new Average();
    final NcMLWriter writer = new NcMLWriter();

    testAllInDir( new File("C:/data/grib/"), new MClosure() {
      public void run(String filename) throws IOException, InvalidRangeException {
        if (!filename.endsWith("grib1")) return;
View Full Code Here

Examples of timing.Average

      }
    });
  }

  public void testOpenFile() throws IOException, InvalidRangeException {
    final Average fileAvg = new Average();
    //
    testAllInDir( new File("C:/data/grib/"), new MClosure() {
      public void run(String filename) throws IOException, InvalidRangeException {
        if (!filename.endsWith("ncml")) return;
        System.out.println(" open ncml file  ="+filename);
View Full Code Here

Examples of timing.Average

    }
  }

  // testing on remote machines like motherlode
  static void testOpenFile(String dir, final String suffix) throws IOException, InvalidRangeException {
    final Average fileAvg = new Average();
    //
    testAllInDir( new File(dir), new MClosure() {
      public void run(String filename) throws IOException, InvalidRangeException {
        if (!filename.endsWith(suffix)) return;
        //System.out.println(" open "+suffix+" file  ="+filename);
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.