Package org.stagemonitor.benchmark.profiler.simple

Source Code of org.stagemonitor.benchmark.profiler.simple.AroundProfiler

package org.stagemonitor.benchmark.profiler.simple;

import org.stagemonitor.requestmonitor.profiler.CallStackElement;

public class AroundProfiler {
  static final ThreadLocal<CallStackElement> methodCallParent =
      new ThreadLocal<CallStackElement>();

  public static CallStackElement start(String signature) {
    CallStackElement cse = new CallStackElement(methodCallParent.get(), signature);
    methodCallParent.set(cse);
    return cse;
  }

  public static void stop(CallStackElement currentStats) {
    currentStats.executionStopped(System.nanoTime() - currentStats.getExecutionTime());
    methodCallParent.set(currentStats.getParent());
  }

  public static void setMethodCallRoot(CallStackElement root) {
    methodCallParent.set(root);
  }
}
TOP

Related Classes of org.stagemonitor.benchmark.profiler.simple.AroundProfiler

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.