Skip to content

Conversation

@yunwei37
Copy link
Member

@yunwei37 yunwei37 commented Oct 1, 2025

This pull request introduces significant improvements to the memleak eBPF memory leak detection tool and adds a new test program for leak verification. The main changes include upgrading to the new blazesym v0.2.0 C API for symbol resolution, refactoring the symbolization logic in memleak.c, and providing documentation and infrastructure for testing memory leak detection. Additionally, similar build and test infrastructure changes are introduced in the wallclock profiler directory.

Memleak improvements and test infrastructure:

  • Upgraded to the new blazesym v0.2.0 C API for symbol resolution, replacing the old API and types throughout memleak.c and updating the build process to use the new capi package. This results in improved performance and more accurate symbolization. [1] [2] [3] [4] [5] [6] [7] [8]
  • Refactored the stack trace symbolization logic in memleak.c to use the new blazesym API, with dynamic selection of symbolization source (kernel or process) and improved handling of inlined functions. [1] [2]
  • Added a new test program test_memleak.c that intentionally leaks memory for verification purposes, along with Makefile updates and .gitignore entries to support building and cleaning test binaries. [1] [2] [3] [4] [5]
  • Updated documentation (README.md and README.zh.md) to explain the new symbolization library, describe the test program, and provide example output demonstrating successful leak detection. [1] [2]

Wallclock profiler build/test infrastructure:

  • Added new build and test infrastructure for the wallclock profiler, including a comprehensive Makefile, .gitignore, and configuration file to support building main and test programs, and cleaning up artifacts. [1] [2] [3]

These changes modernize the symbolization workflow, make leak detection more robust, and provide a simple way to verify correctness with a dedicated test program.

- Implemented a new profiling tool that captures both on-CPU and off-CPU activity for a specified process.
- The script runs 'oncputime' and 'offcputime' tools simultaneously and combines their results into a unified flamegraph.
- Added functionality to discover threads and profile them individually if the application is multi-threaded.
- Included error handling for tool execution and output processing.
- Created methods for generating flamegraph data and SVG visualizations.
- Added command-line argument parsing for user-defined profiling parameters.
- Implemented detailed analysis reports for both individual threads and overall profiling results.
@yunwei37 yunwei37 requested a review from Copilot October 1, 2025 03:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces significant improvements to the memleak eBPF memory leak detection tool and adds a new comprehensive wallclock profiler directory with combined on-CPU and off-CPU analysis capabilities. The main changes include upgrading to blazesym v0.2.0 for improved symbol resolution and creating a complete performance profiling solution.

Key changes:

  • Upgrade memleak to use the new blazesym v0.2.0 C API for better performance and accuracy
  • Add comprehensive wallclock profiler with oncputime and offcputime tools
  • Create test infrastructure and example programs for both tools

Reviewed Changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 6 comments.

File Description
src/third_party/blazesym Updated blazesym submodule to newer version for v0.2.0 API
src/32-wallclock-profiler/ New complete wallclock profiler implementation with on-CPU and off-CPU analysis
src/16-memleak/ Updated memleak implementation to use new blazesym v0.2.0 C API
.github/workflows/test-libbpf.yml Added CI testing for the new wallclock profiler
Comments suppressed due to low confidence (3)

src/32-wallclock-profiler/wallclock_profiler.py:1

  • [nitpick] The docstring title doesn't match the actual filename. Should be 'Wall Clock Profiler' to match the filename 'wallclock_profiler.py'.
#!/usr/bin/env python3

src/32-wallclock-profiler/wallclock_profiler.py:1

  • Commented out nanosleep code should be removed as it's not being used and clutters the codebase.
#!/usr/bin/env python3

src/32-wallclock-profiler/wallclock_profiler.py:1

  • More commented out nanosleep code that should be removed.
#!/usr/bin/env python3

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@yunwei37 yunwei37 merged commit 7045170 into main Oct 1, 2025
4 of 5 checks passed
@yunwei37 yunwei37 deleted the rapl-energy-monitor branch October 1, 2025 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants