public class SimpleStatsCollector extends AbstractMustacheListener
MustacheListener collecting template rendering statistics.
Note that the template is identified with the name/id - so data will not be
correct if there's more than one templates with the same name.
It's possible to specify the time unit for measurements. By default
TimeUnit.MILLISECONDS is used.
It's also possible to specify a Predicate to filter out some
templates. By default templates used for Lambda interpolation are skipped.| Modifier and Type | Class and Description |
|---|---|
class |
SimpleStatsCollector.SimpleStats |
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.cache.LoadingCache<java.lang.String,com.google.common.cache.LoadingCache<java.lang.Long,java.util.concurrent.atomic.AtomicLong>> |
data
Data: name -> (time -> amount)
|
static com.google.common.base.Predicate<java.lang.String> |
IS_NOT_ONEOFF_LAMBA_TEMPLATE
Skip templates used for Lambda return value interpolation.
|
protected com.google.common.base.Predicate<java.lang.String> |
templatePredicate |
protected java.util.concurrent.TimeUnit |
timeUnit |
| Constructor and Description |
|---|
SimpleStatsCollector() |
SimpleStatsCollector(com.google.common.base.Predicate<java.lang.String> templatePredicate,
java.util.concurrent.TimeUnit timeUnit) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearData()
Drop all the collected data.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> |
getData() |
java.util.Map<java.lang.Long,java.lang.Long> |
getData(java.lang.String templateId) |
java.util.Set<SimpleStatsCollector.SimpleStats> |
getSimpleStats() |
SimpleStatsCollector.SimpleStats |
getSimpleStats(java.lang.String templateId) |
java.util.concurrent.TimeUnit |
getTimeUnit() |
void |
renderingStarted(MustacheRenderingEvent event)
Rendering of a
Mustache is about to start. |
compilationFinished, parsingStarted, renderingFinishedgetConfigurationKeys, checkNotInitialized, initclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConfigurationKeys, initpublic static final com.google.common.base.Predicate<java.lang.String> IS_NOT_ONEOFF_LAMBA_TEMPLATE
Lambda.ONEOFF_LAMBDA_TEMPLATE_PREFIXprotected final java.util.concurrent.TimeUnit timeUnit
protected final com.google.common.base.Predicate<java.lang.String> templatePredicate
protected final com.google.common.cache.LoadingCache<java.lang.String,com.google.common.cache.LoadingCache<java.lang.Long,java.util.concurrent.atomic.AtomicLong>> data
public SimpleStatsCollector()
public SimpleStatsCollector(com.google.common.base.Predicate<java.lang.String> templatePredicate,
java.util.concurrent.TimeUnit timeUnit)
templatePredicate - timeUnit - public void renderingStarted(MustacheRenderingEvent event)
MustacheListenerMustache is about to start. Always use
ReleaseCallbackContainer.registerReleaseCallback(ReleaseCallback)
to release all the necessary resources.renderingStarted in interface MustacheListenerrenderingStarted in class AbstractMustacheListenerpublic void clearData()
public java.util.Map<java.lang.Long,java.lang.Long> getData(java.lang.String templateId)
templateId - public java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> getData()
public SimpleStatsCollector.SimpleStats getSimpleStats(java.lang.String templateId)
templateId - public java.util.Set<SimpleStatsCollector.SimpleStats> getSimpleStats()
public java.util.concurrent.TimeUnit getTimeUnit()
Copyright © 2014. All Rights Reserved.