-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglobals.go
76 lines (62 loc) · 3.12 KB
/
globals.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
67
68
69
70
71
72
73
74
75
76
package main
import (
"github.com/HdrHistogram/hdrhistogram-go"
"golang.org/x/time/rate"
"math"
"sync"
)
var totalCommands uint64
var totalEmptyResultsets uint64
var totalErrors uint64
var errorsPerQuery []uint64
var totalNodesCreated uint64
var totalNodesDeleted uint64
var totalLabelsAdded uint64
var totalPropertiesSet uint64
var totalRelationshipsCreated uint64
var totalRelationshipsDeleted uint64
var totalNodesCreatedPerQuery []uint64
var totalNodesDeletedPerQuery []uint64
var totalLabelsAddedPerQuery []uint64
var totalPropertiesSetPerQuery []uint64
var totalRelationshipsCreatedPerQuery []uint64
var totalRelationshipsDeletedPerQuery []uint64
var randIntPlaceholder string = "__rand_int__"
// no locking is required when using the histograms. data is duplicated on the instant and overall histograms
var clientSide_AllQueries_OverallLatencies *hdrhistogram.Histogram
var serverSide_AllQueries_GraphInternalTime_OverallLatencies *hdrhistogram.Histogram
var clientSide_PerQuery_OverallLatencies []*hdrhistogram.Histogram
var serverSide_PerQuery_GraphInternalTime_OverallLatencies []*hdrhistogram.Histogram
// this mutex does not affect any of the client go-routines ( it's only to sync between main thread and datapoints processer go-routines )
var instantHistogramsResetMutex sync.Mutex
var clientSide_AllQueries_InstantLatencies *hdrhistogram.Histogram
var serverSide_AllQueries_GraphInternalTime_InstantLatencies *hdrhistogram.Histogram
var benchmarkQueries arrayStringParameters
var benchmarkQueriesRO arrayStringParameters
var benchmarkQueryRates arrayStringParameters
const Inf = rate.Limit(math.MaxFloat64)
func createRequiredGlobalStructs(totalDifferentCommands int) {
errorsPerQuery = make([]uint64, totalDifferentCommands)
totalNodesCreatedPerQuery = make([]uint64, totalDifferentCommands)
totalNodesDeletedPerQuery = make([]uint64, totalDifferentCommands)
totalLabelsAddedPerQuery = make([]uint64, totalDifferentCommands)
totalPropertiesSetPerQuery = make([]uint64, totalDifferentCommands)
totalRelationshipsCreatedPerQuery = make([]uint64, totalDifferentCommands)
totalRelationshipsDeletedPerQuery = make([]uint64, totalDifferentCommands)
clientSide_AllQueries_OverallLatencies = hdrhistogram.New(1, 90000000000, 4)
clientSide_AllQueries_InstantLatencies = hdrhistogram.New(1, 90000000000, 4)
serverSide_AllQueries_GraphInternalTime_OverallLatencies = hdrhistogram.New(1, 90000000000, 4)
serverSide_AllQueries_GraphInternalTime_InstantLatencies = hdrhistogram.New(1, 90000000000, 4)
clientSide_PerQuery_OverallLatencies = make([]*hdrhistogram.Histogram, totalDifferentCommands)
serverSide_PerQuery_GraphInternalTime_OverallLatencies = make([]*hdrhistogram.Histogram, totalDifferentCommands)
for i := 0; i < totalDifferentCommands; i++ {
clientSide_PerQuery_OverallLatencies[i] = hdrhistogram.New(1, 90000000000, 4)
serverSide_PerQuery_GraphInternalTime_OverallLatencies[i] = hdrhistogram.New(1, 90000000000, 4)
}
}
func resetInstantHistograms() {
instantHistogramsResetMutex.Lock()
clientSide_AllQueries_InstantLatencies.Reset()
serverSide_AllQueries_GraphInternalTime_InstantLatencies.Reset()
instantHistogramsResetMutex.Unlock()
}