diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-02 12:26:41 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-02 12:26:41 +0200 |
commit | 68548a3823e85461c69ffd85d3322335b3d6fad9 (patch) | |
tree | a24c0e94e7b7e7481b0036b58c16c9767c4ed15a | |
parent | 8a0beef6c0312f2a0d83a69d747c39549826d588 (diff) |
MPack, NanoPB: Adjust writer_destroy / pb_decode calls for wrapper support
-rwxr-xr-x | lib/protocol_benchmarks.py | 12 |
1 files 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): |