-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[onert] Modify ChromeTracingWriter to generate traceEvents only once #14633
Conversation
This commit ensures that `traceEvents` is generated only once and prevents the error of generating multiple `traceEvents` when using multiple nnfw sessions. ONE-DCO-1.0-Signed-off-by: youngsik kim <[email protected]>
|
||
void ChromeTracingWriter::flush(const std::vector<std::unique_ptr<EventRecorder>> &recorders) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using multiple sessions, the traceEvents
is created every time flush
is called, which may cause parsing errors in the Chrome Tracing JSON file.
to fix this issue, traceEvents
is added only when creating the ChromeTracingWriter
, not when flush
is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChromTracingWriter
is destructed when process is finished because ChromTracingWriter
is owned by EventWriter
, and EventWriter
is singleton object.
By this change, timing of file writing is changed from session closing to process exit.
IMHO, we need to decide more well-designed policy, including all event recorders, writers, and observers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your opinion.
It would be better to discuss how to handle multiple sessions in the future.
Thank you.
@@ -38,6 +38,8 @@ void EventWriter::readyToFlush(std::unique_ptr<EventRecorder> &&recorder) | |||
flush(WriteFormat::SNPE_BENCHMARK); | |||
flush(WriteFormat::CHROME_TRACING); | |||
flush(WriteFormat::MD_TABLE); | |||
|
|||
_recorders.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear the contents of the vector to prevent duplicate recorders
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
As discussed with @hseok-oh,
I think it would be better to append traceEvents to a single trace file (option.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, I'll approve this PR to resolve bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This commit ensures that
traceEvents
is generated only once and prevents the error of generating multipletraceEvents
when using multiple nnfw sessions.ONE-DCO-1.0-Signed-off-by: youngsik kim [email protected]