Bug 1873761 - let counter samples have their own timestamp instead of using the start time of the entire profiler sample, r=canaltinova,profiler-reviewers.

Differential Revision: https://phabricator.services.mozilla.com/D198078
This commit is contained in:
Florian Quèze 2024-01-11 12:15:52 +00:00
Родитель 4b6d1d9040
Коммит d7ddab90be
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -4252,12 +4252,15 @@ void SamplerThread::Run() {
}
// handle per-process generic counters
double counterSampleStartDeltaMs =
(TimeStamp::Now() - CorePS::ProcessStartTime()).ToMilliseconds();
const Vector<BaseProfilerCount*>& counters = CorePS::Counters(lock);
for (auto& counter : counters) {
if (auto sample = counter->Sample(); sample.isSampleNew) {
// create Buffer entries for each counter
buffer.AddEntry(ProfileBufferEntry::CounterId(counter));
buffer.AddEntry(ProfileBufferEntry::Time(sampleStartDeltaMs));
buffer.AddEntry(
ProfileBufferEntry::Time(counterSampleStartDeltaMs));
#if defined(MOZ_REPLACE_MALLOC) && defined(MOZ_PROFILER_MEMORY)
if (ActivePS::IsMemoryCounter(counter)) {
// For the memory counter, substract the size of our buffer to