зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
fea256a2e2
Коммит
e618b8d55a
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче