[ovs-dev] [PATCH 2/2] ovsdb: integrate perf-counter infrastructure into ovsdb-server
Andy Zhou
azhou at nicira.com
Tue Apr 14 19:40:23 UTC 2015
Sorry for breaking the build for windows. Just posted a patch that
should fix this.
On Mon, Apr 13, 2015 at 9:09 PM, Gurucharan Shetty <shettyg at nicira.com> wrote:
> On Sat, Mar 21, 2015 at 12:00 AM, Andy Zhou <azhou at nicira.com> wrote:
>> This integration also adds two commands:
>>
>> ovsdb-server/perf-counters-show -- show all counters
>> ovsdb-server/perf-counters-clear -- clear all counters
>>
>> There is no pre-configured sample points. A programmer needs to
>> added sampling point by changing the source code. However he
>> does not need to worry about infrastructures such as initialization
>> or cleaning up memory when ovsdb-server exits.
>>
>> Signed-off-by: Andy Zhou <azhou at nicira.com>
> This breaks the Windows build. Details here:
> https://ci.appveyor.com/project/blp/ovs/build/1.0.157
>
>
>> ---
>> ovsdb/ovsdb-server.c | 31 ++++++++++++++++++++++++++++++-
>> 1 file changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
>> index deb2b8b..cd13b0d 100644
>> --- a/ovsdb/ovsdb-server.c
>> +++ b/ovsdb/ovsdb-server.c
>> @@ -53,6 +53,7 @@
>> #include "trigger.h"
>> #include "util.h"
>> #include "unixctl.h"
>> +#include "perf-counter.h"
>> #include "openvswitch/vlog.h"
>>
>> VLOG_DEFINE_THIS_MODULE(ovsdb_server);
>> @@ -76,6 +77,8 @@ static bool bootstrap_ca_cert;
>> static unixctl_cb_func ovsdb_server_exit;
>> static unixctl_cb_func ovsdb_server_compact;
>> static unixctl_cb_func ovsdb_server_reconnect;
>> +static unixctl_cb_func ovsdb_server_perf_counters_clear;
>> +static unixctl_cb_func ovsdb_server_perf_counters_show;
>>
>> struct server_config {
>> struct sset *remotes;
>> @@ -292,6 +295,8 @@ main(int argc, char *argv[])
>>
>> daemonize_complete();
>>
>> + perf_counters_init();
>> +
>> 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
>> @@ -318,6 +323,10 @@ main(int argc, char *argv[])
>> ovsdb_server_remove_database, &server_config);
>> unixctl_command_register("ovsdb-server/list-dbs", "", 0, 0,
>> ovsdb_server_list_databases, &all_dbs);
>> + unixctl_command_register("ovsdb-server/perf-counters-show", "", 0, 0,
>> + ovsdb_server_perf_counters_show, NULL);
>> + unixctl_command_register("ovsdb-server/perf-counters-clear", "", 0, 0,
>> + ovsdb_server_perf_counters_clear, NULL);
>>
>> main_loop(jsonrpc, &all_dbs, unixctl, &remotes, run_process, &exiting);
>>
>> @@ -338,7 +347,7 @@ main(int argc, char *argv[])
>> run_command, process_status_msg(status));
>> }
>> }
>> -
>> + perf_counters_destroy();
>> service_stop();
>> return 0;
>> }
>> @@ -1022,6 +1031,26 @@ ovsdb_server_exit(struct unixctl_conn *conn, int argc OVS_UNUSED,
>> }
>>
>> static void
>> +ovsdb_server_perf_counters_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
>> + const char *argv[] OVS_UNUSED,
>> + void *arg_ OVS_UNUSED)
>> +{
>> + char *s = perf_counters_to_string();
>> +
>> + unixctl_command_reply(conn, s);
>> + free(s);
>> +}
>> +
>> +static void
>> +ovsdb_server_perf_counters_clear(struct unixctl_conn *conn, int argc OVS_UNUSED,
>> + const char *argv[] OVS_UNUSED,
>> + void *arg_ OVS_UNUSED)
>> +{
>> + perf_counters_clear();
>> + unixctl_command_reply(conn, NULL);
>> +}
>> +
>> +static void
>> ovsdb_server_compact(struct unixctl_conn *conn, int argc,
>> const char *argv[], void *dbs_)
>> {
>> --
>> 1.9.1
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list