Bug 1320289 - register STS thread to gecko profiler. r=cyu,mayhemer
authorShih-Chiang Chien <schien@mozilla.com>
Fri, 25 Nov 2016 18:07:06 +0800
changeset 324462 db8158d1b31db9c687774b9d9673025b59a710e5
parent 324461 fd9319f6ddce19f9b21dfc1b1888b13df7b24e8d
child 324463 c27b65f7a0c7b1b970e1e4b829187e46464314ba
push id34716
push userschien@mozilla.com
push dateTue, 29 Nov 2016 04:08:54 +0000
treeherderautoland@db8158d1b31d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscyu, mayhemer
bugs1320289
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1320289 - register STS thread to gecko profiler. r=cyu,mayhemer MozReview-Commit-ID: IzDNHDYAgsT
netwerk/base/nsSocketTransportService2.cpp
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -819,16 +819,21 @@ void
 nsSocketTransportService::MarkTheLastElementOfPendingQueue()
 {
     mServingPendingQueue = false;
 }
 
 NS_IMETHODIMP
 nsSocketTransportService::Run()
 {
+#ifdef MOZ_ENABLE_PROFILER_SPS
+    char stackBaseGuess; // Need to be the first variable of main loop function.
+    profiler_register_thread(PR_GetThreadName(PR_GetCurrentThread()), &stackBaseGuess);
+#endif // MOZ_ENABLE_PROFILER_SPS
+
     SOCKET_LOG(("STS thread init %d sockets\n", gMaxCount));
 
     psm::InitializeSSLServerCertVerificationThreads();
 
     gSocketThread = PR_GetCurrentThread();
 
     {
         MutexAutoLock lock(mLock);
@@ -999,16 +1004,21 @@ nsSocketTransportService::Run()
     // socket detach handlers get processed.
     NS_ProcessPendingEvents(mRawThread);
 
     gSocketThread = nullptr;
 
     psm::StopSSLServerCertVerificationThreads();
 
     SOCKET_LOG(("STS thread exit\n"));
+
+#ifdef MOZ_ENABLE_PROFILER_SPS
+    profiler_unregister_thread();
+#endif // MOZ_ENABLE_PROFILER_SPS
+
     return NS_OK;
 }
 
 void
 nsSocketTransportService::DetachSocketWithGuard(bool aGuardLocals,
                                                 SocketContext *socketList,
                                                 int32_t index)
 {