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
c5166e3f
Commit
c5166e3f
authored
Mar 16, 2012
by
antirez
Browse files
First implementation of --test-memory. Still a work in progress.
parent
c9d3dda2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Makefile
View file @
c5166e3f
...
@@ -73,7 +73,7 @@ QUIET_CC = @printf ' %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR
...
@@ -73,7 +73,7 @@ QUIET_CC = @printf ' %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR
QUIET_LINK
=
@printf
' %b %b\n'
$(LINKCOLOR)
LINK
$(ENDCOLOR)
$(BINCOLOR)$@$(ENDCOLOR)
;
QUIET_LINK
=
@printf
' %b %b\n'
$(LINKCOLOR)
LINK
$(ENDCOLOR)
$(BINCOLOR)$@$(ENDCOLOR)
;
endif
endif
OBJ
=
adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o
OBJ
=
adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o
memtest.o
BENCHOBJ
=
ae.o anet.o redis-benchmark.o sds.o adlist.o zmalloc.o
BENCHOBJ
=
ae.o anet.o redis-benchmark.o sds.o adlist.o zmalloc.o
CLIOBJ
=
anet.o sds.o adlist.o redis-cli.o zmalloc.o release.o
CLIOBJ
=
anet.o sds.o adlist.o redis-cli.o zmalloc.o release.o
CHECKDUMPOBJ
=
redis-check-dump.o lzf_c.o lzf_d.o
CHECKDUMPOBJ
=
redis-check-dump.o lzf_c.o lzf_d.o
...
...
src/redis.c
View file @
c5166e3f
...
@@ -2231,7 +2231,8 @@ void usage() {
...
@@ -2231,7 +2231,8 @@ void usage() {
fprintf
(
stderr
,
"Usage: ./redis-server [/path/to/redis.conf] [options]
\n
"
);
fprintf
(
stderr
,
"Usage: ./redis-server [/path/to/redis.conf] [options]
\n
"
);
fprintf
(
stderr
,
" ./redis-server - (read config from stdin)
\n
"
);
fprintf
(
stderr
,
" ./redis-server - (read config from stdin)
\n
"
);
fprintf
(
stderr
,
" ./redis-server -v or --version
\n
"
);
fprintf
(
stderr
,
" ./redis-server -v or --version
\n
"
);
fprintf
(
stderr
,
" ./redis-server -h or --help
\n\n
"
);
fprintf
(
stderr
,
" ./redis-server -h or --help
\n
"
);
fprintf
(
stderr
,
" ./redis-server --test-memory <megabytes>
\n\n
"
);
fprintf
(
stderr
,
"Examples:
\n
"
);
fprintf
(
stderr
,
"Examples:
\n
"
);
fprintf
(
stderr
,
" ./redis-server (run the server with default conf)
\n
"
);
fprintf
(
stderr
,
" ./redis-server (run the server with default conf)
\n
"
);
fprintf
(
stderr
,
" ./redis-server /etc/redis/6379.conf
\n
"
);
fprintf
(
stderr
,
" ./redis-server /etc/redis/6379.conf
\n
"
);
...
@@ -2287,6 +2288,8 @@ void setupSignalHandlers(void) {
...
@@ -2287,6 +2288,8 @@ void setupSignalHandlers(void) {
return
;
return
;
}
}
void
memtest
(
size_t
megabytes
,
int
passes
);
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
long
long
start
;
long
long
start
;
struct
timeval
tv
;
struct
timeval
tv
;
...
@@ -2308,6 +2311,17 @@ int main(int argc, char **argv) {
...
@@ -2308,6 +2311,17 @@ int main(int argc, char **argv) {
strcmp
(
argv
[
1
],
"--version"
)
==
0
)
version
();
strcmp
(
argv
[
1
],
"--version"
)
==
0
)
version
();
if
(
strcmp
(
argv
[
1
],
"--help"
)
==
0
||
if
(
strcmp
(
argv
[
1
],
"--help"
)
==
0
||
strcmp
(
argv
[
1
],
"-h"
)
==
0
)
usage
();
strcmp
(
argv
[
1
],
"-h"
)
==
0
)
usage
();
if
(
strcmp
(
argv
[
1
],
"--test-memory"
)
==
0
)
{
if
(
argc
==
3
)
{
memtest
(
atoi
(
argv
[
2
]),
10000
);
exit
(
0
);
}
else
{
fprintf
(
stderr
,
"Please specify the amount of memory to test in megabytes.
\n
"
);
fprintf
(
stderr
,
"Example: ./redis-server --test-memory 4096
\n\n
"
);
exit
(
1
);
}
}
/* First argument is the config file name? */
/* First argument is the config file name? */
if
(
argv
[
j
][
0
]
!=
'-'
||
argv
[
j
][
1
]
!=
'-'
)
if
(
argv
[
j
][
0
]
!=
'-'
||
argv
[
j
][
1
]
!=
'-'
)
configfile
=
argv
[
j
++
];
configfile
=
argv
[
j
++
];
...
...
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