Andrew Shulaev | 7623165 | 2020-03-04 15:05:18 | [diff] [blame^] | 1 | // Copyright 2020 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "services/tracing/public/cpp/perfetto/flow_event_utils.h" |
| 6 | |
| 7 | namespace tracing { |
| 8 | |
| 9 | // Fill the information about flow event in EventContext. |
| 10 | // |
| 11 | // BEWARE: this function currently sets the TrackEvent's LegacyEvent field, and |
| 12 | // thus should be used from within trace macros that do not set the LegacyEvent |
| 13 | // field themselves. As it is, it is fine to call this method from the typed |
| 14 | // TRACE_EVENT macro. |
| 15 | // |
| 16 | // TODO(b/TODO): Change to the new model flow events when finalized |
| 17 | void FillFlowEvent( |
| 18 | const perfetto::EventContext& ctx, |
| 19 | perfetto::protos::pbzero::TrackEvent_LegacyEvent_FlowDirection direction, |
| 20 | uint64_t bind_id) { |
| 21 | perfetto::protos::pbzero::TrackEvent_LegacyEvent* legacy_event = |
| 22 | ctx.event()->set_legacy_event(); |
| 23 | legacy_event->set_flow_direction(direction); |
| 24 | legacy_event->set_bind_id(bind_id); |
| 25 | } |
| 26 | |
| 27 | } // namespace tracing |