Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
d949e8fe
Unverified
Commit
d949e8fe
authored
May 19, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
May 19, 2020
Browse files
Merge pull request #7196 from ShooterIT/benchmark
Redis Benchmark: make test data better
parents
a9200ed0
abff2640
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-benchmark.c
View file @
d949e8fe
...
@@ -1278,6 +1278,17 @@ static void updateClusterSlotsConfiguration() {
...
@@ -1278,6 +1278,17 @@ static void updateClusterSlotsConfiguration() {
pthread_mutex_unlock
(
&
config
.
is_updating_slots_mutex
);
pthread_mutex_unlock
(
&
config
.
is_updating_slots_mutex
);
}
}
/* Generate random data for redis benchmark. See #7196. */
static
void
genBenchmarkRandomData
(
char
*
data
,
int
count
)
{
static
uint32_t
state
=
1234
;
int
i
=
0
;
while
(
count
--
)
{
state
=
(
state
*
1103515245
+
12345
);
data
[
i
++
]
=
'0'
+
((
state
>>
16
)
&
63
);
}
}
/* Returns number of consumed options. */
/* Returns number of consumed options. */
int
parseOptions
(
int
argc
,
const
char
**
argv
)
{
int
parseOptions
(
int
argc
,
const
char
**
argv
)
{
int
i
;
int
i
;
...
@@ -1632,7 +1643,7 @@ int main(int argc, const char **argv) {
...
@@ -1632,7 +1643,7 @@ int main(int argc, const char **argv) {
/* Run default benchmark suite. */
/* Run default benchmark suite. */
data
=
zmalloc
(
config
.
datasize
+
1
);
data
=
zmalloc
(
config
.
datasize
+
1
);
do
{
do
{
memset
(
data
,
'x'
,
config
.
datasize
);
genBenchmarkRandomData
(
data
,
config
.
datasize
);
data
[
config
.
datasize
]
=
'\0'
;
data
[
config
.
datasize
]
=
'\0'
;
if
(
test_is_selected
(
"ping_inline"
)
||
test_is_selected
(
"ping"
))
if
(
test_is_selected
(
"ping_inline"
)
||
test_is_selected
(
"ping"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment