Commit a2378ae4 by Vicent Marti

opts: Add getter for cached memory

parent 920cbc98
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment