Examples of Timer


Examples of dclong.util.Timer

import dclong.util.Timer;

public class TestTimer {
  public static void main(String[] args) throws InterruptedException{
    Timer timer = new Timer();
    timer.start();
    Thread.sleep(1000);
    timer.stop();
    timer.printSeconds("sleeping");
  }
View Full Code Here

Examples of edu.cmu.sphinx.util.Timer

        allocateAcousticModel();
        grammar.allocate();
        hmmPool = new HMMPool(acousticModel, logger, unitManager);
        nodeToNextUnitArrayMap = new HashMap<GrammarNode, int[]>();
        nodeToUnitSetMap = new HashMap<GrammarNode, Set<Unit>>();
        Timer timer = TimerPool.getTimer(this, "compileGrammar");
        timer.start();
        compileGrammar();
        timer.stop();
        logger.info("Done allocating  DFLAT");
    }
View Full Code Here

Examples of edu.uci.jforestsx.util.Timer

      evaluationMetric = getEvaluationMetric(trainingConfig.evaluationMetric);

      createLearner();

      Timer timer = new Timer();
      timer.start();
      Ensemble ensemble = topLearner.learn(trainSet, validSet);
      System.out.println("Time taken to build model: " + (timer.getElapsedMillis() / 1000.0) + " seconds.");
      return ensemble;

    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of elemental.util.Timer

    getView().setAnimationController(AnimationController.FADE_ANIMATION_CONTROLLER);

    positionController = new PositionController(positioner, getView().getElement());

    showTimer = new Timer() {
      @Override
      public void run() {
        show();
      }
    };
View Full Code Here

Examples of engine.util.Timer

   
    Long lo[] = {1L,1L};
    for(int i=0;i<100;i++) {
      this.processTimes.add(lo);
    }
    this.graphTimer = new Timer();
   
    initGL();
    resizeGL();
   
    appSpeed = 1.0f;
View Full Code Here

Examples of fcagnin.jgltut.framework.Timer

                return currTimer.update( getElapsedTime() );
            }

            void startAnimation(int destinationIndex, float duration) {
                finalOrientIndex = destinationIndex;
                currTimer = new Timer( Timer.Type.SINGLE, duration );
            }
View Full Code Here

Examples of fr.irit.halterego.rrl_ggp.util.Timer

        return createRLGlueAction(action);
    }
   
    private void explore(RState state, final int timeout)
    {
        Timer t = new Timer();
      
        while(true)
        {
            if(t.getElapsedTime() >= (timeout * 0.8))
            {
                break;
            }
           
            List<Agent> agents = new ArrayList<Agent>();
View Full Code Here

Examples of gov.nara.nwts.ftapp.Timer

    }
   
  }

  public ActionResult importFile(File selectedFile) throws IOException {
    Timer timer = new Timer();
    TreeMap<String,Stats> types = new TreeMap<String,Stats>();
    try {
      BufferedReader br = new BufferedReader(new FileReader(selectedFile));
      int i=1000000;
      for(String line=br.readLine(); line!=null; line=br.readLine()){
        String key = ""+ (i++);
        Stats stats = new Stats(key);
        types.put(key, stats);
        Matcher m = test(line);
        setVals(m, stats, line);
      }
      br.close();
      return new ActionResult(selectedFile, selectedFile.getName(), this.toString(), mydetails, types, true, timer.getDuration());
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return new ActionResult(selectedFile, selectedFile.getName(), this.toString(), mydetails, types, false, timer.getDuration());
  }
View Full Code Here

Examples of gov.nysenate.openleg.util.Timer

        return ingestFiles(Arrays.asList(files));
    }

    public HashMap<String, Change> ingestFiles(Collection<File> files)
    {
        Timer timer = new Timer();
        Storage storage = new Storage(getStorageDirectory());
        BillProcessor billProcessor = new BillProcessor();
        CalendarProcessor calendarProcessor = new CalendarProcessor();
        AgendaProcessor agendaProcessor = new AgendaProcessor();
        TranscriptProcessor transcriptProcessor = new TranscriptProcessor();

        Collections.sort((List<File>)files, new FileNameComparator());

        // Process each file individually, flushing changes to storage as necessary
        // Each file processor should produce a change log indicating what happened
        timer.start();
        for(File file : files) {
            try {
                logger.debug("Ingesting: "+file);
                String type = file.getParentFile().getName();
                if (type.equals("bills")) {
                    billProcessor.process(file, storage);
                }
                else if (type.equals("calendars")) {
                    calendarProcessor.process(file, storage);
                }
                else if (type.equals("agendas")) {
                    agendaProcessor.process(file, storage);
                }
                else if (type.equals("annotations")) {
                    continue;
                }
                else if (type.equals("transcripts")) {
                    transcriptProcessor.process(file, storage);
                }

                // To avoid memory issues, occasionally flush changes to file-system and truncate memory
                if (storage.memory.size() > 4000) {
                    storage.flush();
                    storage.clear();
                }

            }
            catch (IOException e) {
                logger.error("Issue with "+file.getName(), e);
            }
            catch (UnmarshalException e) {
                logger.error("Issue with "+file.getName(), e);
            }
            catch (JAXBException e) {
                logger.error("Unable to parse xml "+file.getName(), e);
            }
        }
        storage.flush();
        logger.info(timer.stop()+" seconds to injest "+files.size()+" files.");
        return ChangeLogger.getChangeLog();
    }
View Full Code Here

Examples of grails.plugin.cache.Timer

  protected PageInfo buildNewPageInfo(HttpServletRequest request, HttpServletResponse response,
      FilterChain chain, CacheStatus cacheStatus,
      Map<String, Collection<CacheOperationContext>> operationsByType) throws Exception {

    Timer timer = new Timer(getCachedUri(request));
    timer.start();

    String key = calculateKey(request);
    PageInfo pageInfo;
    try {
      // Page is not cached - build the response, cache it, and send to client
      pageInfo = buildPage(request, response, chain);
      if (pageInfo.isOk()) {
        Object noCache = pageInfo.getCacheDirectives().get("no-cache");
        if (noCache instanceof Boolean && ((Boolean)noCache)) {
          log.debug("Response ok but Cache-Control: no-cache is present, not caching");
          releaseCacheLocks(operationsByType, key);
        }
        else {
          Collection<Cache> caches = new ArrayList<Cache>();
          for (CacheOperationContext operationContext : operationsByType.get(UPDATE)) {
            for (Cache cache : operationContext.getCaches()) {
              caches.add(cache);
            }
          }
          update(caches, pageInfo, cacheStatus, key);
        }
      }
      else {
        for (CacheOperationContext operationContext : operationsByType.get(UPDATE)) {
          for (Cache cache : operationContext.getCaches()) {
            log.debug("Response not ok ({}). Putting null into cache {} with key {}",
                new Object[] { pageInfo.getStatusCode(), cache.getName(), key } );
          }
        }
        releaseCacheLocks(operationsByType, key);
      }
    }
    catch (Exception e) {
            if("net.sf.ehcache.constructs.blocking.LockTimeoutException".equals(e.getClass().getName())) {
          //do not release the lock, because you never acquired it
          throw e;
            }
      // Must unlock the cache if the above fails. Will be logged at Filter
      releaseCacheLocks(operationsByType, key);
      throw e;
    }

    timer.stop(false);
    response.addHeader(X_CACHED, String.valueOf(false));
    return pageInfo;
  }
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.