40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package robot
|
|
|
|
import (
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/lego/core/cbase"
|
|
)
|
|
|
|
/*
|
|
统计组件
|
|
*/
|
|
type statisticalComp struct {
|
|
cbase.ModuleCompBase
|
|
succclientNum int32 //链接成功客户端数
|
|
failclientNum int32 //链接失败客户端数
|
|
totalmessage int32 //总消息两
|
|
robotdata map[string][]*RobotStatistics //机器人统计数据
|
|
}
|
|
|
|
//组件初始化接口
|
|
func (this *statisticalComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
this.ModuleCompBase.Init(service, module, comp, options)
|
|
this.robotdata = make(map[string][]*RobotStatistics)
|
|
return
|
|
}
|
|
|
|
//添加成功客户端数
|
|
func (this *statisticalComp) AddSuccClient(robot *Robot) {
|
|
this.succclientNum++
|
|
}
|
|
|
|
//添加失败客户端数
|
|
func (this *statisticalComp) AddFailClient(robot *Robot, err error) {
|
|
this.succclientNum++
|
|
}
|
|
|
|
//机器人测试结束
|
|
func (this *statisticalComp) RobotFinishedTest(robot *Robot) {
|
|
|
|
}
|