* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER
+
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
+#include <utils/Trace.h>
#include "Devmapper.h"
}
int Devmapper::destroyAll() {
+ ATRACE_NAME("Devmapper::destroyAll");
char *buffer = (char *) malloc(1024 * 64);
if (!buffer) {
SLOGE("Error allocating memory (%s)", strerror(errno));
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER
+
#include <stdio.h>
#include <stdlib.h>
+#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
+#include <utils/Trace.h>
#include "Loop.h"
#include "VoldUtil.h"
}
int Loop::destroyAll() {
- for (int i = 0; i < LOOP_MAX; i++) {
- auto path = StringPrintf("/dev/block/loop%d", i);
+ ATRACE_NAME("Loop::destroyAll");
+
+ DIR* dir;
+ struct dirent* de;
+ std::string root = "/dev/block/";
+ if (!(dir = opendir(root.c_str()))) {
+ PLOG(ERROR) << "Failed to opendir";
+ return -1;
+ }
+
+ // Poke through all devices looking for loops
+ while ((de = readdir(dir))) {
+ if (strncmp(de->d_name, "loop", 4) != 0) continue;
+
+ auto path = root + de->d_name;
unique_fd fd(open(path.c_str(), O_RDWR | O_CLOEXEC));
if (fd.get() == -1) {
if (errno != ENOENT) {
LOG(VERBOSE) << "Found unmanaged loop device at " << path << " named " << id;
}
}
+
+ closedir(dir);
return 0;
}
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER
+
#include "VoldNativeService.h"
#include "VolumeManager.h"
#include "BenchmarkTask.h"
#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"
}
#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
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER
+
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <android-base/stringprintf.h>
#include <cutils/fs.h>
#include <cutils/log.h>
+#include <utils/Trace.h>
#include <selinux/android.h>
}
int VolumeManager::updateVirtualDisk() {
+ ATRACE_NAME("VolumeManager::updateVirtualDisk");
if (property_get_bool(kPropVirtualDisk, false)) {
if (access(kPathVirtualDisk, F_OK) != 0) {
Loop::createImageFile(kPathVirtualDisk, kSizeVirtualDisk / 512);
}
int VolumeManager::start() {
+ ATRACE_NAME("VolumeManager::start");
+
// Always start from a clean slate by unmounting everything in
// directories that we own, in case we crashed.
unmountAll();
int VolumeManager::unmountAll() {
std::lock_guard<std::mutex> lock(mLock);
+ ATRACE_NAME("VolumeManager::unmountAll()");
// First, try gracefully unmounting all known devices
if (mInternalEmulated != nullptr) {
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER
+
#include "model/Disk.h"
#include "VolumeManager.h"
#include "NetlinkManager.h"
#include <android-base/stringprintf.h>
#include <cutils/klog.h>
#include <cutils/properties.h>
+#include <utils/Trace.h>
#include <stdio.h>
#include <stdlib.h>
setenv("ANDROID_LOG_TAGS", "*:v", 1);
android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM));
+ ATRACE_BEGIN("main");
+
LOG(INFO) << "Vold 3.0 (the awakening) firing up";
LOG(VERBOSE) << "Detected support for:"
exit(1);
}
+ ATRACE_BEGIN("VoldNativeService::start");
if (android::vold::VoldNativeService::start() != android::OK) {
LOG(ERROR) << "Unable to start VoldNativeService";
exit(1);
}
+ ATRACE_END();
bool has_adoptable;
bool has_quota;
PLOG(ERROR) << "Error reading configuration... continuing anyways";
}
+ ATRACE_BEGIN("NetlinkManager::start");
if (nm->start()) {
PLOG(ERROR) << "Unable to start NetlinkManager";
exit(1);
}
+ ATRACE_END();
// This call should go after listeners are started to avoid
// a deadlock between vold and init (see b/34278978 for details)
// also the cold boot is needed in case we have flash drive
// connected before Vold launched
coldboot("/sys/block");
+
+ ATRACE_END();
+
// Eventually we'll become the monitoring thread
while(1) {
pause();
}
static void coldboot(const char *path) {
+ ATRACE_NAME("coldboot");
DIR *d = opendir(path);
if(d) {
do_coldboot(d, 0);
}
static int process_config(VolumeManager *vm, bool* has_adoptable, bool* has_quota) {
+ ATRACE_NAME("process_config");
+
fstab = fs_mgr_read_fstab_default();
if (!fstab) {
PLOG(ERROR) << "Failed to open default fstab";