executor: vmstats in json
This commit is contained in:
parent
fc46430065
commit
2dce5ae65c
|
@ -1,6 +1,7 @@
|
||||||
package executor
|
package executor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -33,13 +34,25 @@ type Config struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Result struct {
|
type Result struct {
|
||||||
Status int64
|
Status int64 `json:"status"`
|
||||||
GasUsed uint64
|
GasUsed uint64 `json:"gas_used"`
|
||||||
SyscallCount int64
|
SyscallCount int64 `json:"syscall_count"`
|
||||||
ExecDur time.Duration
|
ExecDur time.Duration `json:"exec_dur"`
|
||||||
PagesBeforeExec int
|
PagesBeforeExec int `json:"pages_before_exec"`
|
||||||
PagesUsed int
|
PagesUsed int `json:"pages_used"`
|
||||||
StartTime time.Time
|
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 {
|
func (r Result) StatsFile() txtar.File {
|
||||||
|
|
Loading…
Reference in New Issue