Examples of StopWatch


Examples of com.netflix.servo.monitor.Stopwatch

       
    }

    @Override
    public void publish(Object event) {
        Stopwatch start = stats.publishStats.start();
        try {
            if (!applyEventLevelFilters(event)) {
                return;
            }

            Set<Class<?>> allTypesForAnEvent = getAllTypesForAnEvent(event);
            for (Class<?> eventType : allTypesForAnEvent) {
                Set<EventConsumer> eventConsumers = consumersByEventType.get(eventType);
                for (EventConsumer eventConsumer : eventConsumers) {
                    eventConsumer.enqueue(event);
                }
            }
            if (null != catchAllSubInstance && catchAllSubInstance.isEnabled()) {
                catchAllSubscriber.enqueue(event);
            }
        } catch (Throwable th) {
            LOGGER.error("Error occured while publishing event. Swallowing the error to avoid publisher from failing.", th);
            stats.publishErrors.increment();
        } finally {
            start.stop();
        }
    }
View Full Code Here

Examples of com.vividsolutions.jts.util.Stopwatch

    List circleGrid = createCircleGrid(GRID_SIZE);
   
    PreparedGeometryIndex pgIndex = new PreparedGeometryIndex();
    pgIndex.insert(circleGrid);
   
    Stopwatch sw = new Stopwatch();
    int inCount = runIndexedQuery(pgIndex);
    String indexTime = sw.getTimeString();
   
    System.out.println("Number of iterations       = " + MAX_ITER );
    System.out.println("Number of circles in grid  = " + circleGrid.size() );
    System.out.println();
    System.out.println("The fraction of intersecting points should approximate the total area of the circles:");
    System.out.println();
    System.out.println("Area of circles                = " + area(circleGrid) );
    System.out.println("Fraction of points in circles  = " + inCount / (double) MAX_ITER );
    System.out.println();
    System.out.println("Indexed Execution time: " + indexTime );
   
    /**
     * For comparison purposes run the same query without using an index
     */
    Stopwatch sw2 = new Stopwatch();
    int inCount2 = runBruteForceQuery(circleGrid);
    String bruteForceTime = sw2.getTimeString();
   
    System.out.println();
    System.out.println("Execution time: " + bruteForceTime );

  }
View Full Code Here

Examples of cz.mp.util.Stopwatch

                if (splash == null) {
                    logger.warning("SplashScreen.getSplashScreen() --> null");
               
               
                Stopwatch startupTime = new Stopwatch();
                startupTime.start();

                MainFrame.getInstance().setVisible(true);

                startupTime.stop();

                logger.config("startup in  " +
                        startupTime.getTimeSec() + " s");
               
                if (splash != null && splash.isVisible()) {
                    splash.close();
                }                 
            }
View Full Code Here

Examples of dcamj.utils.StopWatch

      }
    });

    System.gc();
    final StopWatch lStopWatch = StopWatch.start();
    for (int i = 0; i < lNumberOfIterations; i++)
    {
      // System.out.println("ITERATION=" + i);
      assertTrue(lDcamAcquisition.startAcquisitionfalse,
                                                    true,
                                                    lDcamFrameArray[lDcamFrameCounter]));
      // lDcamAcquisition.stopAcquisition();

      // Thread.sleep(1000);
      lDcamFrameCounter = (lDcamFrameCounter + 1) % lNumerOfDcamFrames;
      /*final DcamFrame lNewDcamFrame = lDcamFrameArray[lDcamFrameCounter];
      lDcamAcquisition.getBufferControl()
                      .attachExternalBuffers(lNewDcamFrame);/**/

    }
    final long lTimeInSeconds = lStopWatch.time(TimeUnit.SECONDS);
    final double lSpeed = lNumberOfIterations * lNumberOfFramesToCapture
                          / (lTimeInSeconds);
    System.out.format("acquisition speed: %g frames/s \n", lSpeed);

    while (lDcamAcquisition.isAcquiring())
View Full Code Here

