test/ring: replace sync with atomic builtins
authorPhil Yang <phil.yang@arm.com>
Mon, 8 Apr 2019 03:02:31 +0000 (11:02 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 8 Jul 2019 14:35:55 +0000 (16:35 +0200)
commite4eb7b068e9e5ad144be735fa44c86c6a19e3320
treebb956d4b5bd4cc122a13380b50605a99cd625869
parentbb79646a47643c8802788ae2e9e99d81c1f9fcc0
test/ring: 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 -c 0x7fffffe \
-n 4 --socket-mem=1024,0 --file-prefix=~ -- -i
RTE>>ring_perf_autotest

*** ring_perf_autotest without this patch ***
SP/SC bulk enq/dequeue (size: 8): 6.22
MP/MC bulk enq/dequeue (size: 8): 11.50
SP/SC bulk enq/dequeue (size: 32): 1.85
MP/MC bulk enq/dequeue (size: 32): 2.66

*** ring_perf_autotest with this patch ***
SP/SC bulk enq/dequeue (size: 8): 6.13
MP/MC bulk enq/dequeue (size: 8): 9.83
SP/SC bulk enq/dequeue (size: 32): 1.96
MP/MC bulk enq/dequeue (size: 32): 2.30

So for the ring performance test, this patch improved 11% of ring
operations performance.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
app/test/test_ring_perf.c