X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fovsdb-server.c;h=139acc61107b4037564977ca97eaafc8d96b9b0d;hb=a814ba0f15c749aec0c5815ec099d4e165f67016;hp=d8363a2cbd2c5b2d80f3d71728e15344b033ebe8;hpb=cea157688977bbbb136f9c3bfe020fe485b43d39;p=openvswitch diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index d8363a2c..139acc61 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010, 2011 Nicira Networks +/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ #include "jsonrpc-server.h" #include "leak-checker.h" #include "list.h" +#include "memory.h" #include "ovsdb.h" #include "ovsdb-data.h" #include "ovsdb-types.h" @@ -39,6 +40,7 @@ #include "poll-loop.h" #include "process.h" #include "row.h" +#include "simap.h" #include "stream-ssl.h" #include "stream.h" #include "stress.h" @@ -135,6 +137,13 @@ main(int argc, char *argv[]) daemonize_complete(); + if (!run_command) { + /* ovsdb-server is usually a long-running process, in which case it + * makes plenty of sense to log the version, but --run makes + * ovsdb-server more like a command-line tool, so skip it. */ + VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION); + } + unixctl_command_register("exit", "", 0, 0, ovsdb_server_exit, &exiting); unixctl_command_register("ovsdb-server/compact", "", 0, 0, ovsdb_server_compact, file); @@ -143,6 +152,17 @@ main(int argc, char *argv[]) exiting = false; while (!exiting) { + memory_run(); + if (memory_should_report()) { + struct simap usage; + + simap_init(&usage); + ovsdb_jsonrpc_server_get_memory_usage(jsonrpc, &usage); + ovsdb_get_memory_usage(db, &usage); + memory_report(&usage); + simap_destroy(&usage); + } + reconfigure_from_db(jsonrpc, db, &remotes); ovsdb_jsonrpc_server_run(jsonrpc); unixctl_server_run(unixctl); @@ -157,6 +177,7 @@ main(int argc, char *argv[]) update_remote_status(jsonrpc, &remotes, db); } + memory_wait(); ovsdb_jsonrpc_server_wait(jsonrpc); unixctl_server_wait(unixctl); ovsdb_trigger_wait(db, time_msec());