зеркало из https://github.com/mozilla/gecko-dev.git
b=566442; add memory reporters for sqlite; r=sdwilsh
This commit is contained in:
Родитель
44b832e7ed
Коммит
e94d4e8f48
|
@ -56,6 +56,7 @@
|
|||
#include "sqlite3.h"
|
||||
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace storage {
|
||||
|
@ -71,6 +72,16 @@ NS_IMPL_THREADSAFE_ISUPPORTS2(
|
|||
|
||||
Service *Service::gService = nsnull;
|
||||
|
||||
static PRInt64 GetStorageSQLiteMemoryUsed(void *) {
|
||||
return sqlite3_memory_used();
|
||||
}
|
||||
|
||||
NS_MEMORY_REPORTER_IMPLEMENT(StorageSQLiteMemoryUsed,
|
||||
"storage/sqlite",
|
||||
"Memory in use by SQLite",
|
||||
GetStorageSQLiteMemoryUsed,
|
||||
nsnull)
|
||||
|
||||
Service *
|
||||
Service::getSingleton()
|
||||
{
|
||||
|
@ -102,6 +113,8 @@ Service::getSingleton()
|
|||
NS_RELEASE(gService);
|
||||
}
|
||||
|
||||
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(StorageSQLiteMemoryUsed));
|
||||
|
||||
return gService;
|
||||
}
|
||||
|
||||
|
@ -147,12 +160,7 @@ Service::shutdown()
|
|||
nsresult
|
||||
Service::initialize()
|
||||
{
|
||||
// Disable memory allocation statistic collection, improving performance.
|
||||
// This must be done prior to a call to sqlite3_initialize to have any
|
||||
// effect.
|
||||
int rc = ::sqlite3_config(SQLITE_CONFIG_MEMSTATUS, 0);
|
||||
if (rc != SQLITE_OK)
|
||||
return convertResultCode(rc);
|
||||
int rc;
|
||||
|
||||
// Explicitly initialize sqlite3. Although this is implicitly called by
|
||||
// various sqlite3 functions (and the sqlite3_open calls in our case),
|
||||
|
|
Загрузка…
Ссылка в новой задаче