Bug 1464310 - Add profiler stack labels which contain the sql string when statements are executed or stepped. r?mak draft
authorMarkus Stange <mstange@themasta.com>
Thu, 31 May 2018 14:06:45 -0400
changeset 802335 3f3fbdf79c0aa5c6ba70b051a15ff8d38b592760
parent 802334 b4b2847fbd73a4cb4b3a4b0ae435f48c01498b2b
child 802336 c9b676fd6932ef3f7c3ac8b16e9a8822cc648ec5
push id111865
push userbmo:mstange@themasta.com
push dateThu, 31 May 2018 18:14:17 +0000
reviewersmak
bugs1464310
milestone62.0a1
Bug 1464310 - Add profiler stack labels which contain the sql string when statements are executed or stepped. r?mak MozReview-Commit-ID: 3ucqNlHTqCw
storage/mozStorageConnection.cpp
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -1161,16 +1161,20 @@ Connection::getFilename()
   }
   return leafname;
 }
 
 int
 Connection::stepStatement(sqlite3 *aNativeConnection, sqlite3_stmt *aStatement)
 {
   MOZ_ASSERT(aStatement);
+
+  AUTO_PROFILER_LABEL_DYNAMIC_CSTR("Connection::stepStatement", OTHER,
+                                   ::sqlite3_sql(aStatement));
+
   bool checkedMainThread = false;
   TimeStamp startTime = TimeStamp::Now();
 
   // The connection may have been closed if the executing statement has been
   // created and cached after a call to asyncClose() but before the actual
   // sqlite3_close().  This usually happens when other tasks using cached
   // statements are asynchronously scheduled for execution and any of them ends
   // up after asyncClose. See bug 728653 for details.
@@ -1274,16 +1278,18 @@ Connection::prepareStatement(sqlite3 *aN
 
 
 int
 Connection::executeSql(sqlite3 *aNativeConnection, const char *aSqlString)
 {
   if (!isConnectionReadyOnThisThread())
     return SQLITE_MISUSE;
 
+  AUTO_PROFILER_LABEL_DYNAMIC_CSTR("Connection::executeSql", OTHER, aSqlString);
+
   TimeStamp startTime = TimeStamp::Now();
   int srv = ::sqlite3_exec(aNativeConnection, aSqlString, nullptr, nullptr,
                            nullptr);
 
   // Report very slow SQL statements to Telemetry
   TimeDuration duration = TimeStamp::Now() - startTime;
   const uint32_t threshold =
     NS_IsMainThread() ? Telemetry::kSlowSQLThresholdForMainThread