Package org.javasimon

Examples of org.javasimon.Split.stop()


     
      byte[] src = null;
      try {
        Split serSplit = serializeMon.start();
        src = Starter.serialize(obj);
        serSplit.stop();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      Split split2 = writerMon.start();
View Full Code Here


      synchronized (entry.buffer) {
        entry.buffer.position(entry.position);
        entry.buffer.put(src);
      }
      count++;
      split2.stop();
    }
   
//    long elapsed = Calendar.getInstance().getTimeInMillis()-started;
//    System.out.println("writer did " + count + " writes in " + (elapsed) + " msecs - " + ((double)count / (double)elapsed) + " ops per msec");
//    System.out.println("writer ops took " + ((double)elapsed / (double)count) + " msecs each");
View Full Code Here

      entry.key = "key"+(count++);
      DummyPojo obj = new DummyPojo(entry.key, objectSize);
     
      Split serSplit = serializeMon.start();
      byte[] src = serialize(obj);
      serSplit.stop();
      Split split = setupMon.start();
      entry.size = src.length;
      entry.buffer = buffer.duplicate();
      entry.position = memoryUsed;
      entry.buffer.position(memoryUsed);
View Full Code Here

        // TODO: handle exception
        e.printStackTrace();
      }
      map.put(entry.key, entry);
      memoryUsed+=entry.size;
      split.stop();
    }
       
        System.out.println("setupMon: " + setupMon);
    System.out.println("average append duration: " + (double)(setupMon.getTotal() / setupMon.getCounter())/1000000 + "ms");
    System.out.println("average serialize duration: " + (double)(serializeMon.getTotal() / serializeMon.getCounter())/1000000 + "ms");
View Full Code Here

    try {
      protostuff = ProtostuffIOUtil.toByteArray(obj, schema, buffer);
    } finally {
      buffer.clear();
    }   
    split.stop();
    return protostuff;
  }

  /* (non-Javadoc)
   * @see org.directmemory.utils.Serializer#deserialize(byte[], java.lang.Class)
View Full Code Here

    Split split = stopWatch.start();
    final Object object = clazz.newInstance();
    @SuppressWarnings("rawtypes")
    final Schema schema = RuntimeSchema.getSchema(clazz);
    ProtostuffIOUtil.mergeFrom(source, object, schema);
    split.stop();
    return object;
 
}
View Full Code Here

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(obj);
    oos.flush();
    oos.close();
    split.stop();
    return baos.toByteArray();   
  }

  public Serializable deserialize(byte[] source, @SuppressWarnings("rawtypes") Class clazz) throws IOException, ClassNotFoundException {
        Stopwatch stopWatch = SimonManager.getStopwatch("serializer.javaDeserialize");
View Full Code Here

    Split split = stopWatch.start();
    ByteArrayInputStream bis = new ByteArrayInputStream(source);
    ObjectInputStream ois = new ObjectInputStream(bis);
    Serializable obj = (Serializable) ois.readObject();
    ois.close();
    split.stop();
    return obj;
  }
}
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.