History log of /external/perfetto/src/tracing/core/commit_data_request.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d52e627deeeeae323e65ee266d2bf0dcedee3c98 06-Apr-2018 Primiano Tucci <primiano@google.com> Add Flush support to Producer and expose API to Consumer

Background
----------
Before this CL, when tracing is disabled we might lose the last
trace packets produced near the end of the trace. This happens
because the service sees data in the SMB only when it's notified
by the producer via a CommitData() request. In turn, in the current
implementation, a Producer commits data only when the chunk is full.
Hence the last chunk for each data source will never been seen by
the service when disabling tracing. This causes partial data losses.

Changes
-------
This CL introduces a Flush() signaling mechanism as follows:
3) Introduces a flush request from the service to producers. Producers
are supposed to flush all their trace writers in response to that.
2) Introduces a flush request from the consumer to the service. This allows
the consumer to request all data to be committed at any time (not just
while disabling tracing). The flush request has also a callback
that is invoked by the service only after all producers have acked the
flush (so the consumer is guaranteed that the next ReadBuffers will contain
the result of the flush), or after a given timeout (so that the callback
doesn't hang forever).
3) Causes time-based traces (which are handled by the service) to
automatically flush before disabling tracing.

This CL does NOT fix the underlying problem in the ftrace reader
(see bug 73886018) where, because of the splice, we don't see the
latest trace event even on the producer side. Fixing this problem
requires the Flush() to abort the splice in ftrace's CpuReader and
commit the data (see TODO in SinkDelegate::Flush()).

Change-Id: Ifdec9f241b2ff98a7b4925b02fdd0beb16942e0e
Bug: 77684460
/external/perfetto/src/tracing/core/commit_data_request.cc
6aa7557b7146cb80b9f98e6fec2fc43bc805db55 21-Mar-2018 Primiano Tucci <primiano@google.com> Add host target for perfetto protos on Android host builds

This CL introduces a "perfetto_trace_protos" static_library
target that allows to link the perfetto protobuf code on
host executable builds.
This CL also disentangles some awkward dep between proto:lite
targets and the IPC proto targets, that was indirectly causing
the core tracing target to depend on ipc.
Also fixes a small breakage on mac by removing an unnecessary
include in trace_to_text.

Sample usage:

In the .bp file:
---
cc_binary_host {
name: "perfetto_proto_test",
static_libs: [
"perfetto_trace_protos",
"libprotobuf-cpp-lite",
],
srcs: [
"host_test.cc"
],
}
---

Where host_test.cc:
---
#include "perfetto/trace/trace.pb.h"

int main(int, char** argv) {
perfetto::protos::Trace trace;
return trace.ParseFromString(std::string(argv[1]));
}
---

Bug: 73611302
Change-Id: Ie371e82941890a3a7567c30261befd756147cc1c
Test: manual. Checked that builds on mac.
/external/perfetto/src/tracing/core/commit_data_request.cc
ecf9e4ae4b387a9ddd42bd8a689d7b5861a61d55 14-Mar-2018 Primiano Tucci <primiano@google.com> Use new TraceBuffer and send patches over IPC

This CL wires up the TraceBuffer introduced by
the previous CLs (the TraceBuffeZ -> R will happen
in a rename-only follow-up). Also plugs in the
logic that sends the patches over IPC when a
chunk is returned.

Bug: 73612642
Change-Id: Ib7bf80bb067d0b8dc721a9d797a1f5edf24cc4b0
/external/perfetto/src/tracing/core/commit_data_request.cc
79f3f91596fcd877cce99bf81fd306eb733f2265 02-Mar-2018 Primiano Tucci <primiano@google.com> NotifySharedMemoryUpdate -> CommitData

This CL replaces the NotifySharedMemoryUpdate with a new
CommitData method. The new fields in the CommitDataRequest are
not used yet and will be used in the upcoming CLs.
This CL doesn't introduce any behavioral change.
The only other change here is about getting rid of
the callback in SharedMemoryArbiter. There seems to
be no good reason for that, and just makes the code
harder to read.

Test: perfetto_unittest
Bug: 73612642
Change-Id: I12c9fd7133d1916e30eb31fc50014d64b1e35be0
/external/perfetto/src/tracing/core/commit_data_request.cc