Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107161908
D30096.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D30096.diff
View Options
diff --git a/sys/tests/fib_lookup/fib_lookup.c b/sys/tests/fib_lookup/fib_lookup.c
--- a/sys/tests/fib_lookup/fib_lookup.c
+++ b/sys/tests/fib_lookup/fib_lookup.c
@@ -509,13 +509,13 @@
rnd_lps(SYSCTL_HANDLER_ARGS)
{
struct epoch_tracker et;
- struct in_addr *keys;
- struct nhop_object **nhops;
-
+ struct in_addr key;
struct timespec ts_pre, ts_post;
uint64_t total_diff, lps;
- int error;
+ uint32_t *keys;
+ uintptr_t acc = 0;
int count = 0;
+ int error;
error = sysctl_handle_int(oidp, &count, 0, req);
if (error != 0)
@@ -524,12 +524,8 @@
return (0);
keys = malloc(sizeof(*keys) * count, M_TEMP, M_NOWAIT);
- nhops = malloc(sizeof(*nhops) * count, M_TEMP, M_NOWAIT);
- if (keys == NULL || nhops == NULL) {
- free(keys, M_TEMP);
- free(nhops, M_TEMP);
+ if (keys == NULL)
return (ENOMEM);
- }
printf("Preparing %d random keys...\n", count);
arc4random_buf(keys, sizeof(*keys) * count);
@@ -537,26 +533,42 @@
NET_EPOCH_ENTER(et);
nanouptime(&ts_pre);
- for (int i = 0; i < count; i++)
- nhops[i] = fib4_lookup(RT_DEFAULT_FIB, keys[i], 0, NHR_NONE, 0);
+ switch (arg2) {
+ case 0:
+ for (int i = 0; i < count; i++) {
+ key.s_addr = keys[i] + acc;
+ acc += (uintptr_t) fib4_lookup(RT_DEFAULT_FIB, key, 0,
+ NHR_NONE, 0);
+ }
+ case 1:
+ for (int i = 0; i < count; i++) {
+ key.s_addr = keys[i];
+ acc += (uintptr_t) fib4_lookup(RT_DEFAULT_FIB, key, 0,
+ NHR_NONE, 0);
+ }
+ }
nanouptime(&ts_post);
NET_EPOCH_EXIT(et);
free(keys, M_TEMP);
- free(nhops, M_TEMP);
total_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 +
- (ts_post.tv_nsec - ts_pre.tv_nsec);
+ (ts_post.tv_nsec - ts_pre.tv_nsec) + (acc & 1);
lps = 1000000000ULL * count / total_diff;
printf("%d lookups in %zu nanoseconds, %lu.%06lu MLPS\n",
count, total_diff, lps / 1000000, lps % 1000000);
return (0);
}
-SYSCTL_PROC(_net_route_test, OID_AUTO, rnd_lps,
+SYSCTL_PROC(_net_route_test, OID_AUTO, run_lps_seq,
CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
0, 0, rnd_lps, "I",
- "Measure lookups per second using uniformly random keys");
+ "Measure lookups per second, uniformly random keys, "
+ "artificial dependencies between lookups");
+SYSCTL_PROC(_net_route_test, OID_AUTO, run_lps_rnd,
+ CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ 0, 1, rnd_lps, "I",
+ "Measure lookups per second, uniformly random keys, independent lookups");
static int
test_fib_lookup_modevent(module_t mod, int type, void *unused)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 2:02 AM (21 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15759890
Default Alt Text
D30096.diff (2 KB)
Attached To
Mode
D30096: Revise FIB lookups per second benchmarking routines
Attached
Detach File
Event Timeline
Log In to Comment