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
758b39be
Commit
758b39be
authored
Oct 02, 2019
by
antirez
Browse files
Speedup INFO server section.
parent
f49f0a6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/release.c
View file @
758b39be
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
* files using this functions. */
* files using this functions. */
#include <string.h>
#include <string.h>
#include <stdio.h>
#include "release.h"
#include "release.h"
#include "version.h"
#include "version.h"
...
@@ -50,3 +51,16 @@ uint64_t redisBuildId(void) {
...
@@ -50,3 +51,16 @@ uint64_t redisBuildId(void) {
return
crc64
(
0
,(
unsigned
char
*
)
buildid
,
strlen
(
buildid
));
return
crc64
(
0
,(
unsigned
char
*
)
buildid
,
strlen
(
buildid
));
}
}
/* Return a cached value of the build string in order to avoid recomputing
* and converting it in hex every time: this string is shown in the INFO
* output that should be fast. */
char
*
redisBuildIdString
(
void
)
{
static
char
buf
[
32
];
static
int
cached
=
0
;
if
(
!
cached
)
{
snprintf
(
buf
,
sizeof
(
buf
),
"%llx"
,(
unsigned
long
long
)
redisBuildId
());
cached
=
1
;
}
return
buf
;
}
src/server.c
View file @
758b39be
...
@@ -3892,32 +3892,32 @@ sds genRedisInfoString(char *section) {
...
@@ -3892,32 +3892,32 @@ sds genRedisInfoString(char *section) {
call_uname = 0;
call_uname = 0;
}
}
info = sdscat
printf
(info,
info = sdscat
fmt
(info,
"# Server\r\n"
"# Server\r\n"
"redis_version:%s\r\n"
"redis_version:%s\r\n"
"redis_git_sha1:%s\r\n"
"redis_git_sha1:%s\r\n"
"redis_git_dirty:%
d
\r\n"
"redis_git_dirty:%
i
\r\n"
"redis_build_id:%
llx
\r\n"
"redis_build_id:%
s
\r\n"
"redis_mode:%s\r\n"
"redis_mode:%s\r\n"
"os:%s %s %s\r\n"
"os:%s %s %s\r\n"
"arch_bits:%
d
\r\n"
"arch_bits:%
i
\r\n"
"multiplexing_api:%s\r\n"
"multiplexing_api:%s\r\n"
"atomicvar_api:%s\r\n"
"atomicvar_api:%s\r\n"
"gcc_version:%
d
.%
d
.%
d
\r\n"
"gcc_version:%
i
.%
i
.%
i
\r\n"
"process_id:%
ld
\r\n"
"process_id:%
I
\r\n"
"run_id:%s\r\n"
"run_id:%s\r\n"
"tcp_port:%
d
\r\n"
"tcp_port:%
i
\r\n"
"uptime_in_seconds:%
jd
\r\n"
"uptime_in_seconds:%
I
\r\n"
"uptime_in_days:%
jd
\r\n"
"uptime_in_days:%
I
\r\n"
"hz:%
d
\r\n"
"hz:%
i
\r\n"
"configured_hz:%
d
\r\n"
"configured_hz:%
i
\r\n"
"lru_clock:%
ld
\r\n"
"lru_clock:%
u
\r\n"
"executable:%s\r\n"
"executable:%s\r\n"
"config_file:%s\r\n",
"config_file:%s\r\n",
REDIS_VERSION,
REDIS_VERSION,
redisGitSHA1(),
redisGitSHA1(),
strtol(redisGitDirty(),NULL,10) > 0,
strtol(redisGitDirty(),NULL,10) > 0,
(unsigned long long)
redisBuildId(),
redisBuildId
String
(),
mode,
mode,
name.sysname, name.release, name.machine,
name.sysname, name.release, name.machine,
server.arch_bits,
server.arch_bits,
...
@@ -3928,14 +3928,14 @@ sds genRedisInfoString(char *section) {
...
@@ -3928,14 +3928,14 @@ sds genRedisInfoString(char *section) {
#else
#else
0,0,0,
0,0,0,
#endif
#endif
(
long
) getpid(),
(
int64_t
) getpid(),
server.runid,
server.runid,
server.port,
server.port,
(int
max
_t)uptime,
(int
64
_t)uptime,
(int
max
_t)(uptime/(3600*24)),
(int
64
_t)(uptime/(3600*24)),
server.hz,
server.hz,
server.config_hz,
server.config_hz,
(unsigned long)
server.lruclock,
server.lruclock,
server.executable ? server.executable : "",
server.executable ? server.executable : "",
server.configfile ? server.configfile : "");
server.configfile ? server.configfile : "");
}
}
...
...
src/server.h
View file @
758b39be
...
@@ -2140,6 +2140,7 @@ void dictSdsDestructor(void *privdata, void *val);
...
@@ -2140,6 +2140,7 @@ void dictSdsDestructor(void *privdata, void *val);
char
*
redisGitSHA1
(
void
);
char
*
redisGitSHA1
(
void
);
char
*
redisGitDirty
(
void
);
char
*
redisGitDirty
(
void
);
uint64_t
redisBuildId
(
void
);
uint64_t
redisBuildId
(
void
);
char
*
redisBuildIdString
(
void
);
/* Commands prototypes */
/* Commands prototypes */
void
authCommand
(
client
*
c
);
void
authCommand
(
client
*
c
);
...
...
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