Log more timing information from init.
Also make important events in init's life NOTICE rather than INFO,
and ensure that NOTICE events actually make it to the kernel log.
Also fix the logging so that if you have a printf format string
error, the compiler now catches it.
Also give messages from init, ueventd, and watchdogd distinct tags.
(Previously they'd all call themselves "init", and dmesg doesn't
include pids, so you couldn't untangle them.)
Also include the tag in SELinux messages.
Bug: 19544788
Change-Id: Ica6daea065bfdb80155c52c0b06f346a7df208fe
diff --git a/init/init_parser.cpp b/init/init_parser.cpp
index 57eb299..294dc19 100644
--- a/init/init_parser.cpp
+++ b/init/init_parser.cpp
@@ -14,15 +14,16 @@
* limitations under the License.
*/
+#include <ctype.h>
#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdarg.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdarg.h>
#include <string.h>
-#include <stddef.h>
-#include <ctype.h>
+#include <unistd.h>
#include "init.h"
#include "parser.h"
@@ -351,7 +352,7 @@
struct import* import = (struct import*) calloc(1, sizeof(struct import));
import->filename = strdup(conf_file);
list_add_tail(import_list, &import->list);
- INFO("found import '%s', adding to import list", import->filename);
+ INFO("Added '%s' to import list\n", import->filename);
}
static void parse_new_section(struct parse_state *state, int kw,
@@ -439,6 +440,7 @@
int init_parse_config_file(const char* path) {
INFO("Parsing %s...\n", path);
+ Timer t;
std::string data;
if (!read_file(path, &data)) {
return -1;
@@ -446,6 +448,8 @@
parse_config(path, data);
dump_parser_state();
+
+ NOTICE("(Parsing %s took %.2fs.)\n", path, t.duration());
return 0;
}