mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Now you can launch the scope app with something like
./prog/scope --mode=app --weave=false --app.collector=file:///tmp/reports
and if the specified dir contains reports with filenames in the form
<timestamp>.{msgpack|json}[.gz],
e.g. "1488557088545489008.msgpack.gz", then these reports are replayed
in a loop at a sequence and speed determined by the timestamps.
50 lines
933 B
Go
50 lines
933 B
Go
package app
|
|
|
|
import (
|
|
"flag"
|
|
"net/http"
|
|
"net/url"
|
|
"testing"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
"github.com/weaveworks/scope/render"
|
|
"github.com/weaveworks/scope/report"
|
|
"github.com/weaveworks/scope/test/fixture"
|
|
)
|
|
|
|
var (
|
|
benchReportFile = flag.String("bench-report-file", "", "json report file to use for benchmarking (relative to this package)")
|
|
)
|
|
|
|
func loadReport() (report.Report, error) {
|
|
if *benchReportFile == "" {
|
|
return fixture.Report, nil
|
|
}
|
|
|
|
c, err := NewFileCollector(*benchReportFile, 0)
|
|
if err != nil {
|
|
return fixture.Report, err
|
|
}
|
|
|
|
return c.Report(context.Background())
|
|
}
|
|
|
|
func BenchmarkTopologyList(b *testing.B) {
|
|
report, err := loadReport()
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
request := &http.Request{
|
|
Form: url.Values{},
|
|
}
|
|
for i := 0; i < b.N; i++ {
|
|
b.StopTimer()
|
|
render.ResetCache()
|
|
b.StartTimer()
|
|
topologyRegistry.renderTopologies(report, request)
|
|
}
|
|
}
|