commit | ba53cc7ea9e26e1553b9f54feb5de5420301fee8 | [log] [tgz] |
---|---|---|
author | Alexander Timin <altimin@chromium.org> | Fri Feb 05 15:46:57 2021 +0000 |
committer | Alexander Timin <altimin@chromium.org> | Fri Feb 05 15:46:57 2021 +0000 |
tree | 4f7c69c53936d650bb01239f66dfe1692188c9b8 | |
parent | 4e669c89cf41ef7cd55124aa67335c0b8f461f5f [diff] |
TracedValue: template-based resolution Add more complex rules for determining whether a class can be written into a trace. The following rules are checked in the given order: - If T::WriteIntoTracedValue(perfetto::TracedValue) exists, use it. (allows for simpler code in most of the cases, but does not work when you can't modify the class). - If perfetto::TraceFormatTraits<T>::WriteIntoTracedValue( perfetto::TracedValue, T) exists, use it. - If T has operator (), taking perfetto::TracedValue, invoke it (useful for lambdas) - If T is iterable and its nested type supports being written into a trace, iterate over the elements of T and write them into an array. (classes having std::begin(T) defined are considered to be iterables) This patch also adds the following helpers: - check_write_support<T>::{value,type} - defined when type T can be written in a trace. Useful for enabling support for a complex type only when a nested type also can be written into a trace. - has_write_support<T>::value - boolean, whether T can be written into a trace or not (useful when this value has to be or'ed or negated, in other cases check_write_support produces more helpful error messages with the entire chain of template deduction attempts). Some real-world examples (removing blink::TracedValue) can be found here: crrev.com/c/2484654 (Note: it is based on the earlier naming iteration, using OutputContext and ConvertToTraceFormat instead of TracedValue and WriteIntoTracedValue). R=primiano@google.com,eseckler@google.com,skyostil@google.com Change-Id: Ic5067fc904c2f78be8c285bdd4b5d6d897485751
Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.
See https://perfetto.dev/docs or the /docs/ directory for documentation.