Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
2ee2bec2
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2ee2bec2
编写于
3月 31, 2014
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
HyperLogLog: make API use the P prefix in honor of Philippe Flajolet.
上级
1e90c006
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
19 deletion
+19
-19
src/hyperloglog.c
src/hyperloglog.c
+7
-7
src/redis.c
src/redis.c
+4
-4
src/redis.h
src/redis.h
+4
-4
utils/hyperloglog/hll-err.rb
utils/hyperloglog/hll-err.rb
+2
-2
utils/hyperloglog/hll-gnuplot-graph.rb
utils/hyperloglog/hll-gnuplot-graph.rb
+2
-2
未找到文件。
src/hyperloglog.c
浏览文件 @
2ee2bec2
...
...
@@ -435,8 +435,8 @@ uint64_t hllCount(uint8_t *registers) {
/* ========================== HyperLogLog commands ========================== */
/*
HLL
ADD var ele ele ele ... ele => :0 or :1 */
void
hllA
ddCommand
(
redisClient
*
c
)
{
/*
P
ADD var ele ele ele ... ele => :0 or :1 */
void
pa
ddCommand
(
redisClient
*
c
)
{
robj
*
o
=
lookupKeyWrite
(
c
->
db
,
c
->
argv
[
1
]);
uint8_t
*
registers
;
int
updated
=
0
,
j
;
...
...
@@ -482,8 +482,8 @@ void hllAddCommand(redisClient *c) {
addReply
(
c
,
updated
?
shared
.
cone
:
shared
.
czero
);
}
/*
HLL
COUNT var -> approximated cardinality of set. */
void
hllC
ountCommand
(
redisClient
*
c
)
{
/*
P
COUNT var -> approximated cardinality of set. */
void
pc
ountCommand
(
redisClient
*
c
)
{
robj
*
o
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
1
]);
uint8_t
*
registers
;
uint64_t
card
;
...
...
@@ -540,8 +540,8 @@ void hllCountCommand(redisClient *c) {
}
}
/*
HLL
MERGE dest src1 src2 src3 ... srcN => OK */
void
hllM
ergeCommand
(
redisClient
*
c
)
{
/*
P
MERGE dest src1 src2 src3 ... srcN => OK */
void
pm
ergeCommand
(
redisClient
*
c
)
{
uint8_t
max
[
REDIS_HLL_REGISTERS
];
uint8_t
*
registers
;
int
j
,
i
;
...
...
@@ -614,7 +614,7 @@ void hllMergeCommand(redisClient *c) {
* the correct value to be retained and not affect adjacent values. */
#define REDIS_HLL_TEST_CYCLES 1000
void
hllS
elftestCommand
(
redisClient
*
c
)
{
void
ps
elftestCommand
(
redisClient
*
c
)
{
int
j
,
i
;
sds
bitcounters
=
sdsnewlen
(
NULL
,
REDIS_HLL_SIZE
);
uint8_t
bytecounters
[
REDIS_HLL_REGISTERS
];
...
...
src/redis.c
浏览文件 @
2ee2bec2
...
...
@@ -259,10 +259,10 @@ struct redisCommand redisCommandTable[] = {
{
"bitop"
,
bitopCommand
,
-
4
,
"wm"
,
0
,
NULL
,
2
,
-
1
,
1
,
0
,
0
},
{
"bitcount"
,
bitcountCommand
,
-
2
,
"r"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"bitpos"
,
bitposCommand
,
-
3
,
"r"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"
hllselftest"
,
hllS
elftestCommand
,
1
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"
hlladd"
,
hllA
ddCommand
,
-
2
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"
hllcount"
,
hllC
ountCommand
,
2
,
"w"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"
hllmerge"
,
hllM
ergeCommand
,
-
2
,
"wm"
,
0
,
NULL
,
1
,
-
1
,
1
,
0
,
0
}
{
"
pselftest"
,
ps
elftestCommand
,
1
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"
padd"
,
pa
ddCommand
,
-
2
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"
pcount"
,
pc
ountCommand
,
2
,
"w"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"
pmerge"
,
pm
ergeCommand
,
-
2
,
"wm"
,
0
,
NULL
,
1
,
-
1
,
1
,
0
,
0
}
};
/*============================ Utility functions ============================ */
...
...
src/redis.h
浏览文件 @
2ee2bec2
...
...
@@ -1351,10 +1351,10 @@ void bitopCommand(redisClient *c);
void
bitcountCommand
(
redisClient
*
c
);
void
bitposCommand
(
redisClient
*
c
);
void
replconfCommand
(
redisClient
*
c
);
void
hllS
elftestCommand
(
redisClient
*
c
);
void
hllA
ddCommand
(
redisClient
*
c
);
void
hllC
ountCommand
(
redisClient
*
c
);
void
hllM
ergeCommand
(
redisClient
*
c
);
void
ps
elftestCommand
(
redisClient
*
c
);
void
pa
ddCommand
(
redisClient
*
c
);
void
pc
ountCommand
(
redisClient
*
c
);
void
pm
ergeCommand
(
redisClient
*
c
);
#if defined(__GNUC__)
void
*
calloc
(
size_t
count
,
size_t
size
)
__attribute__
((
deprecated
));
...
...
utils/hyperloglog/hll-err.rb
浏览文件 @
2ee2bec2
...
...
@@ -18,9 +18,9 @@ while true do
elements
<<
ele
i
+=
1
}
r
.
hll
add
(
'hll'
,
*
elements
)
r
.
p
add
(
'hll'
,
*
elements
)
}
approx
=
r
.
hll
count
(
'hll'
)
approx
=
r
.
p
count
(
'hll'
)
abs_err
=
(
approx
-
i
).
abs
rel_err
=
100
.
to_f
*
abs_err
/
i
puts
"
#{
i
}
vs
#{
approx
}
:
#{
rel_err
}
%"
...
...
utils/hyperloglog/hll-gnuplot-graph.rb
浏览文件 @
2ee2bec2
...
...
@@ -30,9 +30,9 @@ def run_experiment(r,seed,max,step)
elements
<<
ele
i
+=
1
}
r
.
hll
add
(
'hll'
,
*
elements
)
r
.
p
add
(
'hll'
,
*
elements
)
}
approx
=
r
.
hll
count
(
'hll'
)
approx
=
r
.
p
count
(
'hll'
)
err
=
approx
-
i
rel_err
=
100
.
to_f
*
err
/
i
samples
<<
[
i
,
rel_err
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录