@@ -84,6 +84,8 @@ func TestAggregates(t *testing.T) {
84
84
Fifty : 1000 ,
85
85
Ninety : 1000 ,
86
86
NinetyFive : 1000 ,
87
+ // Since cpu is calculated between samples, we lose 1 sample.
88
+ Count : N - 2 ,
87
89
}
88
90
if usage .Cpu != cpuExpected {
89
91
t .Errorf ("cpu stats are %+v. Expected %+v" , usage .Cpu , cpuExpected )
@@ -95,6 +97,7 @@ func TestAggregates(t *testing.T) {
95
97
Fifty : 50 * 1024 ,
96
98
Ninety : 90 * 1024 ,
97
99
NinetyFive : 95 * 1024 ,
100
+ Count : N - 1 ,
98
101
}
99
102
if usage .Memory != memExpected {
100
103
t .Errorf ("memory stats are mean %+v. Expected %+v" , usage .Memory , memExpected )
@@ -133,6 +136,8 @@ func TestSamplesCloseInTimeIgnored(t *testing.T) {
133
136
Fifty : 1000 ,
134
137
Ninety : 1000 ,
135
138
NinetyFive : 1000 ,
139
+ // Since cpu is calculated between samples, we lose 1 sample.
140
+ Count : N - 2 ,
136
141
}
137
142
if usage .Cpu != cpuExpected {
138
143
t .Errorf ("cpu stats are %+v. Expected %+v" , usage .Cpu , cpuExpected )
@@ -144,6 +149,7 @@ func TestSamplesCloseInTimeIgnored(t *testing.T) {
144
149
Fifty : 50 * 1024 ,
145
150
Ninety : 90 * 1024 ,
146
151
NinetyFive : 95 * 1024 ,
152
+ Count : N - 1 ,
147
153
}
148
154
if usage .Memory != memExpected {
149
155
t .Errorf ("memory stats are mean %+v. Expected %+v" , usage .Memory , memExpected )
@@ -184,6 +190,8 @@ func TestDerivedStats(t *testing.T) {
184
190
Fifty : 50 * Nanosecond ,
185
191
Ninety : 90 * Nanosecond ,
186
192
NinetyFive : 95 * Nanosecond ,
193
+ // Since cpu is calculated directly from samples, we don't lose any samples.
194
+ Count : N - 1 ,
187
195
}
188
196
if usage .Cpu != cpuExpected {
189
197
t .Errorf ("cpu stats are %+v. Expected %+v" , usage .Cpu , cpuExpected )
@@ -195,6 +203,7 @@ func TestDerivedStats(t *testing.T) {
195
203
Fifty : 50 * 1024 ,
196
204
Ninety : 90 * 1024 ,
197
205
NinetyFive : 95 * 1024 ,
206
+ Count : N - 1 ,
198
207
}
199
208
if usage .Memory != memExpected {
200
209
t .Errorf ("memory stats are mean %+v. Expected %+v" , usage .Memory , memExpected )
0 commit comments