mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 02:30:45 +00:00
* Hacky working prototype. * Operate with time.Duration offset instead of fixed timestamp. * Polished the backend code. * Made a nicer UI component. * Small refactorings of the websockets code. * Fixed the backend tests. * Better websocketing and smoother transitions * Small styling refactoring. * Detecting empty topologies. * Improved error messaging. * Addressed some of David's comments. * Moved nodesDeltaBuffer to a global state to fix the paused status rendering bug. * Small styling changes * Changed the websocket global state variables a bit. * Polishing & refactoring. * More polishing. * Final refactoring. * Addressed a couple of bugs. * Hidden the timeline control behind Cloud context and a feature flag. * Addressed most of @davkal's comments. * Added mixpanel tracking.
51 lines
953 B
Go
51 lines
953 B
Go
package app
|
|
|
|
import (
|
|
"flag"
|
|
"net/http"
|
|
"net/url"
|
|
"testing"
|
|
"time"
|
|
|
|
"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(), time.Now())
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|