mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 996285 - Profiler stops duplicating samples during sleeping periods after buffer wraps. r=benwa
This commit is contained in:
parent
9cddb231b1
commit
7a00ba6b15
@ -462,13 +462,15 @@ mozilla::Mutex* ThreadProfile::GetMutex()
|
||||
|
||||
void ThreadProfile::DuplicateLastSample() {
|
||||
// Scan the whole buffer (even unflushed parts)
|
||||
// we add mEntrySize to mReadPos to make sure that when
|
||||
// we wrap around the result is mEntrySize-1 and not -1
|
||||
for (int readPos = mWritePos; readPos != (mReadPos + mEntrySize - 1) % mEntrySize; readPos = (readPos + mEntrySize - 1) % mEntrySize) {
|
||||
// Found the start of the last entry at position i
|
||||
// Adding mEntrySize makes the result of the modulus positive
|
||||
// We search backwards from mWritePos-1 to mReadPos
|
||||
for (int readPos = (mWritePos + mEntrySize - 1) % mEntrySize;
|
||||
readPos != (mReadPos + mEntrySize - 1) % mEntrySize;
|
||||
readPos = (readPos + mEntrySize - 1) % mEntrySize) {
|
||||
if (mEntries[readPos].mTagName == 's') {
|
||||
// Found the start of the last entry at position readPos
|
||||
int copyEndIdx = mWritePos;
|
||||
// Go through the whole entry and duplicate it using a simple state machine
|
||||
// Go through the whole entry and duplicate it
|
||||
for (;readPos != copyEndIdx; readPos = (readPos + 1) % mEntrySize) {
|
||||
switch (mEntries[readPos].mTagName) {
|
||||
// Copy with new time
|
||||
@ -479,7 +481,7 @@ void ThreadProfile::DuplicateLastSample() {
|
||||
case 'm':
|
||||
break;
|
||||
// Copy anything else we don't know about
|
||||
// L, B, S, m, c, s, d, l, f, h, r, t, p
|
||||
// L, B, S, c, s, d, l, f, h, r, t, p
|
||||
default:
|
||||
addTag(mEntries[readPos]);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user