Bug 1464310 - Add profiler stack labels which contain the sql string when statements are executed or stepped. r=mak
authorMarkus Stange <mstange@themasta.com>
Thu, 31 May 2018 14:06:45 -0400
changeset 474964 9d570f91ea5a273fb2a38a0b40d90d00b9cbbbc6
parent 474963 ea2e4c24e373a2491b5599a992f641df554076a6
child 474965 e990d4d07b0eda625db7bf47a2a039c463096704
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1464310
milestone62.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 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