Skip to content

Commit

Permalink
Track event category is now handled
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhaowu committed Jul 30, 2023
1 parent d39f4a5 commit b24adb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions examples/tracing_example/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ class ExampleRTThread : public CyclicThread {

private:
void Sense() noexcept {
auto span = Tracer().WithSpan("Sense");
auto span = Tracer().WithSpan("Sense", "app");
WasteTime(std::chrono::microseconds(100));
}

void Plan() noexcept {
auto span = Tracer().WithSpan("Plan");
auto span = Tracer().WithSpan("Plan", "app");
WasteTime(std::chrono::microseconds(50));
}

void Act() noexcept {
auto span = Tracer().WithSpan("Act");
auto span = Tracer().WithSpan("Act", "app");
WasteTime(std::chrono::microseconds(75));
}
};
Expand Down
9 changes: 4 additions & 5 deletions src/cactus_rt/tracing/trace_aggregator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,10 @@ void TraceAggregator::AddTrackEventPacketToTrace(
track_event->set_name(track_event_internal.name);
}

// TODO: set category
// Trickier to do because this needs to allocate an array and stuff
// if (track_event.category != nullptr) {
// track_event_proto->set_categories(track_event.category);
// }
// TODO: support multiple categories later?
if (track_event_internal.category != nullptr) {
track_event->add_categories(track_event_internal.category);
}

packet->set_allocated_track_event(track_event);
packet->set_trusted_packet_sequence_id(thread_tracer.trusted_packet_sequence_id_);
Expand Down

0 comments on commit b24adb2

Please sign in to comment.