diff options
author | ssid <ssid@chromium.org> | 2015-10-12 10:49:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-12 17:49:46 +0000 |
commit | 9f8022f2aadfd86989231e6d367c2c2b9a53ae4b (patch) | |
tree | 7566cfd6b24a6087a535cc47d498114fba990669 /sql/connection_unittest.cc | |
parent | 55e0b3620524432d77cd3f707acd6ed470c2f1c9 (diff) | |
download | chromium_src-9f8022f2aadfd86989231e6d367c2c2b9a53ae4b.zip chromium_src-9f8022f2aadfd86989231e6d367c2c2b9a53ae4b.tar.gz chromium_src-9f8022f2aadfd86989231e6d367c2c2b9a53ae4b.tar.bz2 |
[tracing] Add sqlite memory statistics to tracing.
The process-wide memory usage statistics of sqlite library is added to
chrome://tracing. The memory usage of sqlite library is mainly through
sqlite_malloc. The total usage of the process is recorded by
sqlite3_memory_used() api. This CL also adds per-connection memory
usage to tracing. Each connection uses memory for cache, schema and
statement, and these usages are recorded. sqlit3_malloc uses malloc
internally to allocate memory. So, thie memory is traced as
sub-allocation from system_allocator(malloc).
This CL lets us keep track of sqlite memory usage in chrome telemetry.
BUG=466141
Review URL: https://codereview.chromium.org/1327063002
Cr-Commit-Position: refs/heads/master@{#353549}
Diffstat (limited to 'sql/connection_unittest.cc')
-rw-r--r-- | sql/connection_unittest.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc index 0038a1d..d933a6d 100644 --- a/sql/connection_unittest.cc +++ b/sql/connection_unittest.cc @@ -11,6 +11,7 @@ #include "base/metrics/statistics_recorder.h" #include "base/strings/stringprintf.h" #include "base/test/histogram_tester.h" +#include "base/trace_event/process_memory_dump.h" #include "sql/connection.h" #include "sql/correct_sql_test_base.h" #include "sql/meta_table.h" @@ -1378,4 +1379,12 @@ TEST_F(SQLConnectionTest, MmapTest) { } #endif +TEST_F(SQLConnectionTest, OnMemoryDump) { + base::trace_event::ProcessMemoryDump pmd(nullptr); + base::trace_event::MemoryDumpArgs args = { + base::trace_event::MemoryDumpLevelOfDetail::DETAILED}; + ASSERT_TRUE(db().OnMemoryDump(args, &pmd)); + EXPECT_GE(pmd.allocator_dumps().size(), 1u); +} + } // namespace |