PTAL - any and all feedback is welcome!
I found that I had to finalize the previous packet and create a new one in order to add interned data to the trace packet, but I'm open to suggestions if there's a better way.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
void EtwConsumer::HandleStackWalkEvent(const EVENT_HEADER& header,naisu
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Nice!
InterningIndex<TypeList<uintptr_t>, SizeList<1024>> interned_frames_;See my comment re. pointer_size below. This would need to be uint64_t to work in all cases.
InterningIndex<TypeList<size_t>, SizeList<1024>> interned_callstacks_;Interned data needs to reset on EtwSystemDataSource::WillClearIncrementalState, so it gets emitted again.
// Read and validate the contents of `packet_data`.
base::BufferIterator<const uint8_t> iterator{packet_data};
auto qpc_timestamp = *iterator.CopyObject<uint64_t>();
auto process_id = *iterator.CopyObject<uint32_t>();
auto thread_id = *iterator.CopyObject<uint32_t>();This is missing the typical bound check:
```
if (packet_data.size() < kMinimumSize) {
return false;
}
```
base::span<const uintptr_t> call_stack =
iterator.Span<const uintptr_t>(remaining_bytes / pointer_size);I think this incorrectly assumes "Stack" members are uintptr_t, but they are documented as pointer_size.
To correctly handle this while keeping the zero copy impl, you could do a template <class T> HandleStackWalkEventImpl() and then
```
if (pointer_size == sizeof(uint32_t)) {
HandleStackWalkEventImpl<uint32_t>(...);
) else {
HandleStackWalkEventImpl<uint64_t>(...);
}
```
packet_handle_ = trace_writer_->NewTracePacket();I think we need to unconditionally set SEQ_NEEDS_INCREMENTAL_STATE, since the packet may be reused for stackwalk after interned data was emitted in a previous packet.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Thanks so much for the thoughtful review!
I had to do some BUILD.gn changes to work around a circular dependency with using `InterningIndex`, so the latest patchset also includes those.
InterningIndex<TypeList<uintptr_t>, SizeList<1024>> interned_frames_;See my comment re. pointer_size below. This would need to be uint64_t to work in all cases.
Done - changed to uint64_t
InterningIndex<TypeList<size_t>, SizeList<1024>> interned_callstacks_;Interned data needs to reset on EtwSystemDataSource::WillClearIncrementalState, so it gets emitted again.
Done
void EtwConsumer::HandleStackWalkEvent(const EVENT_HEADER& header,Jesse McKennanaisu
Thanks!
// Read and validate the contents of `packet_data`.
base::BufferIterator<const uint8_t> iterator{packet_data};
auto qpc_timestamp = *iterator.CopyObject<uint64_t>();
auto process_id = *iterator.CopyObject<uint32_t>();
auto thread_id = *iterator.CopyObject<uint32_t>();This is missing the typical bound check:
```
if (packet_data.size() < kMinimumSize) {
return false;
}
```
Oops, done
base::span<const uintptr_t> call_stack =
iterator.Span<const uintptr_t>(remaining_bytes / pointer_size);I think this incorrectly assumes "Stack" members are uintptr_t, but they are documented as pointer_size.
To correctly handle this while keeping the zero copy impl, you could do a template <class T> HandleStackWalkEventImpl() and then```
if (pointer_size == sizeof(uint32_t)) {
HandleStackWalkEventImpl<uint32_t>(...);
) else {
HandleStackWalkEventImpl<uint64_t>(...);
}
```
Thanks for pointing this out! For the sake of simplicity I opted to use `CopyPointer` rather than templating, but feel free to let me know if you disagree.
packet_handle_ = trace_writer_->NewTracePacket();I think we need to unconditionally set SEQ_NEEDS_INCREMENTAL_STATE, since the packet may be reused for stackwalk after interned data was emitted in a previous packet.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
(void)*iterator.CopyObject<uint32_t>(); // StackThreadWe should write this to EtwTraceEvent::thread_id?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm, but i haven't done as thorough of a review as eti
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
(void)*iterator.CopyObject<uint32_t>(); // StackThreadWe should write this to EtwTraceEvent::thread_id?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
9 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: components/tracing/common/etw_consumer_win.h
Insertions: 9, Deletions: 0.
The diff is too large to show. Please review the diff.
```
```
The name of the file: components/tracing/common/etw_consumer_win.cc
Insertions: 61, Deletions: 7.
The diff is too large to show. Please review the diff.
```
etw-stackwalk: add simple stack walk events
This change adds support for StackWalk Event Tracing for Windows (ETW)
events to Chrome's ETW consumer.
StackWalk events are not yet enabled, so this CL will not yet change
Chrome tracing's behavior. This is the first part of a sequence of CLs
to enable StackWalk events.
This is based on spvm@'s original prototype at
https://chromium-review.git.corp.google.com/c/chromium/src/+/7598112
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |