app/test: change order of loops in hash function tests
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 10 Jun 2015 15:25:21 +0000 (16:25 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 16 Jun 2015 10:18:55 +0000 (12:18 +0200)
In order to see more clearly the performance difference
between different hash functions, order of the loops
have been changed, so it iterates first through initial values,
then key sizes and then the hash functions.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
app/test/test_hash_functions.c

index aff5e6d..5156dfc 100644 (file)
@@ -86,8 +86,8 @@ get_hash_name(rte_hash_function f)
  * Test a hash function.
  */
 static void
-run_hash_func_perf_test(rte_hash_function f, uint32_t init_val,
-               uint32_t key_len)
+run_hash_func_perf_test(uint32_t key_len, uint32_t init_val,
+               rte_hash_function f)
 {
        static uint8_t key[HASHTEST_ITERATIONS][RTE_HASH_KEY_LENGTH_MAX];
        uint64_t ticks, start, end;
@@ -121,12 +121,12 @@ run_hash_func_perf_tests(void)
                        HASHTEST_ITERATIONS);
        printf("Hash Func.  , Key Length (bytes), Initial value, Ticks/Op.\n");
 
-       for (i = 0; i < RTE_DIM(hashtest_funcs); i++) {
-               for (j = 0; j < RTE_DIM(hashtest_initvals); j++) {
-                       for (k = 0; k < RTE_DIM(hashtest_key_lens); k++) {
-                               run_hash_func_perf_test(hashtest_funcs[i],
-                                               hashtest_initvals[j],
-                                               hashtest_key_lens[k]);
+       for (i = 0; i < RTE_DIM(hashtest_initvals); i++) {
+               for (j = 0; j < RTE_DIM(hashtest_key_lens); j++) {
+                       for (k = 0; k < RTE_DIM(hashtest_funcs); k++) {
+                               run_hash_func_perf_test(hashtest_key_lens[j],
+                                               hashtest_initvals[i],
+                                               hashtest_funcs[k]);
                        }
                }
        }