executor: vmstats in json

This commit is contained in:
Cadey Ratio 2019-12-14 15:19:08 +00:00
parent fc46430065
commit 2dce5ae65c
1 changed files with 20 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package executor
import (
"encoding/json"
"errors"
"fmt"
"io"
@ -33,13 +34,25 @@ type Config struct {
}
type Result struct {
Status int64
GasUsed uint64
SyscallCount int64
ExecDur time.Duration
PagesBeforeExec int
PagesUsed int
StartTime time.Time
Status int64 `json:"status"`
GasUsed uint64 `json:"gas_used"`
SyscallCount int64 `json:"syscall_count"`
ExecDur time.Duration `json:"exec_dur"`
PagesBeforeExec int `json:"pages_before_exec"`
PagesUsed int `json:"pages_used"`
StartTime time.Time `json:"start_time"`
}
func (r Result) StatsJSONFile() txtar.File {
data, err := json.MarshalIndent(r, "", " ")
if err != nil /* unlikely */ {
panic(err)
}
return txtar.File{
Name: "vmstats.json",
Data: data,
}
}
func (r Result) StatsFile() txtar.File {