-
Notifications
You must be signed in to change notification settings - Fork 10
perf: adapt to new perf subsystem #238
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
base: master
Are you sure you want to change the base?
Conversation
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.
Hello @adamgreloch, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
Hello! I'm Gemini, your friendly code-assist bot. I've analyzed this pull request to give you a quick summary.
This pull request adapts the perf command-line utility within the psh shell to work with a new kernel syscall interface for performance monitoring. The primary change involves modifying the perf command to accept a 'mode' argument (currently supporting 'threads' and 'trace') as the first parameter, shifting the optional timeout argument to the second position. The underlying syscalls (perf_start, perf_read, perf_finish) are updated to accept this new mode parameter, reflecting changes in how the kernel's performance monitoring is accessed and controlled. The type of the buffer used to read performance data has also been updated, suggesting a change in the data format provided by the new syscall interface.
Highlights
- Adaptation to New Syscall Interface: The core purpose of this PR is to update the
pshperftool to utilize a new kernel syscall interface for performance monitoring. - Introduction of Perf Modes: The
perfcommand now supports different operational modes, specified as the first argument. Currently, 'threads' and 'trace' modes are introduced. - Command Line Argument Changes: The command syntax for
perfhas changed. It now expects the mode as the first argument, followed by the optional timeout as the second argument. - Updated Syscall Usage: Calls to
perf_start,perf_read, andperf_finishhave been modified to include the newly introduced mode parameter. - Performance Data Buffer Type Change: The type of the buffer used to read performance data from the kernel has been changed from
perf_event_t *touint32_t *, indicating a potential change in the data structure or format returned by the new syscalls.
Changelog
- psh/perf/perf.c
- Updated copyright year to 2025 and added the author to the list.
- Added necessary includes for
<string.h>and<sys/perf.h>. - Introduced a
perfHelpfunction to display usage information. - Modified the
psh_perffunction to parse a mode argument ('threads' or 'trace') and validate it. - Shifted the timeout argument parsing to the second command-line argument.
- Changed the type of the buffer used for reading performance data from
perf_event_t *touint32_t *. - Updated calls to
perf_start,perf_read, andperf_finishto pass the selected mode. - Updated informational and error messages to include the active mode.
- Applied minor formatting fix in the
perf_registerappfunction.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Syscall changes come,
Perf tool adapts its old ways,
New modes start to trace.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request adapts the perf utility to a new syscall interface, allowing it to operate in different modes (threads or trace) and handle a timeout argument. The changes involve updating includes, adding a help function, modifying argument parsing, and updating calls to the perf_start, perf_read, and perf_finish functions to include the new mode parameter. The error messages have also been improved to include the selected mode.
The overall structure of the changes seems appropriate for integrating the new syscall interface. The addition of the perfHelp function and improved error messages are good improvements for usability.
Summary of Findings
- Buffer type change: The buffer type for reading performance data was changed from
perf_event_t *touint32_t *. Clarification is needed on the new data format returned byperf_readto ensure correctness and maintainability. (Medium severity - commented) - Copyright and Author Update: The copyright year and author list were updated. (Low severity - not commented per settings)
- Code Formatting: Minor formatting changes were made in the
perf_registerappfunction initialization. (Low severity - not commented per settings)
Merge Readiness
This pull request introduces necessary changes to adapt the perf utility to the new syscall interface. There is one medium severity issue identified regarding the buffer type change and the expected data format from the new perf_read syscall. This needs clarification to ensure the code is correct and maintainable.
Therefore, I recommend addressing the medium severity issue before merging. I am unable to approve the pull request directly; please have other reviewers review and approve this code before merging.
ec8069c to
bcf637a
Compare
492befd to
e0f8da7
Compare
3b814bb to
f49a59a
Compare
f43a055 to
e88ddb8
Compare
9f265cc to
3e722f6
Compare
9c24689 to
e06d000
Compare
JIRA: RTOS-1057
e06d000 to
fff4d87
Compare
JIRA: RTOS-1057
Description
Motivation and Context
Types of changes
How Has This Been Tested?
Checklist:
Special treatment
libtrace: introduce trace helper library phoenix-rtos-corelibs#58