Make Loop::destroyAll() smarter.
Instead of blindly looping across 4096 possible devices, use
readdir() to only look at valid devices. This speeds up destroyAll()
from 40ms to 0.7ms.
Add tracing information in several places.
Test: external/chromium-trace/systrace.py -b 128768 sched freq am pm ss core_services binder_driver -a system_server,installd,vold
Bug: 65634729, 65737446
Change-Id: If581de47fb55850c0fcd6e25bf33ed246e1b079d
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 310610c..049f5ba 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER
+
#include "VoldNativeService.h"
#include "VolumeManager.h"
#include "BenchmarkTask.h"
@@ -32,6 +34,7 @@
#include <android-base/strings.h>
#include <fs_mgr.h>
#include <private/android_filesystem_config.h>
+#include <utils/Trace.h>
#ifndef LOG_TAG
#define LOG_TAG "vold"
@@ -169,10 +172,12 @@
}
#define ACQUIRE_LOCK \
- std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getLock());
+ std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getLock()); \
+ ATRACE_CALL();
#define ACQUIRE_CRYPT_LOCK \
- std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getCryptLock());
+ std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getCryptLock()); \
+ ATRACE_CALL();
} // namespace