Examples of de.fu_berlin.inf.dpp.util.StopWatch

            // Create a packet collector to listen for a response.
            PacketCollector collector = connection
                .createPacketCollector(new PacketIDFilter(id));

            StopWatch watch = new StopWatch().start();

            try {
                try {
                    progress.subTask("Sending Data");
                    dataTransferManager.sendData(transferData, testData,
                        progress.newChild(40));
                } catch (IOException e) {
                    throw new XMPPException("IOException sending data", e);
                } catch (SarosCancellationException e) {
                    throw new XMPPException(
                        "CancellationException sending data", e);
                }

                progress.subTask("Waiting for reply");
                ConnectionTestResponse response = null;
                for (int i = 0; i < 15; i++) {
                    response = responseProvider.getPayload(collector
                        .nextResult(1000));
                    if (response != null)
                        break;
                    progress.worked(1);
                }

                result.transferTime = watch.stop().getTime();

                if (response == null)
                    throw new XMPPException("Timeout after 15s");

                if (response.errorMessage != null)
View Full Code Here

Examples of de.jetwick.util.StopWatch

                return res;
            }
        };

        int counter = 0;
        StopWatch sw = new StopWatch();
        while (true) {
            counter++;
            sw.start();
            int feeded = executeOneBatch();
            sw.stop();
            if (feeded < 10) {
                try {
                    Thread.sleep(400);
                } catch (InterruptedException ex) {
                    logger.error(getName() + " interrupted while sleeping: " + ex.getLocalizedMessage());
                    break;
                }
            }

            // print stats
            if (counter % 1000 == 0) {
                logger.info("time of polling:\t" + sw.getSeconds());
                sw = new StopWatch();

                logger.info("tweetCache size:\t" + tweetCache.size());
                logger.info("tweetTodo size:\t" + resolver.getInputQueue().size());
                for (QueueInfo<JTweet> qi : inputQueues) {
                    logger.info(qi.toString());
View Full Code Here

Examples of de.lessvoid.nifty.tools.StopWatch

    }

    Element rootElement = nifty.getRootLayerFactory().createRootLayer("root", nifty, screen, timeProvider);
    screen.setRootElement(rootElement);

    StopWatch stopWatch = new StopWatch(timeProvider);
    stopWatch.start();
    for (LayerType layerType : layers) {
      layerType.prepare(nifty, screen, rootElement.getElementType());
    }
    Logger.getLogger(NiftyLoader.class.getName()).info("internal prepare screen (" + id + ") [" + stopWatch.stop() + "]");

    stopWatch.start();
    for (LayerType layerType : layers) {
      LayoutPart layerLayout = nifty.getRootLayerFactory().createRootLayerLayoutPart(nifty);
      screen.addLayerElement(
          layerType.create(
              rootElement,
              nifty,
              screen,
              layerLayout));
    }
    Logger.getLogger(NiftyLoader.class.getName()).info("internal create screen (" + id + ") [" + stopWatch.stop() + "]");

    screen.processAddAndRemoveLayerElements();
    nifty.addScreen(id, screen);
  }
View Full Code Here

Examples of fig.basic.StopWatch

    Pattern QUIT =
        Pattern.compile("quit|exit|q|bye", Pattern.CASE_INSENSITIVE);
    FbEntitySearcher searcher = new FbEntitySearcher(args[0], 10000, args[1]);
    BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
    StopWatch watch = new StopWatch();
    for (; ; ) {
      System.out.print("Search> ");
      String question = is.readLine().trim();
      if (QUIT.matcher(question).matches()) {
        System.out.println("Quitting.");
        break;
      }
      if (question.equals(""))
        continue;
     
      watch.reset();
      watch.start();
      List<Document> docs = searcher.searchDocs(question);
      watch.stop();
      for (Document doc : docs) {
        LogInfo.log(
            "Mid: " + doc.get(FbIndexField.MID.fieldName()) + "\t" +
                "id: " + doc.get(FbIndexField.ID.fieldName()) + "\t" +
                "types: " + doc.get(FbIndexField.TYPES.fieldName()) + "\t" +
View Full Code Here

Examples of hampi.utils.StopWatch

   * characters). The solution is optionally verified (depending on
   * {@link #validateSolution} variable).
   */
  public Solution solve(Constraint c, int size){
    assert c != null;
    StopWatch sw = new StopWatch("Solving using " + solver.getName());
    if (verbose){
      System.out.println("Solving using " + solver.getName());
      sw.start();
    }
    Solution sol = solver.solve(c, size);
    if (verbose){
      sw.stop();
      System.out.println(sw);
    }

    if (validateSolution && sol.isSatisfiable()){
      assert sol.isValidFor(c) : "invalid solution:\n" + c + "\n" + sol;
View Full Code Here

Examples of hirondelle.web4j.util.Stopwatch

  private static final String UNSPECIFIED = "Unspecified in Manifest";
  private static final long MILLISECONDS_PER_DAY = 1000*60*60*24L;
  private static final Logger fLogger = Util.getLogger(ShowDiagnostics.class);
 
  private void placeDiagnosticDataInScope(HttpServletRequest aRequest, HttpServletResponse aResponse) throws DAOException {
    Stopwatch stopwatch = new Stopwatch();
    stopwatch.start();
   
    fLogger.fine("Adding system properties.");
    addToRequest("systemProperties", sortMap(System.getProperties()));
    fLogger.fine("Adding Context init-params.");
    addToRequest("contextInitParams", sortMap(getContextInitParams(aRequest)));
    fLogger.fine("Adding application scope items.");
    addToRequest("appScopeItems", getAppScope(aRequest));
    fLogger.fine("Adding session scope items.");
    addToRequest("sessionScopeItems", getSessionScope(aRequest));
    fLogger.fine("Adding container/servlet info.");
    addToRequest("containerServletInfo", getContainerServletInfo(aRequest));
    fLogger.fine("Adding request info.");
    addToRequest("requestInfo", getRequestInfo(aRequest));
    fLogger.fine("Adding database information.");
    addToRequest("dbInfo", getDbInfo());
    fLogger.fine("Adding loggers.");
    addToRequest("loggers", getLoggers());
    fLogger.fine("Adding Controller name/version");
    addToRequest("controller_name_version", Controller.WEB4J_VERSION);
    fLogger.fine("Adding JAR versions.");
    addToRequest("jarVersions", getJarVersions(aRequest));
    fLogger.fine("Adding uptime.");
    addToRequest("uptime", getUptime(aRequest));
    fLogger.fine("Adding request headers.");
    addToRequest("headers", getHeaders(aRequest));
    addToRequest("responseEncoding", getResponseEncoding(aResponse));
    fLogger.fine("Adding cookies.");
    addToRequest("cookies", getCookies(aRequest));
   
    fLogger.fine("Finished retrieving data.");
    stopwatch.stop();
    addToRequest("stopwatch", stopwatch.toString());
  }
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.