Skip to content

Commit

Permalink
Merge "[chrome] Support flow on chrome trigger" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Pierre-doray authored and Gerrit Code Review committed Nov 25, 2024
2 parents 8a08ca5 + 436d163 commit eee68aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions protos/perfetto/trace/chrome/chrome_trigger.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ message ChromeTrigger {
optional string trigger_name = 1;
// SHA1 hash of the trigger name.
optional fixed32 trigger_name_hash = 2;
// Flow id which should terminate on this trigger.
optional fixed64 flow_id = 3;
}
2 changes: 2 additions & 0 deletions protos/perfetto/trace/perfetto_trace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6352,6 +6352,8 @@ message ChromeTrigger {
optional string trigger_name = 1;
// SHA1 hash of the trigger name.
optional fixed32 trigger_name_hash = 2;
// Flow id which should terminate on this trigger.
optional fixed64 flow_id = 3;
}

// End of protos/perfetto/trace/chrome/chrome_trigger.proto
Expand Down
8 changes: 7 additions & 1 deletion src/trace_processor/importers/proto/metadata_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "perfetto/ext/base/base64.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/ext/base/uuid.h"
#include "src/trace_processor/importers/common/flow_tracker.h"
#include "src/trace_processor/importers/common/metadata_tracker.h"
#include "src/trace_processor/importers/common/slice_tracker.h"
#include "src/trace_processor/importers/common/track_tracker.h"
Expand Down Expand Up @@ -140,7 +141,7 @@ void MetadataModule::ParseChromeTrigger(int64_t ts, ConstBytes blob) {
name_id =
context_->storage->InternString(base::StringView("chrome_trigger"));
}
context_->slice_tracker->Scoped(
auto slice_id = context_->slice_tracker->Scoped(
ts, track_id, cat_id, name_id,
/* duration = */ 0, [&](ArgsTracker::BoundInserter* inserter) {
inserter->AddArg(
Expand All @@ -150,6 +151,11 @@ void MetadataModule::ParseChromeTrigger(int64_t ts, ConstBytes blob) {
inserter->AddArg(chrome_trigger_name_id_, Variadic::String(name_id));
}
});
if (slice_id && trigger.has_flow_id() &&
context_->flow_tracker->IsActive(trigger.flow_id())) {
context_->flow_tracker->End(*slice_id, trigger.flow_id(),
/* close_flow = */ true);
}

MetadataTracker* metadata = context_->metadata_tracker.get();
metadata->SetDynamicMetadata(
Expand Down

0 comments on commit eee68aa

Please sign in to comment.