com.vaadin.client
Class Profiler

java.lang.Object
  extended by com.vaadin.client.Profiler
Direct Known Subclasses:
Profiler.EnabledProfiler

public class Profiler
extends java.lang.Object

Lightweight profiling tool that can be used to collect profiling data with zero overhead unless enabled. To enable profiling, add <set-property name="vaadin.profiler" value="true" /> to your .gwt.xml file.

Since:
7.0.0
Author:
Vaadin Ltd

Nested Class Summary
static class Profiler.EnabledProfiler
          Class to include using deferred binding to enable the profiling.
 
Constructor Summary
Profiler()
           
 
Method Summary
static void enter(java.lang.String name)
          Enters a named block.
static void initialize()
          Initializes the profiler.
static boolean isEnabled()
          Checks whether the profiling gathering is enabled.
protected  boolean isImplEnabled()
          Overridden in Profiler.EnabledProfiler to make isEnabled() return true if GWT.create returns that class.
static void leave(java.lang.String name)
          Leaves a named block.
static void logBootstrapTimings()
          Outputs the time passed since various events recored in performance.timing if supported by the browser.
static void logTimings()
          Outputs the gathered profiling data to the debug console.
static void reset()
          Resets the collected profiler data.
static void setProfilerResultConsumer(ProfilerSection.ProfilerResultConsumer profilerResultConsumer)
          Sets the profiler result consumer that is used to output the profiler data to the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Profiler

public Profiler()
Method Detail

isEnabled

public static boolean isEnabled()
Checks whether the profiling gathering is enabled.

Returns:
true if the profiling is enabled, else false

enter

public static void enter(java.lang.String name)
Enters a named block. There should always be a matching invocation of leave(String) when leaving the block. Calls to this method will be removed by the compiler unless profiling is enabled.

Parameters:
name - the name of the entered block

leave

public static void leave(java.lang.String name)
Leaves a named block. There should always be a matching invocation of enter(String) when entering the block. Calls to this method will be removed by the compiler unless profiling is enabled.

Parameters:
name - the name of the left block

reset

public static void reset()
Resets the collected profiler data. Calls to this method will be removed by the compiler unless profiling is enabled.


initialize

public static void initialize()
Initializes the profiler. This should be done before calling any other function in this class. Failing to do so might cause undesired behavior. This method has no side effects if the initialization has already been done.

Please note that this method should be called even if the profiler is not enabled because it will then remove a logger function that might have been included in the HTML page and that would leak memory unless removed.

Since:
7.0.2

logTimings

public static void logTimings()
Outputs the gathered profiling data to the debug console.


isImplEnabled

protected boolean isImplEnabled()
Overridden in Profiler.EnabledProfiler to make isEnabled() return true if GWT.create returns that class.

Returns:
true if the profiling is enabled, else false

logBootstrapTimings

public static void logBootstrapTimings()
Outputs the time passed since various events recored in performance.timing if supported by the browser.


setProfilerResultConsumer

public static void setProfilerResultConsumer(ProfilerSection.ProfilerResultConsumer profilerResultConsumer)
Sets the profiler result consumer that is used to output the profiler data to the user.

Warning! This is internal API and should not be used by applications or add-ons.

Parameters:
profilerResultConsumer - the consumer that gets profiler data
Since:
7.1.4


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.