Package org.slf4j.profiler

Examples of org.slf4j.profiler.Profiler


     * @param profilerName name of the profiler you want to use or create
     * @param action       the action you want to profile
     */
    public void startProfiler(String profilerName, String action) {
        final ProfilerRegistry profilerRegistry = ProfilerRegistry.getThreadContextInstance();
        Profiler profiler = profilerRegistry.get(profilerName);
        if (profiler == null) {
            profiler = new Profiler(profilerName);
            profiler.setLogger(profilerMetricsLogger);
            profiler.registerWith(profilerRegistry);
        }
        profiler.start(action);
    }
View Full Code Here


     *
     * @param profilerName the name of the profiler you want to stop
     */
    public void stopProfiler(String profilerName) {
        final ProfilerRegistry profilerRegistry = ProfilerRegistry.getThreadContextInstance();
        Profiler profiler = profilerRegistry.get(profilerName);
        if (profiler != null) {
            profiler.stop().log();
        }
        profilerRegistry.clear();
        threadLocal.set(null);
    }
View Full Code Here

            profilers.push(profilerRegistry.get(parentProfilerName));
            threadLocal.set(profilers);
        } else {
            profilers = threadLocal.get();
        }
        Profiler profiler = profilers.peek();
        if (profiler == null) {
            profiler = startProfiler(parentProfilerName);
            profilers.push(profiler);
        }
        Profiler nestedProfiler = profiler.startNested(nestedProfilerName);
        profilers.push(nestedProfiler);
        return nestedProfiler;
    }
View Full Code Here

     * @param parentProfilerName the parent profiler name
     * @param nestedProfilerName the sub profiler name
     */
    public void stopNestedProfiler(String parentProfilerName, String nestedProfilerName) {
        Stack<Profiler> profilers = threadLocal.get();
        final Profiler profiler = profilers.pop();
        if (profiler.getName().equals(nestedProfilerName)) {
            profiler.stop();
        }
    }
View Full Code Here

        }
    }

    public Profiler startProfiler(String profilerName) {
        final ProfilerRegistry profilerRegistry = ProfilerRegistry.getThreadContextInstance();
        Profiler profiler = profilerRegistry.get(profilerName);
        if (profiler == null) {
            profiler = new Profiler(profilerName);
            profiler.setLogger(profilerMetricsLogger);
            profiler.registerWith(profilerRegistry);
        }
        return profiler;
    }
View Full Code Here

    public String prepare(RenderContext context, Resource resource, RenderChain chain) throws Exception {
        JCRNodeWrapper node = resource.getNode();

        String profilerName = "render module " + node.getPath();
        Profiler profiler = loggingService.createNestedProfiler("MAIN", profilerName);
        profiler.start("render filters for " + node.getPath());
        context.getRequest().setAttribute("profiler", profiler);
        return null;
    }
View Full Code Here

public class TemplateScriptFilter extends AbstractFilter {

    private static Logger logger = org.slf4j.LoggerFactory.getLogger(TemplateScriptFilter.class);

    public String prepare(RenderContext renderContext, Resource resource, RenderChain chain) throws Exception {
        Profiler profiler = (Profiler) renderContext.getRequest().getAttribute("profiler");
        if (profiler != null) {
            profiler.start("render template " + resource.getResolvedTemplate());
        }

        HttpServletRequest request = renderContext.getRequest();
        Script script = (Script) request.getAttribute("script");
        renderContext.getResourcesStack().push(resource);
View Full Code Here

          params.add(new PreparedStatementParameterImpl(value, PreparedStatementParameterImpl.UNKNOWN));
        }
      }
    }

    Profiler profiler = Util.newProfiler("");
    profiler.start(_sqlType.getName() + ".select()");
    try {
      return database.getDBExecutionKernel().executeSelect(sql, new SQLTypeInfoQueryProcessor(returnType), params.toArray(new IPreparedStatementParameter[params.size()]));
    } finally {
      profiler.stop();
    }
  }
View Full Code Here

* To change this template use File | Settings | File Templates.
*/
public class Util {

  public static Profiler newProfiler(String name) {
    Profiler parent = ProfilerRegistry.getThreadContextInstance().get("_REQUEST");
    if (parent != null) {
      return parent.startNested(name);
    } else {
      return new Profiler(name);
    }
  }
View Full Code Here

TOP

Related Classes of org.slf4j.profiler.Profiler

Copyright © 2018 www.massapicom. 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.