u_trace: remove redundant char* to string conversion (v2)
Add the string length parameter to the set_name(), set_value() function to remove the conversion from char* to std::string which takes extra work like calling strlen() to compute the string length. From the callback sampling in the perfetto tracing, the ratio of trace_payload_as_extra_intel_end_draw_indexed to intel_ds_end_draw_indexed drops from 63.80% to 59.65% with this change. v2: Add the data of the callback sampling to the description. Signed-off-by: Andy Hsu <hwandy@google.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38073>
This commit is contained in:
parent
93460e969e
commit
d226c0d97d
1 changed files with 3 additions and 3 deletions
|
|
@ -711,14 +711,14 @@ trace_payload_as_extra_${trace_name}(perfetto::protos::pbzero::GpuRenderStageEve
|
|||
% else:
|
||||
{
|
||||
auto data = event->add_extra_data();
|
||||
data->set_name("${arg.name}");
|
||||
data->set_name("${arg.name}", ${len(arg.name)});
|
||||
|
||||
% if arg.is_indirect:
|
||||
const ${arg.type}* __${arg.var} = (const ${arg.type}*)((uint8_t *)indirect_data + ${arg.indirect_offset});
|
||||
% endif
|
||||
sprintf(buf, "${arg.c_format}", ${arg.value_expr("payload")});
|
||||
const int slen = sprintf(buf, "${arg.c_format}", ${arg.value_expr("payload")});
|
||||
|
||||
data->set_value(buf);
|
||||
data->set_value(buf, slen);
|
||||
}
|
||||
% endif
|
||||
% endfor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue