summaryrefslogtreecommitdiff
path: root/benchmarks/profile_runner.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-26 22:40:27 +0300
committerPaul Buetow <paul@buetow.org>2025-06-26 22:40:27 +0300
commitafba86489b00a2f5ac4d39b2853c2c51c2931536 (patch)
tree934ab9c6805dbc17bf71cd4b30f827c10a58a192 /benchmarks/profile_runner.go
parent91e4743ce5ddab8f6359009bb45e243d4726bcdb (diff)
Remove bash scripts and update documentation to use dtail-tools
Following the successful refactoring to Go-based tooling, this commit: 1. Removes all obsolete bash scripts: - benchmarks/benchmark.sh - profiling/profile.sh - profiling/profile_benchmarks.sh - profiling/profile_dmap.sh - profiling/profile_quick.sh 2. Updates all documentation to use dtail-tools: - README.md: Updated benchmark commands to use dtail-tools - PROFILING.md: Updated profiling instructions to use dtail-tools 3. Updates Go code references: - profile_runner.go: Uses dtail-tools instead of profile.sh - profile_example.go: Uses dtail-tools for profile analysis The new dtail-tools provides all the functionality of the old bash scripts with better cross-platform compatibility, error handling, and maintainability. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'benchmarks/profile_runner.go')
-rw-r--r--benchmarks/profile_runner.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/benchmarks/profile_runner.go b/benchmarks/profile_runner.go
index 2da122b..e7934dd 100644
--- a/benchmarks/profile_runner.go
+++ b/benchmarks/profile_runner.go
@@ -157,34 +157,35 @@ func ProfileBenchmark(b *testing.B, name string, tool string, args ...string) {
b.Logf("Allocation profile: %s", result.AllocProfile)
}
- // Analyze profiles if profile.sh is available
- dprofilePath := filepath.Join("..", "profiling", "profile.sh")
- if _, err := os.Stat(dprofilePath); err == nil {
+ // Analyze profiles using dtail-tools
+ dtailToolsPath := filepath.Join("..", "dtail-tools")
+ if _, err := os.Stat(dtailToolsPath); err == nil {
if result.CPUProfile != "" {
- analyzeProfile(b, dprofilePath, result.CPUProfile, "CPU")
+ analyzeProfileWithTools(b, dtailToolsPath, result.CPUProfile, "CPU")
}
if result.MemProfile != "" {
- analyzeProfile(b, dprofilePath, result.MemProfile, "Memory")
+ analyzeProfileWithTools(b, dtailToolsPath, result.MemProfile, "Memory")
}
}
})
}
-// analyzeProfile runs profile.sh on a profile file
-func analyzeProfile(b *testing.B, dprofilePath, profilePath, profileType string) {
+// analyzeProfileWithTools runs dtail-tools profile analyze on a profile file
+func analyzeProfileWithTools(b *testing.B, dtailToolsPath, profilePath, profileType string) {
b.Logf("\n%s Profile Analysis:", profileType)
- cmd := exec.Command(dprofilePath, "-top", "5", profilePath)
+ cmd := exec.Command(dtailToolsPath, "profile", "-mode", "analyze", profilePath)
output, err := cmd.CombinedOutput()
if err != nil {
b.Logf("Failed to analyze profile: %v", err)
return
}
- // Print top functions
+ // Print analysis output
lines := strings.Split(string(output), "\n")
- for _, line := range lines {
- if strings.Contains(line, "%") || strings.Contains(line, "Top") {
+ // Print first 10 lines of analysis
+ for i, line := range lines {
+ if i < 10 && line != "" {
b.Log(line)
}
}