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/Devmapper.cpp b/Devmapper.cpp
index ed498a3..2cbed86 100644
--- a/Devmapper.cpp
+++ b/Devmapper.cpp
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
@@ -34,6 +36,7 @@
 
 #include <android-base/logging.h>
 #include <android-base/stringprintf.h>
+#include <utils/Trace.h>
 
 #include "Devmapper.h"
 
@@ -233,6 +236,7 @@
 }
 
 int Devmapper::destroyAll() {
+    ATRACE_NAME("Devmapper::destroyAll");
     char *buffer = (char *) malloc(1024 * 64);
     if (!buffer) {
         SLOGE("Error allocating memory (%s)", strerror(errno));