Bug 1328408 - make Sampler::GetRegisteredThreads not copy the registered threads list; r=mstange

We call GetRegisteredThreads repeatedly on the sampler thread whenever
the profiler is active; there's no reason to have it churn memory.
This commit is contained in:
Nathan Froyd 2017-01-05 15:55:47 -05:00
Родитель fea256a2e2
Коммит e618b8d55a
5 изменённых файлов: 5 добавлений и 5 удалений

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

@ -317,7 +317,7 @@ static void* SignalSender(void* arg) {
if (!SamplerRegistry::sampler->IsPaused()) {
::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex);
std::vector<ThreadInfo*> threads =
const std::vector<ThreadInfo*>& threads =
SamplerRegistry::sampler->GetRegisteredThreads();
bool isFirstProfiledThread = true;

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

@ -211,7 +211,7 @@ class SamplerThread : public Thread {
SamplerRegistry::sampler->DeleteExpiredMarkers();
if (!SamplerRegistry::sampler->IsPaused()) {
::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex);
std::vector<ThreadInfo*> threads =
const std::vector<ThreadInfo*>& threads =
SamplerRegistry::sampler->GetRegisteredThreads();
bool isFirstProfiledThread = true;
for (uint32_t i = 0; i < threads.size(); i++) {

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

@ -129,7 +129,7 @@ class SamplerThread : public Thread {
if (!sampler_->IsPaused()) {
::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex);
std::vector<ThreadInfo*> threads =
const std::vector<ThreadInfo*>& threads =
sampler_->GetRegisteredThreads();
bool isFirstProfiledThread = true;
for (uint32_t i = 0; i < threads.size(); i++) {

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

@ -878,7 +878,7 @@ void mozilla_sampler_start(int aProfileEntries, double aInterval,
t->Start();
if (t->ProfileJS() || t->InPrivacyMode()) {
::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex);
std::vector<ThreadInfo*> threads = t->GetRegisteredThreads();
const std::vector<ThreadInfo*>& threads = t->GetRegisteredThreads();
for (uint32_t i = 0; i < threads.size(); i++) {
ThreadInfo* info = threads[i];

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

@ -379,7 +379,7 @@ class Sampler {
static pthread_t GetProfiledThread(PlatformData*);
#endif
static std::vector<ThreadInfo*> GetRegisteredThreads() {
static const std::vector<ThreadInfo*>& GetRegisteredThreads() {
return *sRegisteredThreads;
}