mirror of
https://github.com/golang/go
synced 2024-11-24 21:00:09 -07:00
builder: report run time
dashboard: record run time R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5504054
This commit is contained in:
parent
494e52fe1c
commit
eecb6a79ff
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user