diff options
Diffstat (limited to 'database')
-rw-r--r-- | database/sqlite/sqlite_context.c | 7 | ||||
-rw-r--r-- | database/sqlite/sqlite_context.h | 1 | ||||
-rw-r--r-- | database/sqlite/sqlite_functions.c | 7 | ||||
-rw-r--r-- | database/sqlite/sqlite_functions.h | 1 |
4 files changed, 16 insertions, 0 deletions
diff --git a/database/sqlite/sqlite_context.c b/database/sqlite/sqlite_context.c index 94c5919245..bd16848f97 100644 --- a/database/sqlite/sqlite_context.c +++ b/database/sqlite/sqlite_context.c @@ -444,6 +444,13 @@ skip_delete: return (rc_stored != SQLITE_DONE); } +int sql_context_cache_stats(int op) +{ + int count, dummy; + sqlite3_db_status(db_context_meta, op, &count, &dummy, 0); + return count; +} + // // TESTING FUNCTIONS // diff --git a/database/sqlite/sqlite_context.h b/database/sqlite/sqlite_context.h index 12937fffd1..3f941be802 100644 --- a/database/sqlite/sqlite_context.h +++ b/database/sqlite/sqlite_context.h @@ -6,6 +6,7 @@ #include "daemon/common.h" #include "sqlite3.h" +extern int sql_context_cache_stats(int op); typedef struct ctx_chart { uuid_t chart_id; const char *id; diff --git a/database/sqlite/sqlite_functions.c b/database/sqlite/sqlite_functions.c index c470e4c1de..6f71e3f6c3 100644 --- a/database/sqlite/sqlite_functions.c +++ b/database/sqlite/sqlite_functions.c @@ -2760,3 +2760,10 @@ int bind_text_null(sqlite3_stmt *res, int position, const char *text, bool can_b return 1; return sqlite3_bind_null(res, position); } + +int sql_metadata_cache_stats(int op) +{ + int count, dummy; + sqlite3_db_status(db_meta, op, &count, &dummy, 0); + return count; +} diff --git a/database/sqlite/sqlite_functions.h b/database/sqlite/sqlite_functions.h index 2c3f33b014..1e4ba43629 100644 --- a/database/sqlite/sqlite_functions.h +++ b/database/sqlite/sqlite_functions.h @@ -121,5 +121,6 @@ void migrate_localhost(uuid_t *host_uuid); extern void sql_store_host_system_info(uuid_t *host_id, const struct rrdhost_system_info *system_info); extern void sql_build_host_system_info(uuid_t *host_id, struct rrdhost_system_info *system_info); void sql_store_host_labels(RRDHOST *host); +extern int sql_metadata_cache_stats(int op); DICTIONARY *sql_load_host_labels(uuid_t *host_id); #endif //NETDATA_SQLITE_FUNCTIONS_H |