dsmiley commented on code in PR #2118:
URL: https://github.com/apache/solr/pull/2118#discussion_r1452859545


##########
solr/core/src/java/org/apache/solr/util/ThreadStats.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.util;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadMXBean;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Allows tracking information about the current thread using the JVM's 
built-in management bean
+ * {@link java.lang.management.ThreadMXBean}.
+ *
+ * <p>Calling code should create an instance of this class when starting the 
operation, and then can
+ * get the {@link #getCpuTimeMs()} at any time thereafter.
+ */
+public class ThreadStats {
+  private static final long UNSUPPORTED = -1;
+  public static final String CPU_TIME = "cpuTime";
+  public static final String LOCAL_CPU_TIME = "localCpuTime";
+  public static final String ENABLE_CPU_TIME = "solr.enableCpuTime";

Review Comment:
   @janhoy or "solr.metrics.cputime.enabled" ? Or "logcputime" instead of 
"cputime".  Monitoring is a broad topic, and what's computed here is more like 
a metric.  On the other hand, this addition is not part of the metrics API but 
I suppose it's still reasonable to use that category.
   
https://cwiki.apache.org/confluence/display/SOLR/System+property+naming+structure



-- 
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: issues-unsubscr...@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to