-
Notifications
You must be signed in to change notification settings - Fork 0
/
framework_debug.go
54 lines (36 loc) · 955 Bytes
/
framework_debug.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
/*
* This file implements some helper function for debug
*
*/
import (
"fmt"
"time"
)
//debuglist := make(map[int]bool)
var debuglist map[int]bool
func (fra *Framework) DebugPrint() {
debuglist = make(map[int]bool)
for {
time.Sleep(time.Duration(5000000) * time.Microsecond)
continue
fra.mutex.Lock()
fmt.Println("--------------- Debug Print ------------------")
for reqid, req := range fra.Requests {
if req.phase < 2 {
fmt.Println("active request", reqid, req.phase, req)
}
}
fmt.Println("request waiting list", debuglist)
for k,_ := range debuglist {
fmt.Println("probably bad request", fra.Requests[k].phase, fra.Requests[k])
}
fra.mutex.Unlock()
}
}
func (fra *Framework) DebugAddToWaitingList(reqid int) {
debuglist[reqid] = true
}
func (fra *Framework) DebugRemoveFromWaitingList(reqid int) {
delete(debuglist, reqid)
}