Package org.javasimon

Examples of org.javasimon.Stopwatch


    addMemoryPageAndGetFirstSlot();
    logger.info("Cache initialization ok");
  }
 
  public void disposeExpired() {
        Stopwatch stopWatch = SimonManager.getStopwatch("detail.disposeExpired");
    Split split = stopWatch.start();
   
    for (Iterator<CacheEntry> iterator = entries.values().iterator(); iterator.hasNext();) {
      CacheEntry entry = iterator.next();
      if (entry.expired()) {
        remove(entry.key);
View Full Code Here


 
  public void disposeHeapOverflow() {
    if (entriesLimit == -1) {
      return;
    }
        Stopwatch stopWatch = SimonManager.getStopwatch("detail.disposeHeapOverflow");
    Split split = stopWatch.start();
   
    moveEntriesOffHeap(lruQueue.size() - entriesLimit);

    split.stop();
  }
View Full Code Here

    split.stop();
  }
 
  public void disposeOffHeapOverflow() {
        Stopwatch stopWatch = SimonManager.getStopwatch("detail.disposeOffHeapOverflow");
    Split split = stopWatch.start();
    int bytes2free = usedMemory.get()-(pageSize*pages);
   
    moveEntriesToDisk(bytes2free);
   
    split.stop();
 
View Full Code Here

//    }
//    split.stop();
//  }
 
  public void askSupervisorForDisposal() {
        Stopwatch stopWatch = SimonManager.getStopwatch("detail.disposeOverflow");
    Split split = stopWatch.start();
    supervisor.disposeOverflow(this);
    split.stop();
  }
View Full Code Here

////    logger.info(entry.key + " position " + entry.position + " size " + entry.size);
//    split.stop();
//  }
 
  protected void moveInHeap(CacheEntry entry) {
        Stopwatch stopWatch = SimonManager.getStopwatch("detail.moveinheap");
    Split split = stopWatch.start();
    byte[] source = null;
    source = new byte[entry.size];
    try {
      synchronized (entry) {
        ByteBuffer buf = entry.buffer;
View Full Code Here

    }
   
  }

  public CacheEntry put(String key, Object object) {
        Stopwatch stopWatch = SimonManager.getStopwatch("cache.put");
    Split split = stopWatch.start();
    CacheEntry entry = new CacheEntry();
    entry.key = key;
    entry.object = object;
    entries.put(key, entry);
    lruQueue.add(entry);
View Full Code Here

    }
    return entry;
  }
 
  public Object get(String key) {
        Stopwatch stopWatch = SimonManager.getStopwatch("cache.get");
    Split split = stopWatch.start();
    CacheEntry entry = getEntry(key);
    askSupervisorForDisposal();
    split.stop();
    if (entry == null) {
      return null;
View Full Code Here

      return entry.object;
    }
  }
 
  public CacheEntry remove(String key) {
        Stopwatch stopWatch = SimonManager.getStopwatch("cache.remove");
    Split split = stopWatch.start();
    CacheEntry entry = entries.remove(key);
    if (entry.inHeap()) {
      lruQueue.remove(entry);
    } else {
      usedMemory.addAndGet(-entry.size);
View Full Code Here

    split.stop();
    return entry;
  }
 
  public CacheEntry removeLast() {
        Stopwatch stopWatch = SimonManager.getStopwatch("detail.removelast");
    Split split = stopWatch.start();
    CacheEntry next = lruQueue.peek();
    if (next.size > slots.last().size) {
      split.stop();
      return null;
    }
View Full Code Here

    split.stop();
    return last;
  }
 
  public CacheEntry removeLastOffHeap() {
        Stopwatch stopWatch = SimonManager.getStopwatch("detail.removelastoffheap");
    Split split = stopWatch.start();
    CacheEntry last = lruOffheapQueue.poll();
    if (last == null) {
      logger.warn("no lru from off heap");
      split.stop();
      return null;
View Full Code Here

TOP

Related Classes of org.javasimon.Stopwatch

Copyright © 2018 www.massapicom. 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.