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
c032dc45
Commit
c032dc45
authored
Nov 06, 2019
by
meir@redislabs.com
Browse files
changed GetUsedMemoryPresentage -> GetUsedMemoryRatio and return value between 0 and 1.
parent
aded138a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
c032dc45
...
...
@@ -5905,10 +5905,10 @@ size_t RM_MallocSize(void* ptr){
* 0 - no memory limit
* 100 and above, memory limit reached.
*/
float
RM_GetUsedMemory
Percentage
(){
float
RM_GetUsedMemory
Ratio
(){
float
level
;
getMaxmemoryState
(
NULL
,
NULL
,
NULL
,
&
level
);
return
level
*
100
;
return
level
;
}
/* --------------------------------------------------------------------------
...
...
@@ -6991,6 +6991,6 @@ void moduleRegisterCoreAPI(void) {
REGISTER_API
(
BlockClientOnKeys
);
REGISTER_API
(
SignalKeyAsReady
);
REGISTER_API
(
GetBlockedClientReadyKey
);
REGISTER_API
(
GetUsedMemory
Percentage
);
REGISTER_API
(
GetUsedMemory
Ratio
);
REGISTER_API
(
MallocSize
);
}
src/redismodule.h
View file @
c032dc45
...
...
@@ -633,7 +633,7 @@ int REDISMODULE_API_FUNC(RedisModule_CommandFilterArgDelete)(RedisModuleCommandF
int
REDISMODULE_API_FUNC
(
RedisModule_Fork
)(
RedisModuleForkDoneHandler
cb
,
void
*
user_data
);
int
REDISMODULE_API_FUNC
(
RedisModule_ExitFromChild
)(
int
retcode
);
int
REDISMODULE_API_FUNC
(
RedisModule_KillForkChild
)(
int
child_pid
);
float
REDISMODULE_API_FUNC
(
RedisModule_GetUsedMemory
Percentage
)();
float
REDISMODULE_API_FUNC
(
RedisModule_GetUsedMemory
Ratio
)();
size_t
REDISMODULE_API_FUNC
(
RedisModule_MallocSize
)(
void
*
ptr
);
#endif
...
...
@@ -844,7 +844,7 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
REDISMODULE_GET_API
(
Fork
);
REDISMODULE_GET_API
(
ExitFromChild
);
REDISMODULE_GET_API
(
KillForkChild
);
REDISMODULE_GET_API
(
GetUsedMemory
Percentage
);
REDISMODULE_GET_API
(
GetUsedMemory
Ratio
);
REDISMODULE_GET_API
(
MallocSize
);
#endif
...
...
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