-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathstats_printer_test.go
66 lines (56 loc) · 2.07 KB
/
stats_printer_test.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
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2019-present Kuei-chun Chen. All rights reserved.
// stats_printer_test.go
package ftdc
import (
"encoding/json"
"testing"
)
func getServerStatusDocs() []ServerStatusDoc {
var diag DiagnosticData
var docs []ServerStatusDoc
d := NewDiagnosticData()
diag, _ = d.readDiagnosticFile(DiagnosticDataFilename)
for _, ss := range diag.ServerStatusList {
b, _ := json.Marshal(ss)
doc := ServerStatusDoc{}
json.Unmarshal(b, &doc)
docs = append(docs, doc)
}
return docs
}
func TestPrintWiredTigerConcurrentTransactionsDetails(t *testing.T) {
docs := getServerStatusDocs()
printWiredTigerConcurrentTransactionsDetails(docs, 600) // every 10 minutes
span := int(docs[(len(docs)-1)].LocalTime.Sub(docs[0].LocalTime).Seconds()) / 20
t.Log(printWiredTigerConcurrentTransactionsDetails(docs, span))
}
func TestPrintWiredTigerCacheDetails(t *testing.T) {
docs := getServerStatusDocs()
printWiredTigerCacheDetails(docs, 600) // every 10 minutes
span := int(docs[(len(docs)-1)].LocalTime.Sub(docs[0].LocalTime).Seconds()) / 20
t.Log(printWiredTigerCacheDetails(docs, span))
}
func TestPrintGlobalLockDetails(t *testing.T) {
docs := getServerStatusDocs()
printGlobalLockDetails(docs, 600) // every 10 minutes
span := int(docs[(len(docs)-1)].LocalTime.Sub(docs[0].LocalTime).Seconds()) / 20
t.Log(printGlobalLockDetails(docs, span))
}
func TestPrintMetricsDetails(t *testing.T) {
docs := getServerStatusDocs()
printMetricsDetails(docs, 600) // every 10 minutes
span := int(docs[(len(docs)-1)].LocalTime.Sub(docs[0].LocalTime).Seconds()) / 20
t.Log(printMetricsDetails(docs, span))
}
func TestPrintLatencyDetails(t *testing.T) {
docs := getServerStatusDocs()
printLatencyDetails(docs, 600) // every 10 minutes
span := int(docs[(len(docs)-1)].LocalTime.Sub(docs[0].LocalTime).Seconds()) / 20
t.Log(printLatencyDetails(docs, span))
}
func TestPrintStatsDetails(t *testing.T) {
docs := getServerStatusDocs()
printStatsDetails(docs, 600) // every 10 minutes
span := int(docs[(len(docs)-1)].LocalTime.Sub(docs[0].LocalTime).Seconds()) / 20
t.Log(printStatsDetails(docs, span))
}