Skip to content

Commit

Permalink
ovs-benchmark: Compile for windows.
Browse files Browse the repository at this point in the history
This just makes ovs-benchmark compile on windows.
This lets us go ahead with just a 'make' instead of
picking and choosing executables that are tested to work on
windows as arguments for make.

This commit does not make ovs-benchmark a supported utility
on windows.

Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
shettyg committed Jun 30, 2014
1 parent 8f26aeb commit 6d1e400
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
10 changes: 5 additions & 5 deletions BUILD.Windows
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ or from a distribution tar ball.

* Run make for the ported executables in the top source directory, e.g.:

% make lib/vswitch-idl.h lib/vtep-idl.h ofproto/ipfix-entities.def
% make ovsdb/ovsdb-server.exe ovsdb/ovsdb-tool.exe ovsdb/ovsdb-client.exe \
utilities/ovs-vsctl.exe utilities/ovs-ofctl.exe \
utilities/ovs-dpctl.exe vswitchd/ovs-vswitchd.exe \
utilities/ovs-appctl.exe
% make

* To run all the unit tests:

% make check

OpenSSL, Open vSwitch and Visual C++
------------------------------------
Expand Down
30 changes: 18 additions & 12 deletions utilities/ovs-benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,26 @@ static const struct command *get_all_commands(void);
static void parse_options(int argc, char *argv[]);
static void usage(void);

static int
do_poll(struct pollfd *fds, int nfds, int timeout)
{
int retval;
#ifndef _WIN32
do {
retval = poll(fds, nfds, timeout);
} while (retval < 0 && errno == EINTR);
#else
retval = WSAPoll(fds, nfds, timeout);
#endif
return retval;
}

static long long int
time_in_msec(void)
{
struct timeval tv;

if (gettimeofday(&tv, NULL) < 0) {
ovs_fatal(errno, "gettimeofday");
}
xgettimeofday(&tv);

return tv.tv_sec * 1000LL + tv.tv_usec / 1000;
}
Expand Down Expand Up @@ -284,9 +296,7 @@ cmd_listen(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
for (;;) {
int retval;

do {
retval = poll(fds, n_fds, -1);
} while (retval < 0 && errno == EINTR);
retval = do_poll(fds, n_fds, -1);
if (retval < 0) {
ovs_fatal(errno, "poll failed");
}
Expand Down Expand Up @@ -445,9 +455,7 @@ cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
delay = 1000;
}

do {
error = poll(fds, n_fds, delay) < 0 ? errno : 0;
} while (error == EINTR);
error = do_poll(fds, n_fds, delay);
if (error) {
ovs_fatal(errno, "poll");
}
Expand Down Expand Up @@ -578,9 +586,7 @@ cmd_latency(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
while (n_fds > 0) {
int error;

do {
error = poll(fds, n_fds, -1) < 0 ? errno : 0;
} while (error == EINTR);
error = do_poll(fds, n_fds, -1);
if (error) {
ovs_fatal(errno, "poll");
}
Expand Down

0 comments on commit 6d1e400

Please sign in to comment.