commit | f63951d5e1b0975ddd40b679a2bf5c64e7d0431e | [log] [tgz] |
---|---|---|
author | Daniele Di Proietto <ddiproietto@google.com> | Mon Oct 07 13:59:50 2024 +0000 |
committer | Daniele Di Proietto <ddiproietto@google.com> | Mon Oct 07 14:12:51 2024 +0000 |
tree | 613c82d2768904058227ce2c61cbe66a0a323691 | |
parent | 3d3de5af2d068c6a331f4984a0d0d6a67fe91d2c [diff] |
tracing_service_impl_unittest: Avoid internals in ScrapeOnDisconnect This test is trying to simulate what happens with a remote producer when it disconnects. The test however uses an in-process producer. An in-process producer behaves quite differently (compared to a remote producer). The shared memory arbiter (and the shared memory itself) is owned by the producer endpoint. There's no way of disconnecting an in-process producer without destroying its shared memory arbiter. But we cannot destroy the shared memory arbiter, because the trace writer holds references to it. We cannot destroy the trace writer, because it would flush, and scraping will not be exercised. This commit makes the test more realisting by using a "remote" producer: * Producer `in_process` can be set to false. * TestRefSharedMemory is a new type of shared memory that can be used to simulate two components having access to the same shared memory in tests. * In order to simulate a disconnection, a ProxyProducerEndpoint can be configured to forward all the requests to a real proxy or to drop them, after disconnecting. The test can now own the shared memory arbiter. TracingServiceImpl will behave as it does with a remote producer and scrape its memory. + The production code doesn't contain test only code. - There's a lot more test-only code required. + The test is more realistic. Change-Id: I61121c6623f912c167876602e93ead39cd087c52
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.