Stats Helper

A stats helper

Лицензия

Лицензия

The Artistic License 2.0
Категории

Категории

Ant Компиляция и сборка
Группа

Группа

com.github.phantomthief
Идентификатор

Идентификатор

stats-helper
Последняя версия

Последняя версия

0.2.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

Stats Helper
A stats helper
Ссылка на сайт

Ссылка на сайт

https://github.com/PhantomThief/stats-helper
Система контроля версий

Система контроля версий

https://github.com/PhantomThief/stats-helper.git

Скачать stats-helper

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.phantomthief/stats-helper/ -->
<dependency>
    <groupId>com.github.phantomthief</groupId>
    <artifactId>stats-helper</artifactId>
    <version>0.2.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.phantomthief/stats-helper/
implementation 'com.github.phantomthief:stats-helper:0.2.2'
// https://jarcasting.com/artifacts/com.github.phantomthief/stats-helper/
implementation ("com.github.phantomthief:stats-helper:0.2.2")
'com.github.phantomthief:stats-helper:jar:0.2.2'
<dependency org="com.github.phantomthief" name="stats-helper" rev="0.2.2">
  <artifact name="stats-helper" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.phantomthief', module='stats-helper', version='0.2.2')
)
libraryDependencies += "com.github.phantomthief" % "stats-helper" % "0.2.2"
[com.github.phantomthief/stats-helper "0.2.2"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
com.google.guava : guava jar 19.0
joda-time : joda-time jar 2.9.3
org.slf4j : slf4j-api jar 1.7.14
com.github.phantomthief : more-lambdas jar 0.1.8

test (1)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.0.2

Модули Проекта

Данный проект не имеет модулей.

stats-helper

统计最近一段时间的数据

  • 支持自定义的时间间隔(默认10秒、1分钟和1小时)
  • 自定义统计的数据类型
  • 目前只支持jdk1.8

使用

<dependency>
    <groupId>com.github.phantomthief</groupId>
    <artifactId>stats-helper</artifactId>
    <version>0.2.0-SNAPSHOT</version>
</dependency>
// 声明
SimpleDurationStats<SimpleCounter> durationStats = SimpleDurationStats.newBuilder().build();
        
// 执行统计
durationStats.stat(SimpleCounter.stats(10));

// 获取统计数据,key是时间间隔
Map<Long, SimpleCounter> stats = durationStats.getStats();

// 友好输出
DurationStatsUtils.format(stats, Object::toString);
    

注意事项

  • 定制的Counter必须实现com.github.phantomthief.stats.n.counter.Duration接口
  • 可以使用MultiDurationStats实现一个不同key的统计集合

Версии библиотеки

Версия
0.2.2
0.2.1
0.2.0
0.1.0