diff --git a/js/compiler/compiler.go b/js/compiler/compiler.go index 9f8ce5aed86..90549b46611 100644 --- a/js/compiler/compiler.go +++ b/js/compiler/compiler.go @@ -1,7 +1,10 @@ package compiler import ( + "time" + "github.com/GeertJohan/go.rice" + log "github.com/Sirupsen/logrus" "github.com/dop251/goja" "github.com/mitchellh/mapstructure" ) @@ -53,10 +56,12 @@ func (c *Compiler) Transform(src, filename string) (code string, srcmap SourceMa } opts["filename"] = filename + startTime := time.Now() v, err := c.transform(c.this, c.vm.ToValue(src), c.vm.ToValue(opts)) if err != nil { return code, srcmap, err } + log.WithField("t", time.Since(startTime)).Debug("Babel: Transformed") vO := v.ToObject(c.vm) if err := c.vm.ExportTo(vO.Get("code"), &code); err != nil { diff --git a/loader/loader.go b/loader/loader.go index b51f42adcfe..f2d1ace5d39 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -25,9 +25,10 @@ import ( "net/http" "path/filepath" "regexp" - "strings" + "time" + log "github.com/Sirupsen/logrus" "github.com/loadimpact/k6/lib" "github.com/pkg/errors" "github.com/spf13/afero" @@ -139,6 +140,8 @@ func pickLoader(path string) (string, loaderFunc, []string) { } func fetch(u string) ([]byte, error) { + log.WithField("url", u).Debug("Fetching source...") + startTime := time.Now() res, err := http.Get(u) if err != nil { return nil, err @@ -154,5 +157,15 @@ func fetch(u string) ([]byte, error) { } } - return ioutil.ReadAll(res.Body) + data, err := ioutil.ReadAll(res.Body) + if err != nil { + return nil, err + } + + log.WithFields(log.Fields{ + "url": u, + "t": time.Since(startTime), + "len": len(data), + }).Debug("Fetched!") + return data, nil }