MCPcopy Create free account
hub / github.com/apache/qpid-proton / BM_EncodeListMessage

Function BM_EncodeListMessage

c/benchmarks/message-encoding_list.cpp:63–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63static void BM_EncodeListMessage(benchmark::State &state) {
64 if (VERBOSE)
65 printf("BEGIN BM_EncodeListMessage\n");
66
67 uint64_t entries = 0;
68
69 pn_message_t *message = pn_message();
70 for (auto _ : state) {
71 pn_message_clear(message);
72 pn_data_t *body;
73 body = pn_message_body(message);
74 pn_data_put_list(body);
75 pn_data_enter(body);
76 for (size_t i = 0; i < state.range(0); i += 2) {
77 pn_data_put_string(
78 body, pn_bytes(sizeof("some list value") - 1, "some list value"));
79 pn_data_put_int(body, 42);
80 entries += 2;
81 }
82 pn_data_exit(body);
83 pn_rwbytes_t buf{};
84 if (pn_message_encode2(message, &buf) == 0) {
85 state.SkipWithError(pn_error_text(pn_message_error(message)));
86 }
87 if (buf.start)
88 free(buf.start);
89 }
90 pn_message_free(message);
91
92 state.SetLabel("entries");
93 state.SetItemsProcessed(entries);
94
95 if (VERBOSE)
96 printf("END BM_EncodeListMessage\n");
97}
98
99BENCHMARK(BM_EncodeListMessage)
100 ->Arg(10)

Callers

nothing calls this directly

Calls 13

pn_messageFunction · 0.85
pn_message_clearFunction · 0.85
pn_message_bodyFunction · 0.85
pn_data_put_listFunction · 0.85
pn_data_enterFunction · 0.85
pn_data_put_intFunction · 0.85
pn_data_exitFunction · 0.85
pn_message_encode2Function · 0.85
pn_message_errorFunction · 0.85
pn_message_freeFunction · 0.85
pn_data_put_stringFunction · 0.50
pn_bytesFunction · 0.50

Tested by

no test coverage detected