Skip to content

Commit 83ac64b

Browse files
committed
docs: enhance README and Makefile for clarity and functionality
- Improved descriptions of key features in the README, emphasizing type safety, symbol resolution, error handling, logging, and command-line interface. - Updated the Makefile to include a specific RUSTFLAGS setting for building the blazesym library, enhancing build safety and control.
1 parent 30d7601 commit 83ac64b

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/12-profile/README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,19 +404,15 @@ impl EventHandler {
404404

405405
**Key Features of the Rust Implementation:**
406406

407-
1. **Type Safety**: The Rust implementation provides strong type safety through the type system, preventing memory safety issues common in C.
407+
The Rust implementation provides strong type safety through its type system, effectively preventing memory safety issues that are common in C, such as buffer overflows and null pointer dereferences. This safety guarantee allows developers to focus on business logic without worrying about low-level memory management issues.
408408

409-
2. **Blazesym Integration**: Uses blazesym-rs for efficient symbol resolution with support for DWARF debug information, providing detailed source file and line number information.
409+
Symbol resolution is a core feature of performance analysis tools. This implementation integrates the blazesym library, which efficiently converts memory addresses into readable function names and source code locations. Blazesym supports DWARF debug information parsing, meaning that even optimized binaries can provide accurate source file paths and line number information. This capability is crucial for pinpointing the exact code locations of performance bottlenecks.
410410

411-
3. **Error Handling**: Comprehensive error handling using Rust's `Result` type, ensuring robust operation.
411+
For error handling, Rust's `Result` type provides an explicit error handling mechanism. Every operation that might fail returns a Result type, forcing developers to handle potential error conditions. This design prevents unhandled errors from causing program crashes, improving the tool's stability and reliability.
412412

413-
4. **Structured Logging**: Integration with the `tracing` crate for structured logging with configurable verbosity levels.
413+
The logging system uses the `tracing` crate, which provides structured logging capabilities. Through environment variables or command-line arguments, users can dynamically adjust the log level from WARN, INFO, DEBUG to TRACE, making it convenient to obtain appropriate levels of diagnostic information in different scenarios. This flexibility is very useful for debugging and troubleshooting.
414414

415-
5. **Command-line Interface**: Uses `clap` for a user-friendly CLI with options for:
416-
- Adjustable sampling frequency (`-f`)
417-
- Software vs hardware perf events (`--sw-event`)
418-
- PID filtering (`-p`)
419-
- Extended output format (`-E`)
415+
The command-line interface is implemented through the `clap` library, providing intuitive argument parsing and help message generation. Users can adjust the sampling frequency with the `-f` parameter, switch to software events using `--sw-event` in environments like virtual machines that don't support hardware performance counters, filter specific processes with the `-p` parameter, and output in an extended format suitable for flame graph generation using the `-E` parameter.
420416

421417
This integrated approach combines the performance of eBPF with the safety and expressiveness of Rust, providing a robust profiling tool for system performance analysis.
422418

src/16-memleak/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ $(BPFTOOL): | $(BPFTOOL_OUTPUT)
9595

9696

9797
$(LIBBLAZESYM_SRC)/target/release/libblazesym.a::
98-
$(Q)cd $(LIBBLAZESYM_SRC) && $(CARGO) build --features=cheader,dont-generate-test-files --release
98+
$(Q)cd $(LIBBLAZESYM_SRC) && RUSTFLAGS="-A dangerous_implicit_autorefs" $(CARGO) build --features=cheader,dont-generate-test-files --release
9999

100100
$(LIBBLAZESYM_OBJ): $(LIBBLAZESYM_SRC)/target/release/libblazesym.a | $(OUTPUT)
101101
$(call msg,LIB, $@)

0 commit comments

Comments
 (0)