public class MultiThreadRecorder extends AbstractRecorder
AbstractRecorder.Collect, AbstractRecorder.Collector, AbstractRecorder.EveryPattern<T extends SpeedEvent>, AbstractRecorder.StatisticPattern<V>
限定符和类型 | 字段和说明 |
---|---|
private Map<String,List<Long>> |
nums |
private boolean |
partThread |
private Map<String,Long> |
startTimes |
private int |
totalCount |
everyPattern, name, state, statisticPattern
限定符 | 构造器和说明 |
---|---|
private |
MultiThreadRecorder(String name)
实例化计速器
|
限定符和类型 | 方法和说明 |
---|---|
static MultiThreadRecorder |
build(Class clazz) |
static MultiThreadRecorder |
build(String name) |
void |
onEnd()
结束一次记录,在这里进行一次记录的输出,同时将耗时的值保存到列表用于统计
|
void |
onReset()
重置记录器
|
void |
onStart()
开始一次记录,在这里应该创建一个SpeedEvent实体对象,传入开始时间
|
protected void |
onStatistics()
统计结果
|
void |
onStop()
停止记录器,在这里将对记录器中所有内容进行统计,统计完成后清空记录器内容
|
protected AbstractRecorder.EveryPattern |
setEveryPattern()
向记录器中添加默认的记录接口
|
MultiThreadRecorder |
setPartThread(boolean partThread)
设置是否输出每个线程单独的统计信息
|
protected AbstractRecorder.StatisticPattern |
setStatisticPattern()
向记录器中添加默认的统计接口
|
collect, end, getEveryPattern, getName, getStatisticPattern, reset, setEveryPattern, setStatisticPattern, start, statistics, stop
private MultiThreadRecorder(String name)
name
- 记录器名称protected AbstractRecorder.EveryPattern setEveryPattern()
setEveryPattern
在类中 AbstractRecorder
protected AbstractRecorder.StatisticPattern setStatisticPattern()
setStatisticPattern
在类中 AbstractRecorder
public void onStart()
onStart
在类中 AbstractRecorder
public void onEnd()
onEnd
在类中 AbstractRecorder
public void onReset()
onReset
在类中 AbstractRecorder
public void onStop()
onStop
在类中 AbstractRecorder
protected void onStatistics()
onStatistics
在类中 AbstractRecorder
public MultiThreadRecorder setPartThread(boolean partThread)
partThread
- true:输出,false:不输出public static MultiThreadRecorder build(String name)
public static MultiThreadRecorder build(Class clazz)
Copyright © 2020. All rights reserved.