Bug 1164559 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Thu, 14 May 2015 10:13:24 -0700
changeset 243817 3a3ab74e0e62618b4187ab0ed651dbaac7043bde
parent 243816 1e0f32a8185eec4aa4a6249c3a8a62646ef94a6d
child 243818 ced96b3a9ac733cffb116a1ef0b2c50b5e463bd2
push id28753
push userkwierso@gmail.com
push dateThu, 14 May 2015 22:33:43 +0000
treeherdermozilla-central@07e2e15703cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1164559
milestone41.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 1164559 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj
storage/src/VacuumManager.cpp
storage/src/mozStorageConnection.cpp
storage/src/mozStorageStatement.cpp
--- a/storage/src/VacuumManager.cpp
+++ b/storage/src/VacuumManager.cpp
@@ -239,17 +239,17 @@ Vacuumer::HandleError(mozIStorageError *
   warnMsg.Append(mDBFilename);
   warnMsg.AppendLiteral(" - ");
   warnMsg.AppendInt(result);
   warnMsg.Append(' ');
   warnMsg.Append(message);
   NS_WARNING(warnMsg.get());
 #endif
 
-  {
+  if (PR_LOG_TEST(gStorageLog, PR_LOG_ERROR)) {
     int32_t result;
     nsresult rv = aError->GetResult(&result);
     NS_ENSURE_SUCCESS(rv, rv);
     nsAutoCString message;
     rv = aError->GetMessage(message);
     NS_ENSURE_SUCCESS(rv, rv);
     PR_LOG(gStorageLog, PR_LOG_ERROR,
            ("Vacuum failed with error: %d '%s'. Database was: '%s'",
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -892,21 +892,23 @@ Connection::internalClose(sqlite3 *aNati
 #ifdef DEBUG
   { // Make sure we have marked our async thread as shutting down.
     MutexAutoLock lockedScope(sharedAsyncExecutionMutex);
     NS_ASSERTION(mAsyncExecutionThreadShuttingDown,
                  "Did not call setClosedState!");
   }
 #endif // DEBUG
 
-  nsAutoCString leafName(":memory");
-  if (mDatabaseFile)
-      (void)mDatabaseFile->GetNativeLeafName(leafName);
-  PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Closing connection to '%s'",
-                                      leafName.get()));
+  if (PR_LOG_TEST(gStorageLog, PR_LOG_NOTICE)) {
+    nsAutoCString leafName(":memory");
+    if (mDatabaseFile)
+        (void)mDatabaseFile->GetNativeLeafName(leafName);
+    PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Closing connection to '%s'",
+                                        leafName.get()));
+  }
 
   // At this stage, we may still have statements that need to be
   // finalized. Attempt to close the database connection. This will
   // always disconnect any virtual tables and cleanly finalize their
   // internal statements. Once this is done, closing may fail due to
   // unfinalized client statements, in which case we need to finalize
   // these statements and close again.
   {
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -599,17 +599,17 @@ Statement::ExecuteStep(bool *_moreResult
       return convertResultCode(srv);
     }
 
     // We have bound, so now we can clear our array.
     mParamsArray = nullptr;
   }
   int srv = mDBConnection->stepStatement(mNativeConnection, mDBStatement);
 
-  if (srv != SQLITE_ROW && srv != SQLITE_DONE) {
+  if (srv != SQLITE_ROW && srv != SQLITE_DONE && PR_LOG_TEST(gStorageLog, PR_LOG_DEBUG)) {
       nsAutoCString errStr;
       (void)mDBConnection->GetLastErrorString(errStr);
       PR_LOG(gStorageLog, PR_LOG_DEBUG,
              ("Statement::ExecuteStep error: %s", errStr.get()));
   }
 
   // SQLITE_ROW and SQLITE_DONE are non-errors
   if (srv == SQLITE_ROW) {