mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00

If the sampler records more than one counter (e.g.: memory and per-process CPU), both counters could appear right next to each other in the buffer. But then the current streaming code goes something like this: 1. Read entry 2. If entry is a counter, go to the next entry (which should be a timestamp) and output the full counter. 3. Go to the next entry. 4: Return to step 1 (until there are no more entries). The problem is this unconditional 3rd step: If we've just read a counter at step 2, we're located at the entry *past* that counter's data, which could be the start of the next counter, that the 3rd step now effectively skips! Also: - After reading the time, we can do e.Next() to skip it before testing if it's too old, this may save one loop. - After reading the optional "number", we can also do e.Next() to skip it, which will save one loop as well. Differential Revision: https://phabricator.services.mozilla.com/D145056