Lines Matching +full:per +full:- +full:cpu

1 // SPDX-License-Identifier: GPL-2.0-only
83 static void test_hash_prealloc(int cpu) in test_hash_prealloc() argument
91 printf("%d:hash_map_perf pre-alloc %lld events per sec\n", in test_hash_prealloc()
92 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_hash_prealloc()
121 static void do_test_lru(enum test_type test, int cpu) in do_test_lru() argument
130 if (test == INNER_LRU_HASH_PREALLOC && cpu) { in do_test_lru()
131 /* If CPU is not 0, create inner_lru hash map and insert the fd in do_test_lru()
132 * value into the array_of_lru_hash map. In case of CPU 0, in do_test_lru()
138 assert(cpu < MAX_NR_CPUS); in do_test_lru()
143 inner_lru_map_fds[cpu] = in do_test_lru()
150 if (inner_lru_map_fds[cpu] == -1) { in do_test_lru()
156 ret = bpf_map_update_elem(outer_fd, &cpu, in do_test_lru()
157 &inner_lru_map_fds[cpu], in do_test_lru()
161 cpu, strerror(errno), errno); in do_test_lru()
188 ret = connect(-1, (const struct sockaddr *)&in6, sizeof(in6)); in do_test_lru()
189 assert(ret == -1 && errno == EBADF); in do_test_lru()
191 lru_hash_lookup_test_entries - 32) in do_test_lru()
196 printf("%d:%s pre-alloc %lld events per sec\n", in do_test_lru()
197 cpu, test_name, in do_test_lru()
198 max_cnt * 1000000000ll / (time_get_ns() - start_time)); in do_test_lru()
201 static void test_lru_hash_prealloc(int cpu) in test_lru_hash_prealloc() argument
203 do_test_lru(LRU_HASH_PREALLOC, cpu); in test_lru_hash_prealloc()
206 static void test_nocommon_lru_hash_prealloc(int cpu) in test_nocommon_lru_hash_prealloc() argument
208 do_test_lru(NOCOMMON_LRU_HASH_PREALLOC, cpu); in test_nocommon_lru_hash_prealloc()
211 static void test_inner_lru_hash_prealloc(int cpu) in test_inner_lru_hash_prealloc() argument
213 do_test_lru(INNER_LRU_HASH_PREALLOC, cpu); in test_inner_lru_hash_prealloc()
216 static void test_lru_hash_lookup(int cpu) in test_lru_hash_lookup() argument
218 do_test_lru(LRU_HASH_LOOKUP, cpu); in test_lru_hash_lookup()
221 static void test_percpu_hash_prealloc(int cpu) in test_percpu_hash_prealloc() argument
229 printf("%d:percpu_hash_map_perf pre-alloc %lld events per sec\n", in test_percpu_hash_prealloc()
230 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_percpu_hash_prealloc()
233 static void test_hash_kmalloc(int cpu) in test_hash_kmalloc() argument
241 printf("%d:hash_map_perf kmalloc %lld events per sec\n", in test_hash_kmalloc()
242 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_hash_kmalloc()
245 static void test_percpu_hash_kmalloc(int cpu) in test_percpu_hash_kmalloc() argument
253 printf("%d:percpu_hash_map_perf kmalloc %lld events per sec\n", in test_percpu_hash_kmalloc()
254 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_percpu_hash_kmalloc()
257 static void test_lpm_kmalloc(int cpu) in test_lpm_kmalloc() argument
265 printf("%d:lpm_perf kmalloc %lld events per sec\n", in test_lpm_kmalloc()
266 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_lpm_kmalloc()
269 static void test_hash_lookup(int cpu) in test_hash_lookup() argument
277 printf("%d:hash_lookup %lld lookups per sec\n", in test_hash_lookup()
278 cpu, max_cnt * 1000000000ll * 64 / (time_get_ns() - start_time)); in test_hash_lookup()
281 static void test_array_lookup(int cpu) in test_array_lookup() argument
289 printf("%d:array_lookup %lld lookups per sec\n", in test_array_lookup()
290 cpu, max_cnt * 1000000000ll * 64 / (time_get_ns() - start_time)); in test_array_lookup()
298 typedef void (*test_func)(int cpu);
329 static void loop(int cpu) in loop() argument
335 CPU_SET(cpu, &cpuset); in loop()
340 test_funcs[i](cpu); in loop()
356 } else if (pid[i] == -1) { in run_perf_test()
377 key->prefixlen = 32; in fill_lpm_trie()
380 key->prefixlen = rand() % 33; in fill_lpm_trie()
381 key->data[0] = rand() & 0xff; in fill_lpm_trie()
382 key->data[1] = rand() & 0xff; in fill_lpm_trie()
383 key->data[2] = rand() & 0xff; in fill_lpm_trie()
384 key->data[3] = rand() & 0xff; in fill_lpm_trie()
390 key->prefixlen = 32; in fill_lpm_trie()
391 key->data[0] = 192; in fill_lpm_trie()
392 key->data[1] = 168; in fill_lpm_trie()
393 key->data[2] = 0; in fill_lpm_trie()
394 key->data[3] = 1; in fill_lpm_trie()
496 for (i--; i >= 0; i--) in main()