Bug 1559220 - Special case IndexedDB threads in wakeup telemetry, r=erahm

The approach isn't perhaps super elegant, but it is a small and simple tweak.

Differential Revision: https://phabricator.services.mozilla.com/D34923

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Olli Pettay 2019-06-16 21:03:45 +00:00
Родитель 936159f4b1
Коммит c6b69378d0
5 изменённых файлов: 21 добавлений и 1 удалений

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

@ -11170,6 +11170,8 @@ bool ConnectionPool::ScheduleTransaction(TransactionInfo* aTransactionInfo,
nsresult rv = NS_NewNamedThread(runnable->GetThreadName(),
getter_AddRefs(newThread), runnable);
if (NS_SUCCEEDED(rv)) {
newThread->SetNameForWakeupTelemetry(
NS_LITERAL_CSTRING("IndexedDB (all)"));
MOZ_ASSERT(newThread);
IDB_DEBUG_LOG(("ConnectionPool created thread %" PRIu32,

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

@ -445,6 +445,11 @@ LazyIdleThread::GetLastLongNonIdleTaskEnd(TimeStamp* _retval) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
LazyIdleThread::SetNameForWakeupTelemetry(const nsACString& aName) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
LazyIdleThread::AsyncShutdown() {
ASSERT_OWNING_THREAD();

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

@ -176,4 +176,6 @@ interface nsIThread : nsISerialEventTarget
*/
[noscript] readonly attribute TimeStamp lastLongTaskEnd;
[noscript] readonly attribute TimeStamp lastLongNonIdleTaskEnd;
[noscript] void setNameForWakeupTelemetry(in ACString name);
};

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

@ -779,6 +779,14 @@ nsThread::GetLastLongNonIdleTaskEnd(TimeStamp* _retval) {
return NS_OK;
}
NS_IMETHODIMP
nsThread::SetNameForWakeupTelemetry(const nsACString& aName) {
#ifdef EARLY_BETA_OR_EARLIER
mNameForWakeupTelemetry = aName;
#endif
return NS_OK;
}
NS_IMETHODIMP
nsThread::AsyncShutdown() {
LOG(("THRD(%p) async shutdown\n", this));
@ -1137,7 +1145,9 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult) {
if (ms < 0) {
ms = 0;
}
const char* name = PR_GetThreadName(mThread);
const char* name = !mNameForWakeupTelemetry.IsEmpty()
? mNameForWakeupTelemetry.get()
: PR_GetThreadName(mThread);
if (!name) {
name = IsMainThread() ? "MainThread" : "(nameless thread)";
}

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

@ -245,6 +245,7 @@ class nsThread : public nsIThreadInternal,
mozilla::TimeStamp mNextIdleDeadline;
#ifdef EARLY_BETA_OR_EARLIER
nsCString mNameForWakeupTelemetry;
mozilla::TimeStamp mLastWakeupCheckTime;
uint32_t mWakeupCount = 0;
#endif