directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r526144 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec: TwixDecoder.java TwixEncoder.java
Date Fri, 06 Apr 2007 12:50:27 GMT
Author: elecharny
Date: Fri Apr  6 05:50:26 2007
New Revision: 526144

URL: http://svn.apache.org/viewvc?view=rev&rev=526144
Log:
Added some timing instructions, commented (to use them, one should simply uncomment the //TM
)

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java?view=diff&rev=526144&r1=526143&r2=526144
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
Fri Apr  6 05:50:26 2007
@@ -46,6 +46,10 @@
  */
 public class TwixDecoder implements ProviderDecoder
 {
+    //TM private static long cumul = 0L;
+    //TM private static long count = 0L;
+    //TM private Object lock = new Object();
+
     /** The logger */
     private static Logger log = LoggerFactory.getLogger( TwixDecoder.class );
 
@@ -87,6 +91,7 @@
      */
     public void decode( Object encoded ) throws DecoderException
     {
+        //TM long t0 = System.nanoTime();
         ByteBuffer buf;
         int position = 0;
 
@@ -138,7 +143,23 @@
                     }
     
                     decoderCallback.decodeOccurred( null, ldapMessageContainer.getLdapMessage()
);
+
                     ldapMessageContainer.clean();
+                    //TM long t1 = System.nanoTime();
+                    //TM
+                    //TM synchronized (lock)
+                    //TM {
+                    //TM     cumul += (t1 - t0);
+                    //TM     count++;
+                    //TM    
+                    //TM
+                    //TM     if ( count % 1000L == 0)
+                    //TM     {
+                    //TM         System.out.println( "Decode cost : " + (cumul/count) );
+                    //TM         cumul = 0L;
+                    //TM     }
+                    //TM }
+                    
                 }
                 else
                 {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java?view=diff&rev=526144&r1=526143&r2=526144
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
Fri Apr  6 05:50:26 2007
@@ -46,6 +46,10 @@
  */
 public class TwixEncoder implements ProviderEncoder
 {
+    //TM private static long cumul = 0L;
+    //TM private static long count = 0L;
+    //TM private Object lock = new Object();
+
     /** The logger */
     private static Logger log = LoggerFactory.getLogger( TwixEncoder.class );
 
@@ -192,8 +196,23 @@
      */
     public void encode( Object obj ) throws EncoderException
     {
+        //TM long t0 = System.nanoTime();
         ByteBuffer encoded = encodeBlocking( obj );
         encodeCallback.encodeOccurred( null, encoded );
+        //TM long t1 = System.nanoTime();
+        
+        //TM synchronized (lock)
+        //TM {
+        //TM     cumul += (t1 - t0);
+        //TM     count++;
+        //TM    
+        //TM
+        //TM     if ( count % 1000L == 0)
+        //TM     {
+        //TM         System.out.println( "Encode cost : " + (cumul/count) );
+        //TM         cumul = 0L;
+        //TM     }
+        //TM }
     }
 
 



Mime
View raw message