RESOLVED FIXED 194111
Web Inspector: Memory timeline starts from zero when both CPU and Memory timeline are enabled
https://bugs.webkit.org/show_bug.cgi?id=194111
Summary Web Inspector: Memory timeline starts from zero when both CPU and Memory time...
Joseph Pecoraro
Reported 2019-01-31 13:44:35 PST
Memory timeline starts from zero when both CPU and Memory timeline are enabled Steps to Reproduce: 1. Inspect this page 2. Show CPU and Memory Timelines 3. Reload page => Memory starts from zero Notes: - The ResourceUsageThread starts immediately when the first listener (CPU) is added therefore misses values for the second listener (Memory) until the second sample 500ms later. We should start with a small wait to give multiple unique listeners a chance to register before the first sample.
Attachments
[PATCH] Proposed Fix (1.89 KB, patch)
2019-01-31 14:38 PST, Joseph Pecoraro
hi: review+
Radar WebKit Bug Importer
Comment 1 2019-01-31 13:44:54 PST
Joseph Pecoraro
Comment 2 2019-01-31 14:38:37 PST
Created attachment 360786 [details] [PATCH] Proposed Fix
Devin Rousso
Comment 3 2019-01-31 16:43:48 PST
Comment on attachment 360786 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=360786&action=review rs=me > Source/WebCore/page/ResourceUsageThread.cpp:85 > + WTF::sleep(10_ms); Where did the `10_ms` come from? Is there any justification as to why that value was chosen? > Source/WebCore/page/ResourceUsageThread.cpp:127 > + WTF::sleep(10_ms); Should we also be waiting in the case that we already have observers?
Joseph Pecoraro
Comment 4 2019-02-01 11:54:57 PST
(In reply to Devin Rousso from comment #3) > Comment on attachment 360786 [details] > [PATCH] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=360786&action=review > > rs=me > > > Source/WebCore/page/ResourceUsageThread.cpp:85 > > + WTF::sleep(10_ms); > > Where did the `10_ms` come from? Is there any justification as to why that > value was chosen? Nope, the sample rate is 500ms, so this is just a small pause. I do not have a good reason for 10, other then it is small. And allows enough time for other listeners to be activated. > > Source/WebCore/page/ResourceUsageThread.cpp:127 > > + WTF::sleep(10_ms); > > Should we also be waiting in the case that we already have observers? That is what `waitUntilObservers` does. If we waited in there we will have this 10ms pause.
Devin Rousso
Comment 5 2019-02-01 13:09:02 PST
Comment on attachment 360786 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=360786&action=review >>> Source/WebCore/page/ResourceUsageThread.cpp:127 >>> + WTF::sleep(10_ms); >> >> Should we also be waiting in the case that we already have observers? > > That is what `waitUntilObservers` does. If we waited in there we will have this 10ms pause. I meant more of "why are we also waiting here if we're already waiting inside `waitUntilObservers`?"
Joseph Pecoraro
Comment 6 2019-02-01 13:26:27 PST
Joseph Pecoraro
Comment 7 2019-02-01 13:45:09 PST
Comment on attachment 360786 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=360786&action=review >>>> Source/WebCore/page/ResourceUsageThread.cpp:127 >>>> + WTF::sleep(10_ms); >>> >>> Should we also be waiting in the case that we already have observers? >> >> That is what `waitUntilObservers` does. If we waited in there we will have this 10ms pause. > > I meant more of "why are we also waiting here if we're already waiting inside `waitUntilObservers`?" This is the first time we ever wake up the thread, and we wait here because it is created when we have a listener so it won't wait inside of `waitUntilObservers`. If all observers unregister the thread stays alive in its while loop and will wake up when new listeners are added, those will then wait inside of `waitUntilObservers`.
Note You need to log in before you can comment on or make changes to this bug.