| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
An occasionally significant problem with the standard "assert" macro is
that it writes the failure message to stderr. In our daemons, stderr is
generally redirected to /dev/null. It's more useful to write the failure
message to the log, which is what the new ovs_assert macro introduced in
this patch does.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the fastest portable implementation among the ones below, as
measured with GCC 4.4 on a Xeon X3430. The measeured times were, in
seconds:
popcount1 25.6
popcount2 6.9 (but is not portable)
popcount3 31.4
popcount4 25.6
popcount5 61.6 (and is buggy)
popcount6 64.6
popcount7 32.3
popcount8 11.2
int
popcount1(unsigned int x)
{
return __builtin_popcount(x);
}
int
popcount2(unsigned int x)
{
unsigned int y;
asm("popcnt %1, %0" : "=r" (y) : "g" (x));
return y;
}
int
popcount3(unsigned int x)
{
unsigned int n;
n = (x >> 1) & 033333333333;
x -= n;
n = (n >> 1) & 033333333333;
x -= n;
x = (x + (x >> 3)) & 030707070707;
return x % 63;
}
int
popcount4(unsigned int x)
{
x -= (x >> 1) & 0x55555555;
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0f0f0f0f;
x += x >> 8;
x += x >> 16;
return x & 0x3f;
}
int
popcount5(unsigned int x)
{
int n;
n = 0;
while (x) {
if (x & 0xf) {
n += ((0xe9949440 >> (x & 0xf)) & 3) + 1;
}
x >>= 4;
}
return n;
}
int
popcount6(unsigned int x)
{
int n;
n = 0;
while (x) {
n += (0xe994 >> (x & 7)) & 3;
x >>= 3;
}
return n;
}
int
popcount7(unsigned int x)
{
static const int table[16] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4
};
return (table[x & 0xf]
+ table[(x >> 4) & 0xf]
+ table[(x >> 8) & 0xf]
+ table[(x >> 12) & 0xf]
+ table[(x >> 16) & 0xf]
+ table[(x >> 20) & 0xf]
+ table[(x >> 24) & 0xf]
+ table[x >> 28]);
}
static int
popcount8(unsigned int x)
{
((((X) & (1 << 0)) != 0) + \
(((X) & (1 << 1)) != 0) + \
(((X) & (1 << 2)) != 0) + \
(((X) & (1 << 3)) != 0) + \
(((X) & (1 << 4)) != 0) + \
(((X) & (1 << 5)) != 0) + \
(((X) & (1 << 6)) != 0) + \
(((X) & (1 << 7)) != 0))
static const uint8_t popcount8[256] = {
INIT64(0), INIT64(64), INIT64(128), INIT64(192)
};
return (popcount8[x & 0xff] +
popcount8[(x >> 8) & 0xff] +
popcount8[(x >> 16) & 0xff] +
popcount8[x >> 24]);
}
int
main(void)
{
unsigned long long int x;
int n;
n = 0;
for (x = 0; x <= UINT32_MAX; x++) {
n += popcount8(x);
}
printf("%d\n", n);
return 0;
}
Signed-off-by: Ben Pfaff <blp@nicira.com>
|
|
|
|
|
|
| |
This will allow passing arguments in for an upcoming test.
Signed-off-by: Ben Pfaff <blp@nicira.com>
|
|
|
|
|
|
| |
It's the obvious counterpart to bitwise_zero().
Signed-off-by: Ben Pfaff <blp@nicira.com>
|
|
|
|
|
| |
Calculates the position of the most significant bit in a 32 bit
word.
|
|
|
|
|
|
|
| |
It's better to check output than to ignore it, because ignoring
output can fail to detect real bugs later if the output changes.
Reviewed-by: Simon Horman <horms@verge.net.au>
|
|
|
|
|
|
| |
This only tests ip_is_cidr(), since that is the only tricky function
currently defined. This will get more use once IPv6 functions are
added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This test would have made the bug fixed in the previous commit obvious. It
would have printed the following:
average=0007c220
bit 0 1
0 5012 4988
1 5019 4981
2 5154 4846
3 4909 5091
4 5011 4989
5 5021 4979
6 4911 5089
7 4910 5090
8 5011 4989
9 5020 4980
10 5154 4846
11 5021 4979
12 5155 4845
13 5019 4981
14 5153 4847
15 5153 4847
16 5153 4847
17 5153 4847
18 5153 4847
19 5152 4848
20 10000 0
21 10000 0
22 10000 0
23 10000 0
24 10000 0
25 10000 0
26 10000 0
27 10000 0
28 10000 0
29 10000 0
30 10000 0
31 10000 0
(expected values are 5000)
nibble 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 696 646 564 693 542 545 612 611 687 663 645 560 674 566 592 704
1 625 589 597 571 638 623 604 663 670 652 650 557 541 683 686 651
2 628 644 659 672 648 569 585 616 623 647 681 600 586 675 601 566
3 683 665 717 549 633 613 701 592 663 531 545 800 623 608 590 487
4 622 657 777 557 720 608 613 598 657 678 551 654 615 596 598 499
5 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(expected values are 625)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Many Open vSwitch tests fail on Debian's automatic build machines because
the builds occur in deeply nested directories with long names. OVS tries
to bind and connect to Unix domain sockets using absolute path names, which
in combination with long directory names means that the socket's name
exceeds the limit for Unix domain socket names (108 bytes on Linux).
This commit works around the problem on Linux by indirecting through
/proc/self/fd/<dirfd>/<basename> when names exceed the maximum that can be
used directly.
Reported-by: Hector Oron <hector.oron@gmail.com>
Reported-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reported-by: Roger Leigh <rleigh@codelibre.net>
Debian bug #602891.
Debian bug #602911.
|
|
|
|
| |
Suggested-by: Justin Pettit <jpettit@nicira.com>
|
| |
|
|
|
|
|
| |
This makes it easier to see which tests are taking up a lot of time, and
to see which ones actually fail if any of them do.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
COPYING
datapath/datapath.h
lib/automake.mk
lib/dpif-provider.h
lib/dpif.c
lib/hmap.h
lib/netdev-provider.h
lib/netdev.c
lib/stream-ssl.h
ofproto/executer.c
ofproto/ofproto.c
ofproto/ofproto.h
tests/automake.mk
utilities/ovs-ofctl.c
utilities/ovs-vsctl.in
vswitchd/ovs-vswitchd.conf.5.in
xenserver/etc_init.d_vswitch
xenserver/etc_xensource_scripts_vif
xenserver/opt_xensource_libexec_interface-reconfigure
|
| |
| |
| |
| |
| |
| | |
Our bug fix for glibc's strtok_r() bug was not effective in distribution
tarballs. This new test should catch that problem earlier in case it
recurs.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
This test should help avoid simple bugs in the SSL vconn and SSL stream
implementations in the future. It would have found the bugs fixed by
recent commits.
|
|/ |
|
| |
|
|
Autotest doesn't provide a lot of benefit by itself but it does allow us
to easily put a wrapper around each test by using a macro to invoke it.
(To do that with the built-in Automake test framework you need to write
or generate a separate wrapper script for each test, which is a pain.)
The next commit will take advantage of this possibility by adding support
for code coverage analysis.
|