mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1439168 - Return profiled threads sorted by registration time. r=njn
MozReview-Commit-ID: 6grx6eSLteQ --HG-- extra : rebase_source : 4a2a7c83f2c77dd9742d4be4047f5224b1759a40
This commit is contained in:
parent
c3a0802f37
commit
fcdbc4f32f
@ -525,6 +525,7 @@ public:
|
||||
// still have data in the buffer.
|
||||
// For threads that have already been unregistered, the RegisteredThread
|
||||
// pointer will be null.
|
||||
// The returned array is sorted by thread register time.
|
||||
// Do not hold on to the return value across thread registration or profiler
|
||||
// restarts.
|
||||
static nsTArray<Pair<RegisteredThread*, ProfiledThreadData*>> ProfiledThreads(PSLockRef)
|
||||
@ -536,6 +537,22 @@ public:
|
||||
for (auto& t : sInstance->mDeadProfiledThreads) {
|
||||
array.AppendElement(MakePair((RegisteredThread*)nullptr, t.get()));
|
||||
}
|
||||
|
||||
class ThreadRegisterTimeComparator {
|
||||
public:
|
||||
bool Equals(const Pair<RegisteredThread*, ProfiledThreadData*>& a,
|
||||
const Pair<RegisteredThread*, ProfiledThreadData*>& b) const
|
||||
{
|
||||
return a.second()->Info()->RegisterTime() == b.second()->Info()->RegisterTime();
|
||||
}
|
||||
|
||||
bool LessThan(const Pair<RegisteredThread*, ProfiledThreadData*>& a,
|
||||
const Pair<RegisteredThread*, ProfiledThreadData*>& b) const
|
||||
{
|
||||
return a.second()->Info()->RegisterTime() < b.second()->Info()->RegisterTime();
|
||||
}
|
||||
};
|
||||
array.Sort(ThreadRegisterTimeComparator());
|
||||
return array;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user