Closed
Bug 1439929
Opened 7 years ago
Closed 7 years ago
extend nsIWorkerDebugger to get performance counters (IPDL-ready)
Categories
(Core :: DOM: Workers, enhancement, P2)
Tracking
()
RESOLVED
INVALID
People
(Reporter: tarek, Assigned: tarek)
References
Details
(Whiteboard: [perf-tools])
Attachments
(1 file)
Let's add a API to retrieve WorkerPrivate instances (main-thread)
Updated•7 years ago
|
Priority: -- → P2
Comment 1•7 years ago
|
||
(In reply to Tarek Ziadé (:tarek) from comment #0)
> Let's add a API to retrieve WorkerPrivate instances (main-thread)
Can you write a couple of lines about why you need this?
Maybe you want to filter by window/windowID, worker type (Dedicated, Chrome, Service, Shared) ?
Updated•7 years ago
|
Flags: needinfo?(tarek)
Assignee | ||
Comment 2•7 years ago
|
||
In the about:energy project, we would like to measure the time spent in each runnnable in nsThread,
and link that time with the impacted tab.
The patch in bug 1437438 is doing this for all runnnables that are linked to a DocGroup,
and keeps track of the duration by storing the value in the DocGroup instance.
All values are then collected upon request via IDPL by iterating on tab groups with TabChild::GetAll()
This works well, and allow us to display the activity per tab and the details per window id.
The missing part though is workers, since a worker runnable is not linked directly to a docgroup.
The patch in bug 1437438 will be extended so we take into account runnnable for workers as well,
and the values will be stored into the WorkerPrivate instances in that case.
What will be missing is a way to iterate over WorkerPrivate instances in IPDL's ContentChild.
Here's what I had in mind:
void GetWorkers(nsTArray<WorkerPrivate*>& aWorkers) {
for (auto iter = mDomainMap.Iter(); !iter.Done(); iter.Next()) {
WorkerDomainInfo* aData = iter.UserData();
aWorkers.AppendElements(aData->mActiveWorkers);
aWorkers.AppendElements(aData->mActiveServiceWorkers);
}
}
I was thinking about adding that function along with a test for this patch,
so one may do something like:
AutoTArray<WorkerPrivate*, 100> workers;
RuntimeService* srv = RuntimeService::GetService();
if (srv) {
srv->GetWorkers(workers);
}
:baku, if that sounds right I can push a patch here, doing that change
Flags: needinfo?(tarek) → needinfo?(amarchesini)
Comment 3•7 years ago
|
||
Use nsIWorkerDebuggerManager to retrieve the list of nsIWorkerDebugger calling getWorkerDebuggerEnumerator().
You probably need to extend nsIWorkerDebugger interface.
Flags: needinfo?(amarchesini)
Updated•7 years ago
|
Whiteboard: [perf-tools]
Assignee | ||
Comment 4•7 years ago
|
||
These are IDL interfaces, and I guess I can extend nsIWorkerDebugger to grab the counters stored in workerPrivate and send back an array of structs.
But then I'll need to send them via IPDL via dom/ipc/ContentChild, so the parent process is able to collect the info from all processes.
My question is therefore: do I need to define the data I am sending via nsIWorkerDebugger in both IDL and IPDL ? or is there a way to define a struct that can be used in both places (nsIWorkerDebugger and ContentChild). It sounds like extra work to serialize the data into an IDL defined structure and then reserialize it so I can send it via IPDL.
Flags: needinfo?(amarchesini)
Assignee | ||
Comment 5•7 years ago
|
||
From a discussion with baku on IRC : we can use an IPDL struct to hold the data and extend nsIWorkerDebugger with a C++ api we can use directky in PContent
Flags: needinfo?(amarchesini)
Comment hidden (mozreview-request) |
Assignee | ||
Updated•7 years ago
|
Summary: Extend RuntimeService to expose WorkerPrivate instances → extend nsIWorkerDebugger to get performance counters (IPDL-ready)
Comment hidden (mozreview-request) |
Comment 8•7 years ago
|
||
mozreview-review |
Comment on attachment 8956382 [details]
Bug 1439929 - extend nsIWorkerDebugger to get performance counters (IPDL-ready)
https://reviewboard.mozilla.org/r/225256/#review231288
::: dom/ipc/PContent.ipdl:115
(Diff revision 2)
> namespace mozilla {
> namespace dom {
>
> +// Used to pass performance info stored in
> +// WorkerPrivate & DocGroup
> +struct PerformanceInfo
Move this into dom/ipc/DOMTypes.ipdlh
::: dom/ipc/PContent.ipdl:124
(Diff revision 2)
> + uint16_t pid;
> + uint64_t wid;
> + uint64_t pwid;
> + uint16_t count;
> + uint64_t duration;
> + bool worker;
Don't do this indentation. Just write type<space>name;
::: dom/workers/WorkerDebugger.h:47
(Diff revision 2)
>
> void
> ReportErrorToDebugger(const nsAString& aFilename, uint32_t aLineno,
> const nsAString& aMessage);
>
> + PerformanceInfo
Write a comment saying that this method resets the Performance data.
::: dom/workers/WorkerDebugger.h:48
(Diff revision 2)
> void
> ReportErrorToDebugger(const nsAString& aFilename, uint32_t aLineno,
> const nsAString& aMessage);
>
> + PerformanceInfo
> + ReportPerformanceInfo();
line before 'private:'
Attachment #8956382 -
Flags: review?(amarchesini) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 11•7 years ago
|
||
Closing this bug and merging the patch with Bug 1443443 so we can add a browser test
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•