]> Cypherpunks repositories - gostls13.git/commitdiff
builder: report run time
authorAndrew Gerrand <adg@golang.org>
Wed, 21 Dec 2011 04:43:12 +0000 (15:43 +1100)
committerAndrew Gerrand <adg@golang.org>
Wed, 21 Dec 2011 04:43:12 +0000 (15:43 +1100)
dashboard: record run time

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5504054

misc/dashboard/app/build/build.go
misc/dashboard/builder/http.go
misc/dashboard/builder/main.go

index 8a0bb6b7a674c1250f8e62d5d6618cb7e19285b4..e7edd7831e0ab0f2e91e0ec933efd0bb5fb0dac6 100644 (file)
@@ -180,6 +180,8 @@ type Result struct {
        OK      bool
        Log     string `datastore:"-"`        // for JSON unmarshaling only
        LogHash string `datastore:",noindex"` // Key to the Log record.
+
+       RunTime int64 // time to build+test in nanoseconds 
 }
 
 func (r *Result) Key(c appengine.Context) *datastore.Key {
index fb6d3e926439c930509035a96158cb6f5f11a7ea..d4a4d7eea668552149d59322f5da710008800efd 100644 (file)
@@ -111,7 +111,7 @@ func (b *Builder) todo(kind, pkg, goHash string) (rev string, err error) {
 }
 
 // recordResult sends build results to the dashboard
-func (b *Builder) recordResult(ok bool, pkg, hash, goHash, buildLog string) error {
+func (b *Builder) recordResult(ok bool, pkg, hash, goHash, buildLog string, runTime time.Duration) error {
        req := obj{
                "Builder":     b.name,
                "PackagePath": pkg,
@@ -119,6 +119,7 @@ func (b *Builder) recordResult(ok bool, pkg, hash, goHash, buildLog string) erro
                "GoHash":      goHash,
                "OK":          ok,
                "Log":         buildLog,
+               "RunTime":     runTime,
        }
        args := url.Values{"key": {b.key}, "builder": {b.name}}
        return dash("POST", "result", args, req, nil)
index 6e571ad35c02fcfc27de129a5e12353510a2bc21..804fb3fe3a4c32d25ab61a415fd68bcabfea42b4 100644 (file)
@@ -294,7 +294,9 @@ func (b *Builder) buildHash(hash string) (err error) {
 
        // build
        logfile := path.Join(workpath, "build.log")
+       startTime := time.Now()
        buildLog, status, err := runLog(b.envv(), logfile, srcDir, *buildCmd)
+       runTime := time.Now().Sub(startTime)
        if err != nil {
                return fmt.Errorf("%s: %s", *buildCmd, err)
        }
@@ -309,11 +311,11 @@ func (b *Builder) buildHash(hash string) (err error) {
 
        if status != 0 {
                // record failure
-               return b.recordResult(false, "", hash, "", buildLog)
+               return b.recordResult(false, "", hash, "", buildLog, runTime)
        }
 
        // record success
-       if err = b.recordResult(true, "", hash, "", ""); err != nil {
+       if err = b.recordResult(true, "", hash, "", "", runTime); err != nil {
                return fmt.Errorf("recordResult: %s", err)
        }
 
@@ -378,7 +380,7 @@ func (b *Builder) buildPackages(goRoot, goHash string) {
                }
 
                // record the result
-               err = b.recordResult(ok, pkg, hash, goHash, buildLog)
+               err = b.recordResult(ok, pkg, hash, goHash, buildLog, 0)
                if err != nil {
                        log.Printf("buildPackages %s: %v", pkg, err)
                }