tsak 创建索引
This commit is contained in:
parent
7ec319f40d
commit
bf49318e8d
@ -244,7 +244,7 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
|
||||
//Event-------------------------------------------------------------------------------------------------玩家离线
|
||||
func (this *Hero) EventUserOffline(session comm.IUserSession) {
|
||||
err := this.modelHero.RemoveUserHeroInfo(session)
|
||||
this.Debugf("EventUserOffline:%s err:%v", session, err)
|
||||
this.Debugf("EventUserOffline:%s err:%v", session.ToString(), err)
|
||||
}
|
||||
|
||||
// 批量创建多个英雄
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type ModelTask struct {
|
||||
@ -26,6 +28,9 @@ func (this *ModelTask) Init(service core.IService, module core.IModule, comp cor
|
||||
this.moduleTask = module.(*ModuleTask)
|
||||
this.EventApp = event_v2.NewApp()
|
||||
this.EventApp.Listen(comm.EventTaskChanged, this.doTaskHandle)
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -202,12 +202,13 @@ func calculateData(concurrent, processingTime, requestTime, maxTime, minTime, su
|
||||
|
||||
// header 打印表头信息
|
||||
func header() {
|
||||
log.Infof("\n\n")
|
||||
fmt.Printf("\n\n")
|
||||
// 打印的时长都为毫秒 总请数
|
||||
log.Infof("─────┬───────┬───────┬───────┬────────┬───────────┬───────────┬───────────┬────────┬─────────┬───────")
|
||||
log.Infof(" 耗时│ 并发数│ 成功数│ 失败数 │ qps │最长耗时 ms │最短耗时 ms│平均耗时 ms│下载字节│ 字节每秒 │ 状态码")
|
||||
log.Infof("─────┼───────┼───────┼───────┼────────┼───────────┼───────────┼───────────┼────────┼─────────┼───────")
|
||||
fmt.Println("─────┬───────┬───────┬───────┬────────┬────────┬────────┬────────┬────────┬────────┬────────")
|
||||
fmt.Println(" 耗时│ 并发数│ 成功数│ 失败数│ qps │最长耗时│最短耗时│平均耗时│下载字节│字节每秒│ 状态码")
|
||||
fmt.Println("─────┼───────┼───────┼───────┼────────┼────────┼────────┼────────┼────────┼────────┼────────")
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
// table 打印表格
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"go_dreamfactory/stress/model"
|
||||
"go_dreamfactory/stress/server"
|
||||
"go_dreamfactory/stress/server/statistics"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@ -76,14 +75,14 @@ type Options struct {
|
||||
|
||||
//go:generate go build main.go
|
||||
func main() {
|
||||
runtime.GOMAXPROCS(cpuNumber)
|
||||
//runtime.GOMAXPROCS(cpuNumber)
|
||||
flag.Parse()
|
||||
statistics.InitLog()
|
||||
|
||||
concurrency = 1000
|
||||
concurrency = 10
|
||||
totalNumber = 1
|
||||
debugStr = "false"
|
||||
requestURL = "ws://10.0.0.9:7891/gateway"
|
||||
requestURL = "ws://10.0.0.85:7891/gateway"
|
||||
verify = "pb"
|
||||
if concurrency == 0 || totalNumber == 0 || (requestURL == "" && path == "") {
|
||||
fmt.Printf("示例: go run main.go -c 1 -n 1 -u https://www.baidu.com/ \n")
|
||||
|
Loading…
Reference in New Issue
Block a user