From 8ded65fe0e9874af14af79d1823d117a969419a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Sat, 9 May 2020 14:34:06 +0200 Subject: [PATCH] SQLite3 metrics: cosmetic changes --- eth/db/kvstore_sqlite3.nim | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/eth/db/kvstore_sqlite3.nim b/eth/db/kvstore_sqlite3.nim index 23102f3..03fb7f0 100644 --- a/eth/db/kvstore_sqlite3.nim +++ b/eth/db/kvstore_sqlite3.nim @@ -3,8 +3,8 @@ {.push raises: [Defect].} import - os, tables, times, - chronicles, metrics, sqlite3_abi, + os, + sqlite3_abi, ./kvstore export kvstore @@ -164,6 +164,9 @@ proc init*( )) when defined(metrics): + import tables, times, + chronicles, metrics + type Sqlite3Info = ref object of Gauge proc newSqlite3Info*(name: string, help: string, registry = defaultRegistry): Sqlite3Info {.raises: [Exception].} = @@ -179,11 +182,10 @@ when defined(metrics): method collect*(collector: Sqlite3Info): Metrics = result = initOrderedTable[Labels, seq[Metric]]() result[@[]] = @[] - var - timestamp = getTime().toMilliseconds() - currentMem, highwaterMem: cint + let timestamp = getTime().toMilliseconds() + var currentMem, highwaterMem: int64 - if (let res = sqlite3_status(SQLITE_STATUS_MEMORY_USED, currentMem.addr, highwaterMem.addr, 0); res != SQLITE_OK): + if (let res = sqlite3_status64(SQLITE_STATUS_MEMORY_USED, currentMem.addr, highwaterMem.addr, 0); res != SQLITE_OK): error "SQLite3 error", msg = sqlite3_errstr(res) else: result[@[]] = @[