Closed
Bug 615978
Opened 14 years ago
Closed 13 years ago
Add SQLITE_DBSTATUS_* memory usage to memory reporter.
Categories
(Toolkit :: Storage, defect)
Toolkit
Storage
Tracking
()
RESOLVED
FIXED
mozilla5
People
(Reporter: dougt, Assigned: sdwilsh)
References
Details
Attachments
(2 files, 4 obsolete files)
5.59 KB,
patch
|
Details | Diff | Splinter Review | |
3.57 KB,
patch
|
Details | Diff | Splinter Review |
See http://www.sqlite.org/c3ref/c_dbstatus_cache_used.html
Attachment #494493 -
Flags: review?(sdwilsh)
Comment 1•14 years ago
|
||
+ } else if (mType == Cache_Used) { + *desc = strdup("Approximate number of of bytes of heap memory used by all pager caches"); + } else if (mType == Schema_Used) { + *desc = strdup("Approximate number of of bytes of heap memory used to store the schema for all databases associated with the connection"); + } else if (mType == Stmt_Used) { + *desc = strdup("Approximate number of of bytes of heap and lookaside memory used by all prepared statements"); + } number of of ?
Assignee | ||
Comment 2•14 years ago
|
||
Note: Core::SQL is dead
Status: NEW → ASSIGNED
Component: SQL → Storage
Product: Core → Toolkit
QA Contact: omarshall → storage
Assignee | ||
Comment 3•14 years ago
|
||
Note: I don't think memory reporters work off of the main thread, but you'll certainly be adding them off the main thread if you do this in Connection::initialize.
Reporter | ||
Comment 4•14 years ago
|
||
sdwilsh, this is working fine. are you suggesting a race on (un)registration? The storageMemoryReporters are called on the main thread.
Assignee | ||
Comment 5•14 years ago
|
||
I recall vlad telling me that I couldn't register reporters off of the main thread, which is why we do this in Service: https://mxr.mozilla.org/mozilla-central/source/storage/src/mozStorageService.cpp#191 I don't recall the reasons; maybe they've been fixed? Connection::initialize is called by Service::Open[Unshared|Special]Database, which can be called off of the main thread (urlclassifier does this, we should have tests for it but don't (test_service_init_background_thread.cpp would be easy to modify to test this behavior). It's been supported since I inherited this code, and we can't break that at this point in the release cycle.
it's not a good idea to do so, there's no locking done when the objects are inserted into the reporter hashtable. But we can probably make it do that, since resgistering reporters is infrequent. BUT, it does happen at startup, so someone should watch Ts numbers very closely if they do so -- but it would make this stuff a lot simpler.
Reporter | ||
Comment 7•14 years ago
|
||
sdwilsh, in bug 619096 I addressed your concern. Could you review this patch assuming that 619096 lands first.
Depends on: 619096
Reporter | ||
Comment 8•14 years ago
|
||
sdwilsh, ping?
Assignee | ||
Comment 9•14 years ago
|
||
Comment on attachment 494493 [details] [diff] [review] patch v.1 Sorry, I thought I had commented in this bug, but it doesn't look like I did. This doesn't work in the case where we have multiple connections to the same database (which we currently have two of: places.sqlite and cookies.sqlite). I'm not really sure what happens exactly, but philiKON had a build with this patch and the numbers were certainly not right for places as a result.
Attachment #494493 -
Flags: review?(sdwilsh) → review-
Reporter | ||
Comment 10•14 years ago
|
||
how so? phiikon, any details?
Comment 11•14 years ago
|
||
(In reply to comment #9) > Sorry, I thought I had commented in this bug, but it doesn't look like I did. > This doesn't work in the case where we have multiple connections to the same > database (which we currently have two of: places.sqlite and cookies.sqlite). > I'm not really sure what happens exactly, but philiKON had a build with this > patch and the numbers were certainly not right for places as a result. I don't recall ever having made such a build (which doesn't necessarily mean that I never did ;))
Reporter | ||
Comment 12•14 years ago
|
||
Comment on attachment 494493 [details] [diff] [review] patch v.1 re-requesting review.
Attachment #494493 -
Flags: review- → review?(sdwilsh)
Reporter | ||
Updated•13 years ago
|
Assignee: doug.turner → nobody
Assignee | ||
Comment 13•13 years ago
|
||
Was this patch ever ran in a debug build? It get a ton of assertions about non-threadsafe AddRef/Release when opening about:memory.
Assignee | ||
Comment 14•13 years ago
|
||
The issue I mentioned in comment 9 does in fact exist, and it's because of how the front-end displays the results: https://hg.mozilla.org/mozilla-central/annotate/5666cb06e519/toolkit/components/aboutmemory/content/aboutMemory.js#l169
Assignee | ||
Comment 15•13 years ago
|
||
This actually builds on windows (changes were needed to the sqlite.def file for it to link properly).
Attachment #494493 -
Attachment is obsolete: true
Attachment #494493 -
Flags: review?(sdwilsh)
Assignee | ||
Comment 16•13 years ago
|
||
Comment on attachment 494493 [details] [diff] [review] patch v.1 r- for threadsafety issues, plus the issue mentioned in comment 9.
Attachment #494493 -
Flags: review-
Assignee | ||
Updated•13 years ago
|
Whiteboard: [good first bug]
Assignee | ||
Comment 17•13 years ago
|
||
Addresses my own review comments and updates the style to follow the style guide. I'll post a patch for the front-end shortly.
Assignee: nobody → sdwilsh
Attachment #517771 -
Attachment is obsolete: true
Attachment #521676 -
Flags: review?(bugmail)
Assignee | ||
Comment 18•13 years ago
|
||
Attachment #521685 -
Flags: review?(dtownsend)
Assignee | ||
Updated•13 years ago
|
Whiteboard: [good first bug] → [needs review asuth][needs review Mossop]
Updated•13 years ago
|
Attachment #521685 -
Flags: review?(dtownsend) → review+
Assignee | ||
Updated•13 years ago
|
Whiteboard: [needs review asuth][needs review Mossop] → [needs review asuth]
Updated•13 years ago
|
Attachment #521676 -
Flags: review?(bugmail) → review+
Assignee | ||
Updated•13 years ago
|
Whiteboard: [needs review asuth] → [can land]
Assignee | ||
Comment 19•13 years ago
|
||
Attachment #521676 -
Attachment is obsolete: true
Assignee | ||
Comment 20•13 years ago
|
||
Attachment #521685 -
Attachment is obsolete: true
Assignee | ||
Updated•13 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 21•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/9e77e9db7128 http://hg.mozilla.org/mozilla-central/rev/f38fa181d902
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [can land]
Target Milestone: --- → mozilla2.2
Comment 22•13 years ago
|
||
This change roughly doubled the number of entries in about:memory, while only accounting for a small fraction of memory used. I think some consolidation of entries might be necessary in bug 633653 or a follow-up.
Assignee | ||
Comment 23•13 years ago
|
||
(In reply to comment #22) > This change roughly doubled the number of entries in about:memory, while only > accounting for a small fraction of memory used. I think some consolidation of > entries might be necessary in bug 633653 or a follow-up. As I understand it, the mobile team has been using the patch in this bug for a while to help reduce memory usage with consumers of SQLite. While there is a lot of data, it has been handy for developers.
Comment 24•13 years ago
|
||
Thinking some more, having a (possibly adjustable) threshold mechanism would be best, eg. don't show subtrees that account for less than 0.1% or something. That's what Massif does and it works well.
Comment 25•13 years ago
|
||
Shawn, how can there be more than one reporter for a single path?
Assignee | ||
Comment 26•13 years ago
|
||
(In reply to comment #25) > Shawn, how can there be more than one reporter for a single path? Yes, that's why I changed the display in this bug to handle that.
Comment 27•13 years ago
|
||
(In reply to comment #26) > > Shawn, how can there be more than one reporter for a single path? > > Yes, that's why I changed the display in this bug to handle that. Perhaps I wasn't clear. I don't understand how there can be multiple reporters for a single path. Can you please explain the circumstances under which this happens? Thanks!
Comment 28•13 years ago
|
||
(In reply to comment #26) > (In reply to comment #25) > > Shawn, how can there be more than one reporter for a single path? > Yes, that's why I changed the display in this bug to handle that. I think you missed the "how" in comment 25.
Assignee | ||
Comment 29•13 years ago
|
||
(In reply to comment #27) > Perhaps I wasn't clear. I don't understand how there can be multiple reporters > for a single path. Can you please explain the circumstances under which this > happens? Thanks! Our "path" in this case is the name of the database file. You can open more than one connection to a given database file, which causes duplicates.
You need to log in
before you can comment on or make changes to this bug.
Description
•