Skip to content
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

Add ability to trace runtime events in chromium json format #4649

Merged
merged 11 commits into from
Mar 12, 2025

Conversation

dipinhora
Copy link
Contributor

Runtime tracing is helpful in understanding how the runtime works and for debugging issues with the runtime.

The implementation hopefully is flexible and extensible in order to be able to add more events for tracing as needed.

The tracing can either write to file in the background or work in a "flight recorder" mode where events are stored into in memory circular buffers and written to stderr in case of abnormal program behavior (SIGILL, SIGSEGV, SIGBUS, etc).

Chromium json format is documented at:

https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview?tab=t.0

and trace files can be viewed with the perfetto trace viewer:

https://perfetto.dev/

inspired by golang's tracing and verona's flight recorder.

Runtime tracing is helpful in understanding how the runtime
works and for debugging issues with the runtime.

The implementation hopefully is flexible and extensible in order
to be able to add more events for tracing as needed.

The tracing can either write to file in the background or work in
a "flight recorder" mode where events are stored into in memory
circular buffers and written to stderr in case of abnormal program
behavior (SIGILL, SIGSEGV, SIGBUS, etc).

Chromium json format is documented at:

https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview?tab=t.0

and trace files can be viewed with the perfetto trace viewer:

https://perfetto.dev/

inspired by golang's tracing and verona's flight recorder.
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Mar 5, 2025
@SeanTAllen SeanTAllen added the changelog - added Automatically add "Added" CHANGELOG entry on merge label Mar 5, 2025
@ponylang-main
Copy link
Contributor

Hi @dipinhora,

The changelog - added label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do.

Release notes are added by creating a uniquely named file in the .release-notes directory. We suggest you call the file 4649.md to match the number of this pull request.

The basic format of the release notes (using markdown) should be:

## Title

End user description of changes, why it's important,
problems it solves etc.

If a breaking change, make sure to include 1 or more
examples what code would look like prior to this change
and how to update it to work after this change.

Thanks.

@SeanTAllen
Copy link
Member

A think a section on the website's "use" section would be appropriate for this. I'd like to see that added "as part of" this work.

https://www.ponylang.io/use/

@@ -227,10 +227,11 @@ uint32_t ponyint_cpu_count()
}

uint32_t ponyint_cpu_assign(uint32_t count, scheduler_t* scheduler,
bool pin, bool pinasio, bool pinpat)
bool pin, bool pinasio, bool pinpat, uint32_t* tracing_cpu, bool pin_tracing_thread)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on reversing the boolean and the u32 here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than this small thing, i think this looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no thoughts.. want them switched?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird.. i didn't see:

other than this small thing, i think this looks good.

previously when i added my comment..

will push a change with the order switched as requested soonish..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jemc
Copy link
Member

jemc commented Mar 11, 2025

We discussed on today's sync call. Looks good to me, pending the above comment from Sean about parameter order.

@SeanTAllen
Copy link
Member

@dipinhora would you be up for adding documentation to the use section of the website after this is merged?

@dipinhora
Copy link
Contributor Author

@dipinhora would you be up for adding documentation to the use section of the website after this is merged?

i can take a stab at it.. do you envision the documentation being within https://www.ponylang.io/use/debugging/ or directly in https://www.ponylang.io/use/?

@SeanTAllen
Copy link
Member

@dipinhora would you be up for adding documentation to the use section of the website after this is merged?

i can take a stab at it.. do you envision the documentation being within https://www.ponylang.io/use/debugging/ or directly in https://www.ponylang.io/use/?

I think under debugging.

@SeanTAllen SeanTAllen merged commit 7a01c4d into ponylang:main Mar 12, 2025
24 checks passed
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Mar 12, 2025
github-actions bot pushed a commit that referenced this pull request Mar 12, 2025
github-actions bot pushed a commit that referenced this pull request Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - added Automatically add "Added" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants