新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

Commit 0836e3f7 authored by 天乐 韩's avatar 天乐 韩

Merge branch 'v2.3.1_qc' of git.code.tencent.com:ChainMaker/vm-engine into v2.3.1_qc

No related merge requests found
......@@ -31,7 +31,7 @@ type DockerVMConfig struct {
// uds_open false, tcp
RuntimeServer RuntimeServerConfig `mapstructure:"runtime_server"` // runtime server
ContractEngine ContractEngineConfig `mapstructure:"contract_engine"` // contract engine
SlowTxLog SlowTxLogConfig `mapstructure:"slow_tx_log"` // slow tx config
Slow SlowConfig `mapstructure:"slow"` // slow tx config
}
// RuntimeServerConfig is the runtime server config
......@@ -47,11 +47,11 @@ type ContractEngineConfig struct {
MaxConnection uint64 `mapstructure:"max_connection"`
}
// SlowTxLogConfig is the slow tx log
type SlowTxLogConfig struct {
StepBaseTime int `mapstructure:"step_base_time"`
TxBaseTime int `mapstructure:"tx_base_time"`
Disable bool `mapstructure:"disable"`
// SlowConfig is the slow tx log
type SlowConfig struct {
Disable bool `mapstructure:"disable"`
StepTime int `mapstructure:"step_time"`
TxTime int `mapstructure:"tx_time"`
}
// DockerContainerConfig docker container settings
......
......@@ -287,12 +287,12 @@ func validateVMSettings(dockerVMConfig *config.DockerVMConfig,
dockerVMConfig.TxTimeout = config.DefaultTxTimeout
}
if dockerVMConfig.SlowTxLog.StepBaseTime == 0 {
dockerVMConfig.SlowTxLog.StepBaseTime = config.DefaultSlowStepLogTime
if dockerVMConfig.Slow.StepTime == 0 {
dockerVMConfig.Slow.StepTime = config.DefaultSlowStepLogTime
}
if dockerVMConfig.SlowTxLog.TxBaseTime == 0 {
dockerVMConfig.SlowTxLog.TxBaseTime = config.DefaultSlowTxLogTime
if dockerVMConfig.Slow.TxTime == 0 {
dockerVMConfig.Slow.TxTime = config.DefaultSlowTxLogTime
}
dockerContainerConfig.HostMountDir = hostMountDir
......
......@@ -45,6 +45,6 @@ contract:
max_file_size: 20480 # contract size(MiB)
slow:
disable: false
step_time: 3s
tx_time: 6s
disable: false
\ No newline at end of file
tx_time: 6s
\ No newline at end of file
......@@ -366,7 +366,7 @@ func (r *BlockTxsDurationMgr) FinishTx(id string, txTime *TxDuration) {
// EnterNextStep enter next duration tx step
func EnterNextStep(msg *protogo.DockerVMMessage, stepType protogo.StepType, getStr func() string) {
if config.VMConfig.SlowTxLog.Disable {
if config.VMConfig.Slow.Disable {
return
}
if stepType != protogo.StepType_RUNTIME_PREPARE_TX_REQUEST {
......@@ -423,13 +423,13 @@ func PrintTxStepsWithTime(msg *protogo.DockerVMMessage) (string, bool) {
}
lastStep := msg.StepDurations[len(msg.StepDurations)-1]
var sb strings.Builder
if lastStep.UntilDuration > time.Second.Nanoseconds()*int64(config.VMConfig.SlowTxLog.TxBaseTime) {
if lastStep.UntilDuration > time.Second.Nanoseconds()*int64(config.VMConfig.Slow.TxTime) {
sb.WriteString("slow tx overall: ")
sb.WriteString(PrintTxSteps(msg))
return sb.String(), true
}
for _, step := range msg.StepDurations {
if step.StepDuration > time.Second.Nanoseconds()*int64(config.VMConfig.SlowTxLog.StepBaseTime) {
if step.StepDuration > time.Second.Nanoseconds()*int64(config.VMConfig.Slow.StepTime) {
sb.WriteString(fmt.Sprintf("slow tx at step %q, step cost: %vms: ",
step.Type, time.Duration(step.StepDuration).Seconds()*1000))
sb.WriteString(PrintTxSteps(msg))
......
......@@ -34,12 +34,12 @@ const (
var DockerVMConfig *conf
type conf struct {
RPC rpcConf `mapstructure:"rpc"`
Process processConf `mapstructure:"process"`
Log logConf `mapstructure:"log"`
Pprof pprofConf `mapstructure:"pprof"`
Contract contractConf `mapstructure:"contract"`
Slow slowTxLogConf `mapstructure:"slow"`
RPC rpcConf `mapstructure:"rpc"`
Process processConf `mapstructure:"process"`
Log logConf `mapstructure:"log"`
Pprof pprofConf `mapstructure:"pprof"`
Contract contractConf `mapstructure:"contract"`
Slow slowConf `mapstructure:"slow"`
}
type ChainRPCProtocolType int
......@@ -94,10 +94,10 @@ type contractConf struct {
MaxFileSize int `mapstructure:"max_file_size"`
}
type slowTxLogConf struct {
type slowConf struct {
Disable bool `mapstructure:"disable"`
StepTime time.Duration `mapstructure:"step_time"`
TxTime time.Duration `mapstructure:"tx_time"`
Disable bool `mapstructure:"disable"`
}
func InitConfig(configFileName string) error {
......@@ -262,15 +262,15 @@ func (c *conf) setEnv() error {
c.Process.ExecTxTimeout = time.Duration(timeout) * time.Second
}
}
if slowTxDisable, ok := os.LookupEnv("SLOW_TX_DISABLE"); ok {
isDisable, err := strconv.ParseBool(slowTxDisable)
if slowDisable, ok := os.LookupEnv("SLOW_DISABLE"); ok {
isDisable, err := strconv.ParseBool(slowDisable)
if err != nil {
errs = append(errs, fmt.Sprintf("failed to ParseBool slowTxDisable: %v", err))
errs = append(errs, fmt.Sprintf("failed to ParseBool slowDisable: %v", err))
}
if isDisable {
c.Slow.Disable = true
} else {
if slowStepTime, ok := os.LookupEnv("SLOW_TX_STEP_TIME"); ok {
if slowStepTime, ok := os.LookupEnv("SLOW_STEP_TIME"); ok {
timeout, err := strconv.ParseInt(slowStepTime, 10, 64)
if err != nil {
errs = append(errs, fmt.Sprintf("failed to ParseInt slowStepTime: %v", err))
......
......@@ -156,7 +156,8 @@ func EnterNextStep(msg *protogo.DockerVMMessage, stepType protogo.StepType, getS
endTxStep(msg)
}
addTxStep(msg, stepType, getStr())
if stepType == protogo.StepType_RUNTIME_HANDLE_TX_RESPONSE {
if stepType == protogo.StepType_RUNTIME_HANDLE_TX_RESPONSE ||
stepType == protogo.StepType_ENGINE_PROCESS_RECEIVE_TX_RESPONSE {
endTxStep(msg)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment