Skip to content

Commit fee8b7f

Browse files
completed parser transition
1 parent 4473d06 commit fee8b7f

File tree

10 files changed

+25
-493
lines changed

10 files changed

+25
-493
lines changed

engine/benchmark/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ func collectProfileFunctions(args *internal.CollectionArgs) error {
464464
return fmt.Errorf("failed to create output directory: %w", err)
465465
}
466466

467-
functions, err := parser.GetAllFunctionNames(paths.ProfileTextFile, args.BenchmarkConfig)
467+
functions, err := parser.GetAllFunctionNamesV2(paths.ProfileBinaryFile, args.BenchmarkConfig)
468468
if err != nil {
469469
return fmt.Errorf("failed to extract function names: %w", err)
470470
}

engine/collector/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func RunCollector(files []string, tag string) error {
5454
return err
5555
}
5656

57-
if err = collectFunctions(outputTextFilePath, profileDirPath, fullBinaryPath, functionFilter); err != nil {
57+
if err = collectFunctions(profileDirPath, fullBinaryPath, functionFilter); err != nil {
5858
return fmt.Errorf("collectFunctions failed: %w", err)
5959
}
6060
}

engine/collector/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ func getFunctionPprofContent(function, binaryFile, outputFile string) error {
4343
return nil
4444
}
4545

46-
func collectFunctions(outputTextFilePath, profileDirPath, fullBinaryPath string, functionFilter internal.FunctionFilter) error {
46+
func collectFunctions(profileDirPath, fullBinaryPath string, functionFilter internal.FunctionFilter) error {
4747
var functions []string
48-
functions, err := parser.GetAllFunctionNames(outputTextFilePath, functionFilter)
48+
functions, err := parser.GetAllFunctionNamesV2(fullBinaryPath, functionFilter)
4949
if err != nil {
5050
return fmt.Errorf("failed to extract function names: %w", err)
5151
}

parser/api.go

Lines changed: 0 additions & 90 deletions
This file was deleted.

parser/helpers.go

Lines changed: 0 additions & 71 deletions
This file was deleted.

parser/helpersv2.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,24 @@ func extractSimpleFunctionName(fullPath string) string {
203203

204204
return lastPart
205205
}
206+
207+
func matchPrefix(funcName string, functionPrefixes []string) bool {
208+
var hasPrefix bool
209+
for _, prefix := range functionPrefixes {
210+
if strings.Contains(funcName, prefix) {
211+
hasPrefix = true
212+
break
213+
}
214+
}
215+
216+
return hasPrefix
217+
}
218+
219+
func getFilterSets(ignoreFunctions []string) map[string]struct{} {
220+
ignoreSet := make(map[string]struct{})
221+
for _, f := range ignoreFunctions {
222+
ignoreSet[f] = struct{}{}
223+
}
224+
225+
return ignoreSet
226+
}

parser/tests/testFiles/BenchmarkGenPool_cpu.txt

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)