reschke commented on code in PR #813:
URL: https://github.com/apache/jackrabbit-oak/pull/813#discussion_r1064698301


##########
oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java:
##########
@@ -78,6 +80,23 @@ public class SessionDelegate {
     static final Logger readOperationLogger = 
LoggerFactory.getLogger("org.apache.jackrabbit.oak.jcr.operations.reads");
     static final Logger writeOperationLogger = 
LoggerFactory.getLogger("org.apache.jackrabbit.oak.jcr.operations.writes");
 
+    // the bitmask used for trace level logging
+    // we use a bitmask instead of a counter to avoid the slow modulo 
operation:
+    // 
https://stackoverflow.com/questions/27977834/why-is-modulus-operator-slow
+    // so we use "if ((counter & LOG_TRACE_BIT_MASK) == 0) log(...)"
+    // instead of the slower "if ((counter % LOG_TRACE) == 0) log(...)"
+    // that means the values need to be some power of two, minus one
+    // log every 128th call by default
+    private static final long LOG_TRACE_BIT_MASK = 
SystemPropertySupplier.create(
+            "org.apache.jackrabbit.oak.jcr.operations.bitMask",
+            128L - 1).loggingTo(log).get();
+    // log a stack trace every ~1 million calls by default
+    private static final long LOG_TRACE_STACK_BIT_MASK = 
SystemPropertySupplier.create(
+            "org.apache.jackrabbit.oak.jcr.operations.stack.bitMask",

Review Comment:
   wrong sys prop name?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to