Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
58d222fb
提交
58d222fb
authored
6月 11, 2016
作者:
Jakub Sztandera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove codahale/hdrhistogram as it is not longer used
License: MIT Signed-off-by:
Jakub Sztandera
<
kubuxu@protonmail.ch
>
上级
6bd66cc8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
0 行增加
和
487 行删除
+0
-487
.travis.yml
...orkspace/src/github.com/codahale/hdrhistogram/.travis.yml
+0
-9
LICENSE
...s/_workspace/src/github.com/codahale/hdrhistogram/LICENSE
+0
-21
README.md
..._workspace/src/github.com/codahale/hdrhistogram/README.md
+0
-15
hdr.go
...ps/_workspace/src/github.com/codahale/hdrhistogram/hdr.go
+0
-0
hdr_test.go
...orkspace/src/github.com/codahale/hdrhistogram/hdr_test.go
+0
-333
window.go
..._workspace/src/github.com/codahale/hdrhistogram/window.go
+0
-45
window_test.go
...space/src/github.com/codahale/hdrhistogram/window_test.go
+0
-64
没有找到文件。
Godeps/_workspace/src/github.com/codahale/hdrhistogram/.travis.yml
deleted
100644 → 0
浏览文件 @
6bd66cc8
language
:
go
go
:
-
1.3.3
notifications
:
# See http://about.travis-ci.org/docs/user/build-configuration/ to learn more
# about configuring notification recipients and more.
email
:
recipients
:
-
coda.hale@gmail.com
Godeps/_workspace/src/github.com/codahale/hdrhistogram/LICENSE
deleted
100644 → 0
浏览文件 @
6bd66cc8
The MIT License (MIT)
Copyright (c) 2014 Coda Hale
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Godeps/_workspace/src/github.com/codahale/hdrhistogram/README.md
deleted
100644 → 0
浏览文件 @
6bd66cc8
hdrhistogram
============
[

](https://travis-ci.org/codahale/hdrhistogram)
A pure Go implementation of the
[
HDR Histogram
](
https://github.com/HdrHistogram/HdrHistogram
)
.
> A Histogram that supports recording and analyzing sampled data value counts
> across a configurable integer value range with configurable value precision
> within the range. Value precision is expressed as the number of significant
> digits in the value recording, and provides control over value quantization
> behavior across the value range and the subsequent value resolution at any
> given level.
For documentation, check
[
godoc
](
http://godoc.org/github.com/codahale/hdrhistogram
)
.
Godeps/_workspace/src/github.com/codahale/hdrhistogram/hdr.go
deleted
100644 → 0
浏览文件 @
6bd66cc8
差异被折叠。
点击展开。
Godeps/_workspace/src/github.com/codahale/hdrhistogram/hdr_test.go
deleted
100644 → 0
浏览文件 @
6bd66cc8
package
hdrhistogram_test
import
(
"reflect"
"testing"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/codahale/hdrhistogram"
)
func
TestHighSigFig
(
t
*
testing
.
T
)
{
input
:=
[]
int64
{
459876
,
669187
,
711612
,
816326
,
931423
,
1033197
,
1131895
,
2477317
,
3964974
,
12718782
,
}
hist
:=
hdrhistogram
.
New
(
459876
,
12718782
,
5
)
for
_
,
sample
:=
range
input
{
hist
.
RecordValue
(
sample
)
}
if
v
,
want
:=
hist
.
ValueAtQuantile
(
50
),
int64
(
1048575
);
v
!=
want
{
t
.
Errorf
(
"Median was %v, but expected %v"
,
v
,
want
)
}
}
func
TestValueAtQuantile
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
data
:=
[]
struct
{
q
float64
v
int64
}{
{
q
:
50
,
v
:
500223
},
{
q
:
75
,
v
:
750079
},
{
q
:
90
,
v
:
900095
},
{
q
:
95
,
v
:
950271
},
{
q
:
99
,
v
:
990207
},
{
q
:
99.9
,
v
:
999423
},
{
q
:
99.99
,
v
:
999935
},
}
for
_
,
d
:=
range
data
{
if
v
:=
h
.
ValueAtQuantile
(
d
.
q
);
v
!=
d
.
v
{
t
.
Errorf
(
"P%v was %v, but expected %v"
,
d
.
q
,
v
,
d
.
v
)
}
}
}
func
TestMean
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
if
v
,
want
:=
h
.
Mean
(),
500000.013312
;
v
!=
want
{
t
.
Errorf
(
"Mean was %v, but expected %v"
,
v
,
want
)
}
}
func
TestStdDev
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
if
v
,
want
:=
h
.
StdDev
(),
288675.1403682715
;
v
!=
want
{
t
.
Errorf
(
"StdDev was %v, but expected %v"
,
v
,
want
)
}
}
func
TestTotalCount
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
v
,
want
:=
h
.
TotalCount
(),
int64
(
i
+
1
);
v
!=
want
{
t
.
Errorf
(
"TotalCount was %v, but expected %v"
,
v
,
want
)
}
}
}
func
TestMax
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
if
v
,
want
:=
h
.
Max
(),
int64
(
999936
);
v
!=
want
{
t
.
Errorf
(
"Max was %v, but expected %v"
,
v
,
want
)
}
}
func
TestReset
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
h
.
Reset
()
if
v
,
want
:=
h
.
Max
(),
int64
(
0
);
v
!=
want
{
t
.
Errorf
(
"Max was %v, but expected %v"
,
v
,
want
)
}
}
func
TestMerge
(
t
*
testing
.
T
)
{
h1
:=
hdrhistogram
.
New
(
1
,
1000
,
3
)
h2
:=
hdrhistogram
.
New
(
1
,
1000
,
3
)
for
i
:=
0
;
i
<
100
;
i
++
{
if
err
:=
h1
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
for
i
:=
100
;
i
<
200
;
i
++
{
if
err
:=
h2
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
h1
.
Merge
(
h2
)
if
v
,
want
:=
h1
.
ValueAtQuantile
(
50
),
int64
(
99
);
v
!=
want
{
t
.
Errorf
(
"Median was %v, but expected %v"
,
v
,
want
)
}
}
func
TestMin
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
if
v
,
want
:=
h
.
Min
(),
int64
(
0
);
v
!=
want
{
t
.
Errorf
(
"Min was %v, but expected %v"
,
v
,
want
)
}
}
func
TestByteSize
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
100000
,
3
)
if
v
,
want
:=
h
.
ByteSize
(),
65604
;
v
!=
want
{
t
.
Errorf
(
"ByteSize was %v, but expected %d"
,
v
,
want
)
}
}
func
TestRecordCorrectedValue
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
100000
,
3
)
if
err
:=
h
.
RecordCorrectedValue
(
10
,
100
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
v
,
want
:=
h
.
ValueAtQuantile
(
75
),
int64
(
10
);
v
!=
want
{
t
.
Errorf
(
"Corrected value was %v, but expected %v"
,
v
,
want
)
}
}
func
TestRecordCorrectedValueStall
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
100000
,
3
)
if
err
:=
h
.
RecordCorrectedValue
(
1000
,
100
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
v
,
want
:=
h
.
ValueAtQuantile
(
75
),
int64
(
800
);
v
!=
want
{
t
.
Errorf
(
"Corrected value was %v, but expected %v"
,
v
,
want
)
}
}
func
TestCumulativeDistribution
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
1
,
100000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
actual
:=
h
.
CumulativeDistribution
()
expected
:=
[]
hdrhistogram
.
Bracket
{
hdrhistogram
.
Bracket
{
Quantile
:
0
,
Count
:
1
,
ValueAt
:
0
},
hdrhistogram
.
Bracket
{
Quantile
:
50
,
Count
:
500224
,
ValueAt
:
500223
},
hdrhistogram
.
Bracket
{
Quantile
:
75
,
Count
:
750080
,
ValueAt
:
750079
},
hdrhistogram
.
Bracket
{
Quantile
:
87.5
,
Count
:
875008
,
ValueAt
:
875007
},
hdrhistogram
.
Bracket
{
Quantile
:
93.75
,
Count
:
937984
,
ValueAt
:
937983
},
hdrhistogram
.
Bracket
{
Quantile
:
96.875
,
Count
:
969216
,
ValueAt
:
969215
},
hdrhistogram
.
Bracket
{
Quantile
:
98.4375
,
Count
:
984576
,
ValueAt
:
984575
},
hdrhistogram
.
Bracket
{
Quantile
:
99.21875
,
Count
:
992256
,
ValueAt
:
992255
},
hdrhistogram
.
Bracket
{
Quantile
:
99.609375
,
Count
:
996352
,
ValueAt
:
996351
},
hdrhistogram
.
Bracket
{
Quantile
:
99.8046875
,
Count
:
998400
,
ValueAt
:
998399
},
hdrhistogram
.
Bracket
{
Quantile
:
99.90234375
,
Count
:
999424
,
ValueAt
:
999423
},
hdrhistogram
.
Bracket
{
Quantile
:
99.951171875
,
Count
:
999936
,
ValueAt
:
999935
},
hdrhistogram
.
Bracket
{
Quantile
:
99.9755859375
,
Count
:
999936
,
ValueAt
:
999935
},
hdrhistogram
.
Bracket
{
Quantile
:
99.98779296875
,
Count
:
999936
,
ValueAt
:
999935
},
hdrhistogram
.
Bracket
{
Quantile
:
99.993896484375
,
Count
:
1000000
,
ValueAt
:
1000447
},
hdrhistogram
.
Bracket
{
Quantile
:
100
,
Count
:
1000000
,
ValueAt
:
1000447
},
}
if
!
reflect
.
DeepEqual
(
actual
,
expected
)
{
t
.
Errorf
(
"CF was %#v, but expected %#v"
,
actual
,
expected
)
}
}
func
BenchmarkHistogramRecordValue
(
b
*
testing
.
B
)
{
h
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
b
.
Fatal
(
err
)
}
}
b
.
ResetTimer
()
b
.
ReportAllocs
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
h
.
RecordValue
(
100
)
}
}
func
BenchmarkNew
(
b
*
testing
.
B
)
{
b
.
ReportAllocs
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
hdrhistogram
.
New
(
1
,
120000
,
3
)
// this could track 1ms-2min
}
}
func
TestUnitMagnitudeOverflow
(
t
*
testing
.
T
)
{
h
:=
hdrhistogram
.
New
(
0
,
200
,
4
)
if
err
:=
h
.
RecordValue
(
11
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
func
TestSubBucketMaskOverflow
(
t
*
testing
.
T
)
{
hist
:=
hdrhistogram
.
New
(
2e7
,
1e8
,
5
)
for
_
,
sample
:=
range
[
...
]
int64
{
1e8
,
2e7
,
3e7
}
{
hist
.
RecordValue
(
sample
)
}
for
q
,
want
:=
range
map
[
float64
]
int64
{
50
:
33554431
,
83.33
:
33554431
,
83.34
:
100663295
,
99
:
100663295
,
}
{
if
got
:=
hist
.
ValueAtQuantile
(
q
);
got
!=
want
{
t
.
Errorf
(
"got %d for %fth percentile. want: %d"
,
got
,
q
,
want
)
}
}
}
func
TestExportImport
(
t
*
testing
.
T
)
{
min
:=
int64
(
1
)
max
:=
int64
(
10000000
)
sigfigs
:=
3
h
:=
hdrhistogram
.
New
(
min
,
max
,
sigfigs
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
s
:=
h
.
Export
()
if
v
:=
s
.
LowestTrackableValue
;
v
!=
min
{
t
.
Errorf
(
"LowestTrackableValue was %v, but expected %v"
,
v
,
min
)
}
if
v
:=
s
.
HighestTrackableValue
;
v
!=
max
{
t
.
Errorf
(
"HighestTrackableValue was %v, but expected %v"
,
v
,
max
)
}
if
v
:=
int
(
s
.
SignificantFigures
);
v
!=
sigfigs
{
t
.
Errorf
(
"SignificantFigures was %v, but expected %v"
,
v
,
sigfigs
)
}
if
imported
:=
hdrhistogram
.
Import
(
s
);
!
imported
.
Equals
(
h
)
{
t
.
Error
(
"Expected Histograms to be equivalent"
)
}
}
func
TestEquals
(
t
*
testing
.
T
)
{
h1
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
1000000
;
i
++
{
if
err
:=
h1
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
h2
:=
hdrhistogram
.
New
(
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
10000
;
i
++
{
if
err
:=
h1
.
RecordValue
(
int64
(
i
));
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
if
h1
.
Equals
(
h2
)
{
t
.
Error
(
"Expected Histograms to not be equivalent"
)
}
h1
.
Reset
()
h2
.
Reset
()
if
!
h1
.
Equals
(
h2
)
{
t
.
Error
(
"Expected Histograms to be equivalent"
)
}
}
Godeps/_workspace/src/github.com/codahale/hdrhistogram/window.go
deleted
100644 → 0
浏览文件 @
6bd66cc8
package
hdrhistogram
// A WindowedHistogram combines histograms to provide windowed statistics.
type
WindowedHistogram
struct
{
idx
int
h
[]
Histogram
m
*
Histogram
Current
*
Histogram
}
// NewWindowed creates a new WindowedHistogram with N underlying histograms with
// the given parameters.
func
NewWindowed
(
n
int
,
minValue
,
maxValue
int64
,
sigfigs
int
)
*
WindowedHistogram
{
w
:=
WindowedHistogram
{
idx
:
-
1
,
h
:
make
([]
Histogram
,
n
),
m
:
New
(
minValue
,
maxValue
,
sigfigs
),
}
for
i
:=
range
w
.
h
{
w
.
h
[
i
]
=
*
New
(
minValue
,
maxValue
,
sigfigs
)
}
w
.
Rotate
()
return
&
w
}
// Merge returns a histogram which includes the recorded values from all the
// sections of the window.
func
(
w
*
WindowedHistogram
)
Merge
()
*
Histogram
{
w
.
m
.
Reset
()
for
_
,
h
:=
range
w
.
h
{
w
.
m
.
Merge
(
&
h
)
}
return
w
.
m
}
// Rotate resets the oldest histogram and rotates it to be used as the current
// histogram.
func
(
w
*
WindowedHistogram
)
Rotate
()
{
w
.
idx
++
w
.
Current
=
&
w
.
h
[
w
.
idx
%
len
(
w
.
h
)]
w
.
Current
.
Reset
()
}
Godeps/_workspace/src/github.com/codahale/hdrhistogram/window_test.go
deleted
100644 → 0
浏览文件 @
6bd66cc8
package
hdrhistogram_test
import
(
"testing"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/codahale/hdrhistogram"
)
func
TestWindowedHistogram
(
t
*
testing
.
T
)
{
w
:=
hdrhistogram
.
NewWindowed
(
2
,
1
,
1000
,
3
)
for
i
:=
0
;
i
<
100
;
i
++
{
w
.
Current
.
RecordValue
(
int64
(
i
))
}
w
.
Rotate
()
for
i
:=
100
;
i
<
200
;
i
++
{
w
.
Current
.
RecordValue
(
int64
(
i
))
}
w
.
Rotate
()
for
i
:=
200
;
i
<
300
;
i
++
{
w
.
Current
.
RecordValue
(
int64
(
i
))
}
if
v
,
want
:=
w
.
Merge
()
.
ValueAtQuantile
(
50
),
int64
(
199
);
v
!=
want
{
t
.
Errorf
(
"Median was %v, but expected %v"
,
v
,
want
)
}
}
func
BenchmarkWindowedHistogramRecordAndRotate
(
b
*
testing
.
B
)
{
w
:=
hdrhistogram
.
NewWindowed
(
3
,
1
,
10000000
,
3
)
b
.
ReportAllocs
()
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
if
err
:=
w
.
Current
.
RecordValue
(
100
);
err
!=
nil
{
b
.
Fatal
(
err
)
}
if
i
%
100000
==
1
{
w
.
Rotate
()
}
}
}
func
BenchmarkWindowedHistogramMerge
(
b
*
testing
.
B
)
{
w
:=
hdrhistogram
.
NewWindowed
(
3
,
1
,
10000000
,
3
)
for
i
:=
0
;
i
<
10000000
;
i
++
{
if
err
:=
w
.
Current
.
RecordValue
(
100
);
err
!=
nil
{
b
.
Fatal
(
err
)
}
if
i
%
100000
==
1
{
w
.
Rotate
()
}
}
b
.
ReportAllocs
()
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
w
.
Merge
()
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论