File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"bufio"
11
11
"errors"
12
12
"fmt"
13
+ "io"
13
14
"math"
14
15
"os"
15
16
"sort"
@@ -45,14 +46,18 @@ func ParseProfiles(fileName string) ([]*Profile, error) {
45
46
return nil , err
46
47
}
47
48
defer pf .Close ()
49
+ return ParseProfilesFromReader (pf )
50
+ }
48
51
49
- files := make (map [string ]* Profile )
50
- buf := bufio .NewReader (pf )
52
+ // ParseProfilesFromReader parses profile data from the Reader and
53
+ // returns a Profile for each source file described therein.
54
+ func ParseProfilesFromReader (rd io.Reader ) ([]* Profile , error ) {
51
55
// First line is "mode: foo", where foo is "set", "count", or "atomic".
52
56
// Rest of file is in the format
53
57
// encoding/base64/base64.go:34.44,37.40 3 1
54
58
// where the fields are: name.go:line.column,line.column numberOfStatements count
55
- s := bufio .NewScanner (buf )
59
+ files := make (map [string ]* Profile )
60
+ s := bufio .NewScanner (rd )
56
61
mode := ""
57
62
for s .Scan () {
58
63
line := s .Text ()
You can’t perform that action at this time.
0 commit comments