test/distributor: replace sync with atomic builtins
authorPhil Yang <phil.yang@arm.com>
Mon, 8 Apr 2019 03:02:30 +0000 (11:02 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 8 Jul 2019 14:35:19 +0000 (16:35 +0200)
commitbb79646a47643c8802788ae2e9e99d81c1f9fcc0
treea8cad290854c43e86c8469846e87bacb2b2df4cf
parent016493307a632b71fae6685ed303c7e00df12569
test/distributor: replace sync with atomic builtins

'__sync' built-in functions are deprecated, should use the '__atomic'
built-in instead. the sync built-in functions are full barriers, while
atomic built-in functions offer less restrictive one-way barriers,
which help performance.

Here is the example test result on TX2:
sudo ./arm64-armv8a-linuxapp-gcc/app/test -l 112-139 \
-n 4 --socket-mem=1024,1024 -- -i
RTE>>distributor_perf_autotest

*** distributor_perf_autotest without this patch ***
==== Cache line switch test ===
Time for 33554432 iterations = 1519202730 ticks
Ticks per iteration = 45

*** distributor_perf_autotest with this patch ***
==== Cache line switch test ===
Time for 33554432 iterations = 1251715496 ticks
Ticks per iteration = 37

Less ticks needed for the cache line switch test. It got 17% of
performance improvement.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
app/test/test_distributor.c
app/test/test_distributor_perf.c