nettests/nettests.go: use experiment getters to get data usage

This commit is contained in:
Simone Basso 2020-04-05 23:38:18 +02:00
parent 07e4367f6d
commit 967e9f0924

View File

@ -76,6 +76,10 @@ func (c *Controller) Run(builder *engine.ExperimentBuilder, inputs []string) err
builder.SetCallbacks(model.ExperimentCallbacks(c)) builder.SetCallbacks(model.ExperimentCallbacks(c))
c.numInputs = len(inputs) c.numInputs = len(inputs)
exp := builder.NewExperiment() exp := builder.NewExperiment()
defer func() {
c.res.DataUsageDown += exp.KibiBytesReceived()
c.res.DataUsageUp += exp.KibiBytesSent()
}()
c.msmts = make(map[int64]*database.Measurement) c.msmts = make(map[int64]*database.Measurement)
@ -202,6 +206,9 @@ func (c *Controller) OnProgress(perc float64, msg string) {
// OnDataUsage should be called when we have a data usage update. // OnDataUsage should be called when we have a data usage update.
func (c *Controller) OnDataUsage(dloadKiB, uploadKiB float64) { func (c *Controller) OnDataUsage(dloadKiB, uploadKiB float64) {
c.res.DataUsageDown += dloadKiB // Unused as 2020-04-05: we're now using directly the accessors
c.res.DataUsageUp += uploadKiB // provided by the experiment. This callback is going to be removed
// from probe-engine in May or June.
//
// TODO(bassosimone): create an issue for this?
} }