Closed Bug 724368 Opened 13 years ago Closed 12 years ago

telemetry for number of threads

Categories

(Core :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: dietrich, Assigned: Yoric)

References

Details

Attachments

(3 files, 4 obsolete files)

in bug 679498, tantek has ~1000 threads. we should add telemetry for thread count, to see how common a problem this is.
Blocks: 679498
Whiteboard: [mentor=Yoric][lang=c++]
Do we want the peak count for the entire session, or do we want to sample periodically and make a histogram of peak thread counts over some time interval (that is, every n minutes we insert a histogram entry for the peak number of threads seen during the preceding n minutes)?
For the moment, we are interested in a peak count. If this peak count is worrying, it there will still be time for something more detailed. I have a C++ patch that extracts the information, and I am now looking for the most appropriate place to feed this to Telemetry. Nathan suggested using your hooks from bug 852974.
Doug, do you have the time to review this patch?
Assignee: nobody → dteller
Attachment #731114 - Flags: review?(doug.turner)
Attached patch 3. Uploading the result (obsolete) (deleted) — Splinter Review
This passes tests. However, I have not found if adding a simple measurement requires some registration.
Attachment #731116 - Flags: feedback?(nfroyd)
Comment on attachment 731115 [details] [diff] [review] 2. Exposing the maximal number of threads to Telemetry Review of attachment 731115 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the IDL change and similar change to the .cpp. ::: toolkit/components/telemetry/nsITelemetry.idl @@ +88,5 @@ > + /** > + * A number representing the highest number of concurrent threads > + * reached during this session. > + */ > + readonly attribute jsval maximalNumberOfConcurrentThreads; Why not just make this an int (or long, if that's what it needs to be)?
Attachment #731115 - Flags: review?(nfroyd) → review+
Fixed, thanks.
Attachment #731115 - Attachment is obsolete: true
Attachment #731153 - Flags: review+
Comment on attachment 731116 [details] [diff] [review] 3. Uploading the result Review of attachment 731116 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/telemetry/tests/unit/test_TelemetryPing.js @@ +34,5 @@ > const PR_CREATE_FILE = 0x8; > const PR_TRUNCATE = 0x20; > const RW_OWNER = 0600; > > +const NUMBER_OF_THREADS_TO_LAUNCH = 100; I think you could get by with fewer threads. @@ +48,5 @@ > > +// Launch a number of threads, just for the sake of measuring the total number > +// of threads concurrently executing. > +for (let i = 0; i < NUMBER_OF_THREADS_TO_LAUNCH; ++i) { > + Services.tm.newThread(0); For sanity's sake, I think you want to measure the number of threads that actually got launched and use that below to avoid test failures induced by low memory or other conditions. Catching failure of the newThread call would be part of that. Please also move this into the main test function; I don't think there's a good reason for this to be at top level. Bonus points if you add code to clean up these launched threads as well.
Attachment #731116 - Flags: feedback?(nfroyd) → feedback+
Attached patch 3. Uploading the result, v2 (deleted) — Splinter Review
Attachment #731116 - Attachment is obsolete: true
Attachment #731158 - Flags: review?(nfroyd)
Comment on attachment 731158 [details] [diff] [review] 3. Uploading the result, v2 Review of attachment 731158 [details] [diff] [review]: ----------------------------------------------------------------- r=me.
Attachment #731158 - Flags: review?(nfroyd) → review+
Comment on attachment 731114 [details] [diff] [review] 1. Exposing the maximal number of threads to C++. Review of attachment 731114 [details] [diff] [review]: ----------------------------------------------------------------- ::: xpcom/threads/nsThreadManager.h @@ +43,5 @@ > nsThread *GetCurrentThread(); > > + // Returns the maximal number of threads that have been in existence > + // simultaneously during the execution of the thread manager. > + uint GetHighestNumberOfThreads(); Is there any reason for uint here? I think other code uses uint32_t in xpcom.
Attachment #731114 - Flags: review?(doug.turner) → review+
Switching everything to uint32_t for consistency.
Attachment #731114 - Attachment is obsolete: true
Attachment #732741 - Flags: review+
Whiteboard: [mentor=Yoric][lang=c++]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: