-
Notifications
You must be signed in to change notification settings - Fork 52
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
Support chrome tracing in ppe.profiler #742
Conversation
ab0d1d3
to
fc4fa2d
Compare
06577ac
to
9bc45cf
Compare
trace.json.zip |
Discussed offline
|
Added me to assignee as I'd like to join the design discussion :) |
I changed the code to allow users to create their own tracers for timelines (not to rely only on google tracing format) and to allow users to supply a |
abee977
to
9834492
Compare
ab1616e
to
3483e08
Compare
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!
Thank you for the work. I'm testing this patch in advance for pfnet/pfio#326. According to @emcastillo 's advice, I added some line to the MNIST example, but I'm getting empty trace.json for now. Do you have any insight to get the trace?
|
IMO, to integrate well with PFIO regarding pfnet/pfio#326, it would be nicer to pass the |
class Tracer: | ||
@contextlib.contextmanager | ||
def add_event(self, name: str) -> Generator[None, None, None]: | ||
raise NotImplementedError("Tracers must implement add_event") | ||
|
||
def add_remote_event(self, name: str, value: Any) -> None: | ||
raise NotImplementedError("Tracers must implement add_remote_event") | ||
|
||
def clear(self) -> None: | ||
raise NotImplementedError("Tracers must implement clear") | ||
|
||
def flush(self, filename: str, writer: Writer) -> None: | ||
raise NotImplementedError("Tracers must implement flush") | ||
|
||
def enable(self, enable_flag: bool) -> None: | ||
raise NotImplementedError("Tracers must implement enable") |
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.
The Tracer class should have a finalize()
or synchronize()
interface. In particular, if the QueueWorker is not synchronized, the possibility arises that the program will terminate before all profiles are output.
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.
Added a finalize method, also enforced synchronization in flush
method. Good catch!!!
# TODO(ecastill): try to work on some append mode manipulating the | ||
# file pointer and with json.dumps? |
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.
comment:
I couldn't find any document, but it's worth checking to see if it supports the jsonl format.
The jsonl format is append friendly.
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.
chrome does not support jsonl format for displaying the trace :(
Thanks for the great review, PTAL! |
818f8c3
to
3fc39b4
Compare
/test |
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
Tracer class by @okdshin
The user should be the one in charge of enabling chrome for the records they want? I mean, passing a Emitter object instead of a boolean flag and avoiding to store in the object in TLS