test-classifier: Add benchmark.
Add a benchmark command for classifier lookup performance testing.
Running the test-classifier without arguments of with "--help" will
print the following usage:
usage: ovstest test-classifier benchmark <n_rules> <n_priorities> <n_subtables> <n_threads> <n_lookups>
where:
<n_rules> - The number of rules to install for lookups. More rules
makes misses less likely.
<n_priorities> - How many different priorities to use. Using only 1
priority will force lookups to continue through all
subtables.
<n_subtables> - Number of subtables to use. Normally a classifier has
rules with different kinds of masks, resulting in
multiple subtables (one per mask). However, in some
special cases a table may consist of only one kind of
rules, so there will be only one subtable.
<n_threads> - How many lookup threads to use. Using one thread should
give less variance accross runs, but classifier
scaling can be tested with multiple threads.
<n_lookups> - How many lookups each thread should perform.
For testing the classifier is filled with <n_rules> rules using
<n_subtables> different mask patterns and <n_priorities> different
priorities. A random set of lookup flows are created, and <n_threads>
lookup threads are spawned to perform <n_lookups> lookups each. The
count of hits and misses, as well as the overall execution time is
reported.
Example run:
$ tests/ovstest test-classifier benchmark 1000 1 30 1
3800000
Benchmarking with:
1000 rules with 1 priorities in 30 tables, 1 threads doing
3800000 lookups each
Without wildcards:
hits: 461520, misses:
3338480
classifier lookups: 386 ms,
9844559 lookups/sec
With wildcards:
hits: 461520, misses:
3338480
classifier lookups: 866 ms,
4387990 lookups/sec
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>