mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 20:55:39 +00:00
Bug 1361401 - Make gc::Statistics counts atomic as these can be updated by helper threads r=sfink
--HG-- extra : rebase_source : 3856839f0dbfb2e6ad1e12d07d89e162dccba8e8
This commit is contained in:
parent
30d10d8dfc
commit
65e6107a3b
@ -549,14 +549,14 @@ Statistics::formatDetailedDescription()
|
||||
zoneStats.collectedZoneCount, zoneStats.zoneCount, zoneStats.sweptZoneCount,
|
||||
zoneStats.collectedCompartmentCount, zoneStats.compartmentCount,
|
||||
zoneStats.sweptCompartmentCount,
|
||||
counts[STAT_MINOR_GC],
|
||||
counts[STAT_STOREBUFFER_OVERFLOW],
|
||||
getCount(STAT_MINOR_GC),
|
||||
getCount(STAT_STOREBUFFER_OVERFLOW),
|
||||
mmu20 * 100., mmu50 * 100.,
|
||||
t(sccTotal), t(sccLongest),
|
||||
double(preBytes) / bytesPerMiB,
|
||||
counts[STAT_NEW_CHUNK] - counts[STAT_DESTROY_CHUNK],
|
||||
counts[STAT_NEW_CHUNK] + counts[STAT_DESTROY_CHUNK],
|
||||
double(ArenaSize * counts[STAT_ARENA_RELOCATED]) / bytesPerMiB);
|
||||
getCount(STAT_NEW_CHUNK) - getCount(STAT_DESTROY_CHUNK),
|
||||
getCount(STAT_NEW_CHUNK) + getCount(STAT_DESTROY_CHUNK),
|
||||
double(ArenaSize * getCount(STAT_ARENA_RELOCATED)) / bytesPerMiB);
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
@ -724,16 +724,16 @@ Statistics::formatJsonDescription(uint64_t timestamp)
|
||||
zoneStats.collectedZoneCount,
|
||||
zoneStats.zoneCount,
|
||||
zoneStats.compartmentCount,
|
||||
counts[STAT_MINOR_GC],
|
||||
counts[STAT_STOREBUFFER_OVERFLOW],
|
||||
getCount(STAT_MINOR_GC),
|
||||
getCount(STAT_STOREBUFFER_OVERFLOW),
|
||||
int(mmu20 * 100),
|
||||
int(mmu50 * 100),
|
||||
sccTotalParts.quot, sccTotalParts.rem,
|
||||
sccLongestParts.quot, sccLongestParts.rem,
|
||||
ExplainAbortReason(nonincrementalReason_),
|
||||
unsigned(preBytes / 1024 / 1024),
|
||||
counts[STAT_NEW_CHUNK],
|
||||
counts[STAT_DESTROY_CHUNK]);
|
||||
getCount(STAT_NEW_CHUNK),
|
||||
getCount(STAT_DESTROY_CHUNK));
|
||||
return DuplicateString(buffer);
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define gc_Statistics_h
|
||||
|
||||
#include "mozilla/Array.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
@ -262,10 +263,13 @@ struct Statistics
|
||||
}
|
||||
|
||||
void count(Stat s) {
|
||||
MOZ_ASSERT(s < STAT_LIMIT);
|
||||
counts[s]++;
|
||||
}
|
||||
|
||||
uint32_t getCount(Stat s) {
|
||||
return uint32_t(counts[s]);
|
||||
}
|
||||
|
||||
void beginNurseryCollection(JS::gcreason::Reason reason);
|
||||
void endNurseryCollection(JS::gcreason::Reason reason);
|
||||
|
||||
@ -361,7 +365,9 @@ struct Statistics
|
||||
PhaseTimeTable phaseTotals;
|
||||
|
||||
/* Number of events of this type for this GC. */
|
||||
EnumeratedArray<Stat, STAT_LIMIT, unsigned int> counts;
|
||||
EnumeratedArray<Stat,
|
||||
STAT_LIMIT,
|
||||
mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire>> counts;
|
||||
|
||||
/* Allocated space before the GC started. */
|
||||
size_t preBytes;
|
||||
|
Loading…
Reference in New Issue
Block a user