-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrace_parser.go
40 lines (35 loc) · 1.02 KB
/
trace_parser.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"bufio"
"fmt"
"strconv"
"strings"
)
func parse(s *bufio.Scanner, threadTraces *map[uint64][]interface{}) {
var tid uint64
tid = 0
count := 0
threadTraceMap := *threadTraces
for s.Scan() {
e := s.Text()
switch e[0] {
case 'T':
trace_entry := strings.Split(e, " ")
tid, _ = strconv.ParseUint(trace_entry[1],16,64)
threadTraceMap[tid] = make([]interface{},0, 100)
case 'D':
NewDimTraceEntry(e)
case 'P':
threadTraceMap[tid] = append(threadTraceMap[tid], NewArithmeticTraceEntry([]rune(e)[2:]))
case 'L':
threadTraceMap[tid] = append(threadTraceMap[tid], NewLoadTraceEntry(e))
case 'S':
threadTraceMap[tid] = append(threadTraceMap[tid], NewStoreTraceEntry(e))
case 'B':
threadTraceMap[tid] = append(threadTraceMap[tid], NewBarrierTraceEntry(e))
default:
}
count += 1
}
fmt.Println(count)
}