ovs-brcompatd: Log the time to reload vswitch, to aid with debugging.
authorBen Pfaff <blp@nicira.com>
Tue, 2 Jun 2009 21:08:04 +0000 (14:08 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 2 Jun 2009 21:08:04 +0000 (14:08 -0700)
lib/automake.mk
vswitchd/ovs-brcompatd.c

index 98f47a08f1d7f4bc92b7cd81a909a6f296d1f935..b447aa5601438c8d0eb2d49e6215bc5b1a3d0808 100644 (file)
@@ -176,7 +176,8 @@ COVERAGE_SOURCES = \
        secchan/ofproto.c \
        secchan/pktbuf.c \
        vswitchd/bridge.c \
-       vswitchd/mgmt.c
+       vswitchd/mgmt.c \
+       vswitchd/ovs-brcompatd.c
 lib/coverage-counters.c: $(COVERAGE_SOURCES) lib/coverage-scan.pl
        (cd $(srcdir) && $(PERL) lib/coverage-scan.pl $(COVERAGE_SOURCES)) > $@.tmp
        mv $@.tmp $@
index 5531aa446a37ea793130cd5dd73137bc2652f5e9..bdd131529657a51daae16c7667779e668ad21bd4 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "cfg.h"
 #include "command-line.h"
+#include "coverage.h"
 #include "daemon.h"
 #include "dirs.h"
 #include "dpif.h"
@@ -183,13 +184,18 @@ rewrite_and_reload_config(void)
     if (cfg_is_dirty()) {
         int error1 = cfg_write();
         int error2 = cfg_read();
+        long long int reload_start = time_msec();
         int error3 = system(reload_command);
+        long long int elapsed = time_msec() - reload_start;
+        COVERAGE_INC(brcompatd_reload);
+        if (elapsed > 0) {
+            VLOG_INFO("reload command executed in %lld ms", elapsed);
+        }
         if (error3 == -1) {
-            VLOG_ERR_RL(&rl, "failed to execute reload command: %s",
-                        strerror(errno));
+            VLOG_ERR("failed to execute reload command: %s", strerror(errno));
         } else if (error3 != 0) {
             char *msg = process_status_msg(error3);
-            VLOG_ERR_RL(&rl, "reload command exited with error (%s)", msg);
+            VLOG_ERR("reload command exited with error (%s)", msg);
             free(msg);
         }
         return error1 ? error1 : error2 ? error2 : error3 ? ECHILD : 0;