mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 18:22:16 +00:00
opts: Add getter for cached memory
This commit is contained in:
parent
920cbc9846
commit
a2378ae4fe
@ -133,7 +133,8 @@ enum {
|
||||
GIT_OPT_SET_SEARCH_PATH,
|
||||
GIT_OPT_SET_CACHE_OBJECT_LIMIT,
|
||||
GIT_OPT_SET_CACHE_MAX_SIZE,
|
||||
GIT_OPT_ENABLE_CACHING
|
||||
GIT_OPT_ENABLE_CACHING,
|
||||
GIT_OPT_GET_CACHED_MEMORY
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -19,8 +19,7 @@ GIT__USE_OIDMAP
|
||||
|
||||
bool git_cache__enabled = true;
|
||||
int64_t git_cache__max_storage = (256 * 1024 * 1024);
|
||||
|
||||
static git_atomic64 git_cache__current_storage = {0};
|
||||
git_atomic64 git_cache__current_storage = {0};
|
||||
|
||||
static size_t git_cache__max_object_size[8] = {
|
||||
0, /* GIT_OBJ__EXT1 */
|
||||
|
@ -36,6 +36,7 @@ typedef struct {
|
||||
|
||||
extern bool git_cache__enabled;
|
||||
extern int64_t git_cache__max_storage;
|
||||
extern git_atomic64 git_cache__current_storage;
|
||||
|
||||
int git_cache_set_max_object_size(git_otype type, size_t size);
|
||||
|
||||
|
@ -109,6 +109,11 @@ int git_libgit2_opts(int key, ...)
|
||||
case GIT_OPT_ENABLE_CACHING:
|
||||
git_cache__enabled = (va_arg(ap, int) != 0);
|
||||
break;
|
||||
|
||||
case GIT_OPT_GET_CACHED_MEMORY:
|
||||
*(va_arg(ap, int64_t *)) = git_cache__current_storage.val;
|
||||
*(va_arg(ap, int64_t *)) = git_cache__max_storage;
|
||||
break;
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
Loading…
Reference in New Issue
Block a user