In sysbench version 0.4, the tmp variable used by the memory test to execute requests is optimized by the compiler. Caching mechanism reduces the direct accesses to the memory increasing the transfer speed. This leads to false timing estimations that considerably affect read and also random write operations.
In sysbench version 1, this issue is fixed adding the volatile modifier to the tmp variable. This prevents compiler optimizations forcing a direct access to the memory. The final result is a realistic transfer speed measurement. Upstream-Status: Backport [https://github.com/akopytov/sysbench/commit/8753cb93be4c0b81a20b704ced91e7a422da52b1] Signed-off-by: massimo toscanelli <massimo.toscane...@leica-geosystems.com> --- ...modifier-to-tmp-variable-in-memory-t.patch | 38 +++++++++++++++++++ .../sysbench/sysbench_0.4.12.bb | 4 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-benchmark/sysbench/files/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch diff --git a/meta-oe/recipes-benchmark/sysbench/files/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch b/meta-oe/recipes-benchmark/sysbench/files/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch new file mode 100644 index 000000000..f10b7148c --- /dev/null +++ b/meta-oe/recipes-benchmark/sysbench/files/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch @@ -0,0 +1,38 @@ +From 490043d3a8ea2554301cbf4ec9bebfcdbc525b11 Mon Sep 17 00:00:00 2001 +From: Vasily Tarasov <tara...@vasily.name> +Date: Fri, 10 Jun 2016 14:33:48 -0400 +Subject: [PATCH] Adding volatile modifier to tmp variable in memory test + +Issue explanation: + +./sysbench/sysbench --test=memory --num-threads=16 \ + --memory-block-size=268435456 \ + --memory-total-size=137438953472 \ + --memory-oper=read \ + --memory-access-mode=seq \ + --memory-scope=local run + +Without this commit the time to run the above command is 0.0004 seconds. +With this commit the time is greater than 3 seconds. Essentially, +without the volatile modifier, the compiler optimizes read access so +that no real access happens. + +(cherry picked from commit 8753cb93be4c0b81a20b704ced91e7a422da52b1) +Signed-off-by: massimo toscanelli <massimo.toscane...@leica-geosystems.com> +--- + sysbench/tests/memory/sb_memory.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysbench/tests/memory/sb_memory.c b/sysbench/tests/memory/sb_memory.c +index 2e8998f..7d22bb9 100644 +--- a/sysbench/tests/memory/sb_memory.c ++++ b/sysbench/tests/memory/sb_memory.c +@@ -244,7 +244,7 @@ sb_request_t memory_get_request(int tid) + int memory_execute_request(sb_request_t *sb_req, int thread_id) + { + sb_mem_request_t *mem_req = &sb_req->u.mem_request; +- int tmp = 0; ++ volatile int tmp = 0; + int idx; + int *buf, *end; + log_msg_t msg; diff --git a/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb b/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb index 708c71f4f..cec4d38d0 100644 --- a/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb +++ b/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb @@ -8,7 +8,9 @@ inherit autotools # The project has moved from Sourceforge to Launchpad, to Github. Use the source tarball from # Launchpad until the next release is available from Github. -SRC_URI = "https://launchpad.net/ubuntu/+archive/primary/+files/${BPN}_${PV}.orig.tar.gz" +SRC_URI = "https://launchpad.net/ubuntu/+archive/primary/+files/${BPN}_${PV}.orig.tar.gz \ + file://0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch \ +" SRC_URI[md5sum] = "3a6d54fdd3fe002328e4458206392b9d" SRC_URI[sha256sum] = "83fa7464193e012c91254e595a89894d8e35b4a38324b52a5974777e3823ea9e" -- 2.17.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#153272): https://lists.openembedded.org/g/openembedded-core/message/153272 Mute This Topic: https://lists.openembedded.org/mt/83783733/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-