From 68548a3823e85461c69ffd85d3322335b3d6fad9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 2 Apr 2019 12:26:41 +0200 Subject: MPack, NanoPB: Adjust writer_destroy / pb_decode calls for wrapper support --- lib/protocol_benchmarks.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/protocol_benchmarks.py b/lib/protocol_benchmarks.py index b7af4f7..133e4b5 100755 --- a/lib/protocol_benchmarks.py +++ b/lib/protocol_benchmarks.py @@ -657,9 +657,11 @@ class MPack(DummyProtocol): def get_serialize(self): ret = 'serialized_size = mpack_writer_buffer_used(&writer);\n' - ret += 'if (mpack_writer_destroy(&writer) != mpack_ok) {\n' + # OptionalTimingAnalysis and other wrappers only wrap lines ending with a ; + # We therefore deliberately do not use proper if { ... } syntax here + # to make sure that these two statements are timed as well. + ret += 'if (mpack_writer_destroy(&writer) != mpack_ok) ' ret += 'kout << "Encoding failed" << endl;\n' - ret += '}\n' return ret def get_deserialize(self): @@ -797,9 +799,11 @@ class NanoPB(DummyProtocol): def get_deserialize(self): ret = 'Benchmark msg = Benchmark_init_zero;\n' ret += 'pb_istream_t stream = pb_istream_from_buffer(buf, serialized_size);\n' - ret += 'if (pb_decode(&stream, Benchmark_fields, &msg) == false) {\n' + # OptionalTimingAnalysis and other wrappers only wrap lines ending with a ; + # We therefore deliberately do not use proper if { ... } syntax here + # to make sure that these two statements are timed as well. + ret += 'if (pb_decode(&stream, Benchmark_fields, &msg) == false) ' ret += 'kout << "deserialized failed" << endl;\n' - ret += '}\n' return ret def get_decode_and_output(self): -- cgit v1.2.3