directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1624292 - /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
Date Thu, 11 Sep 2014 13:57:47 GMT
Author: kayyagari
Date: Thu Sep 11 13:57:47 2014
New Revision: 1624292

URL: http://svn.apache.org/r1624292
Log:
added a dedicated logger to log the time taken to perform a simple search

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java?rev=1624292&r1=1624291&r2=1624292&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
Thu Sep 11 13:57:47 2014
@@ -95,6 +95,8 @@ public class SearchRequestHandler extend
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( SearchRequestHandler.class
);
 
+    private static final Logger SEARCH_TIME_LOG = LoggerFactory.getLogger( "org.apache.directory.server.ldap.handlers.request.SEARCH_TIME_LOG"
);
+    
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
@@ -1163,11 +1165,25 @@ public class SearchRequestHandler extend
             // Handle regular search requests from here down
             // ===============================================================
 
-            //long t0 = System.nanoTime();
+            boolean isLogSearchTime = SEARCH_TIME_LOG.isDebugEnabled();
+            
+            long t0 = 0;
+            String filter = null;
+            
+            if ( isLogSearchTime )
+            {
+                t0 = System.nanoTime();
+                filter = req.getFilter().toString();
+            }
+            
             SearchResultDone done = doSimpleSearch( session, req );
-            //long t1 = System.nanoTime();
             session.getIoSession().write( done );
-            //.print( "Handler;" + ((t1-t0)/1000) + ";" );
+            
+            if ( isLogSearchTime )
+            {
+                long t1 = System.nanoTime();
+                SEARCH_TIME_LOG.debug( "Search with filter {} took {}ms. Filter with assigned
counts is {}", filter, ((t1-t0)/1000000), req.getFilter() );
+            }
         }
         catch ( Exception e )
         {



Mime
View raw message