Examples of COUNTER


Examples of org.apache.samza.metrics.Counter

public class TestNoOpMetricsRegistry {
  @Test
  public void testNoOpMetricsHappyPath() {
    NoOpMetricsRegistry registry = new NoOpMetricsRegistry();
    Counter counter1 = registry.newCounter("testc", "a");
    Counter counter2 = registry.newCounter("testc", "b");
    Counter counter3 = registry.newCounter("testc2", "c");

    Gauge<String> gauge1 = registry.newGauge("testg", "a", "1");
    Gauge<String> gauge2 = registry.newGauge("testg", "b", "2");
    Gauge<String> gauge3 = registry.newGauge("testg", "c", "3");
    Gauge<String> gauge4 = registry.newGauge("testg2", "d", "4");

    Timer timer1 = registry.newTimer("testt", "a");
    Timer timer2 = registry.newTimer("testt", "b");
    Timer timer3 = registry.newTimer("testt2", "c");

    counter1.inc();
    counter2.inc(2);
    counter3.inc(4);

    gauge1.set("5");
    gauge2.set("6");
    gauge3.set("7");
    gauge4.set("8");

    timer1.update(1L);
    timer2.update(2L);
    timer3.update(3L);

    assertEquals(1, counter1.getCount());
    assertEquals(2, counter2.getCount());
    assertEquals(4, counter3.getCount());
    assertEquals("5", gauge1.getValue());
    assertEquals("6", gauge2.getValue());
    assertEquals("7", gauge3.getValue());
    assertEquals("8", gauge4.getValue());
    assertEquals(1, timer1.getSnapshot().getAverage(), 0);
View Full Code Here

Examples of org.apache.samza.metrics.Counter

* recorded but a registry is still required.
*/
public class NoOpMetricsRegistry implements MetricsRegistry {
  @Override
  public Counter newCounter(String group, String name) {
    return new Counter(name);
  }
View Full Code Here

Examples of org.apache.sirona.counters.Counter

    }

    @Test
    public void store() throws InterruptedException, UnknownHostException {
        { // force some counter data
            final Counter counter = Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, "test"));
            counter.add(1.4);
            counter.add(1.6);
            Thread.sleep(150);
            counter.add(2.3);
            counter.add(2.9);
            Thread.sleep(1500);
        }

        final String host = Localhosts.get();
View Full Code Here

Examples of org.apache.sqoop.submission.counter.Counter

        if(group == null) {
          group = new CounterGroup(groupName);
          counters.addCounterGroup(group);
        }

        group.addCounter(new Counter(counterName, value));
      }

      if(counters.isEmpty()) {
        return null;
      } else {
View Full Code Here

Examples of org.apache.yaoql.util.Counter

        assertResultCount(objList, "dateval between NOW()-MINUTE(1) AND NOW()+MINUTE(1)", 10);
        assertResultCount(objList, "dateval between DATE('09/09/2009', 'mm/dd/yyyy')-MINUTE(1) AND NOW()+MINUTE(1)", 10);

        // Using Listeners with CollectionQuery Object
        String qstr = "strval like 'T[est]+ Value: [1-3]'";
        final Counter cnt1 = new Counter();
        final Counter cnt2 = new Counter();
        final Counter cnt3 = new Counter();
        ObjectQuery<SimpleObject> query = ObjectQueryManager.newObjectQuery(qstr);
        query.addListener(
                new ObjectQueryListener<SimpleObject>() {

                    public void onQueryStart() {
                        cnt1.increment();
                    }

                    public void onEachObject(final SimpleObject val) {
                        cnt2.increment();
                    }

                    public void onQueryComplete() {
                        cnt3.increment();
                    }
                }
        );
        query.getResultList(objList);
        assertTrue(cnt1.getCount() == 1);
        assertTrue(cnt2.getCount() == 3);
        assertTrue(cnt3.getCount() == 1);

        query = ObjectQueryManager.newObjectQuery(qstr);
        List<SimpleObject> r1 = query.getResultList(objList);
        assertTrue(r1.size() == 3);
View Full Code Here

Examples of org.boris.expr.util.Counter

        this.iterations = iterations;
    }

    public final Expr evaluate(Expr[] args) throws ExprException {
        assertMinArgCount(args, 1);
        Counter c = new Counter();
        initialize(c);
        ol: for (int i = 0; i < iterations; i++) {
            c.iteration = i + 1;
            iteration(c);
            for (Expr e : args) {
View Full Code Here

Examples of org.cliffc.high_scale_lib.Counter

    private final AtomicReference<HashMap<String, Counter>> currentStreamThroughput;


    public ThroughputStats() {
        this.currentThroughput = 0;
        this.throughputCounter = new Counter();
        this.benchmarkCounter = new Counter();
        this.streamThroughput = new AtomicReference<ConcurrentHashMap<String, Counter>>(new ConcurrentHashMap<String, Counter>());
        this.currentStreamThroughput =  new AtomicReference<HashMap<String, Counter>>();

    }
View Full Code Here

Examples of org.cliffc.high_scale_lib.Counter

        return streamThroughput.getAndSet(new ConcurrentHashMap<String, Counter>());
    }

    public void incrementStreamThroughput(String streamId) {
        final ConcurrentHashMap<String, Counter> counterMap = streamThroughput.get();
        Counter counter;
        synchronized (counterMap) {
            counter = counterMap.get(streamId);
            if (counter == null) {
                counter = new Counter();
                counterMap.put(streamId, counter);
            }
        }
        counter.increment();
    }
View Full Code Here

Examples of org.cliffc.high_scale_lib.Counter

        final Map<String, Long> result = Maps.newHashMap();
        result.put("throughput", 0L);

        final HashMap<String,Counter> currentStreamThroughput = throughputStats.getCurrentStreamThroughput();
        if (currentStreamThroughput != null) {
            final Counter counter = currentStreamThroughput.get(streamId);
            if (counter != null && isPermitted(RestPermissions.STREAMS_READ, streamId))
                result.put("throughput", counter.get());
        }
        return Response.ok().entity(json(result)).build();
    }
View Full Code Here

Examples of org.dbwiki.lib.Counter

          if (!labelCounter.containsKey(label)) {
            labelCounter.put(label,  labelIndex.get(label));
          }
          labelIndex.get(label).inc();
        } else {
          labelIndex.put(label,  new Counter());
        }
      }
      // Reset the counter for labels that occur more than once
      Iterator<Counter> elements = labelCounter.values().iterator();
      while (elements.hasNext()) {
        elements.next().reset(1);
      }
      try {
        _resultSchema = new GroupSchemaNode(-1, "result", null, new TimeSequence(1));
        for (SubTreeSelectStatement stmt : _statements) {
          SchemaNode schema = stmt.targetPath().lastElement().entity();
          String label = null;
          if (stmt.label() != null) {
            label = stmt.label();
          } else {
            label = schema.label();
          }
          if (labelCounter.containsKey(label)) {
            Counter counter = labelCounter.get(label);
            label = label + Integer.toString(counter.value());
            stmt.setLabel(label);
            counter.inc();
          }
          SchemaNode renamedSchema = null;
          if (schema.isAttribute()) {
            renamedSchema = new AttributeSchemaNode(-1, label, _resultSchema, schema.getTimestamp());
            //renamedSchema = new AttributeSchemaNode(schema.id(), label, _resultSchema, schema.getTimestamp());
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.