Bug 1464310 - Add profiler stack labels which contain the sql string when statements are executed or stepped. r?mak
MozReview-Commit-ID: 3ucqNlHTqCw
--- 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