cowatchbenchmark

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 18 Imported by: 0

README

coWatchBenchmark

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRoomReqBody added in v0.1.2

type CreateRoomReqBody struct {
	AppID      string `json:"appId"`
	ExpireTime int    `json:"expireTime"`
	HostUid    int    `json:"hostUid"`
	Version    string `json:"version"`
}

type RequestedUserInfo

type RequestedUserInfo struct {
	Sid          string `json:"sid"`
	Upgrades     []int  `json:"upgrades"`
	PingInterval int    `json:"PingInterval"`
	PingTimeOut  int    `json:"PingTimeout"`
}

type Room

type Room struct {
	Name string `json:"name"`
}

type RoomManager

type RoomManager struct {
	Addr             string
	RoomSize         int
	UserSize         int
	MsgLen           int
	Frequency        int
	LckRoom          sync.Mutex
	Rooms            []*RoomUnit
	Start            bool
	HttpTimeout      time.Duration
	WSTimeout        time.Duration
	AppID            string
	SingleClientMode int
	ParallelRequest  bool
	NotifyUserAdd    <-chan int // chan 大小为 用户总数
	// contains filtered or unexported fields
}

func NewRoomManager

func NewRoomManager(addr string, room, user, msgLen, frequency, httpTimeout, webSocketTimeout int, appID string, singleClientMode int, parallel int) *RoomManager

NewRoomManager will return a RoomManager

func (*RoomManager) CheckCreatingRoomsOK added in v0.2.0

func (p *RoomManager) CheckCreatingRoomsOK() bool

func (*RoomManager) CheckCreatingUsersOK added in v0.2.0

func (p *RoomManager) CheckCreatingUsersOK() bool

func (*RoomManager) Close added in v0.2.0

func (p *RoomManager) Close()

func (*RoomManager) GetCreatedRooms added in v0.2.0

func (p *RoomManager) GetCreatedRooms() int

func (*RoomManager) GetCreatingRoomAvgDuration

func (p *RoomManager) GetCreatingRoomAvgDuration() time.Duration

GetCreatingRoomAvgDuration return the average time consumption of all rooms which are created successfully

func (*RoomManager) GetCreatingUsersAvgDuration

func (p *RoomManager) GetCreatingUsersAvgDuration() time.Duration

func (*RoomManager) GetTotalUsers added in v0.2.0

func (p *RoomManager) GetTotalUsers() int

func (*RoomManager) RequestAllRooms added in v0.1.4

func (p *RoomManager) RequestAllRooms(when time.Time) error

RequestAllRooms will request all the rooms from the server. param when is the start time for Request room from server concurrently [Only useful when parallel is true] param mode is the mode for Request room. true means parallel and false means serial

func (*RoomManager) RequestRoom added in v0.1.4

func (p *RoomManager) RequestRoom() error

type RoomUnit

type RoomUnit struct {
	Address string // server+port
	Schema  string

	RoomId   int // room ID
	Password string

	PingInterval int // ws/wss
	PingTimeout  int // ws/wss
	RtcToken     string

	Users      []*User // valid users in room
	AppId      string
	ExpireTime int
	SdkVersion string

	// for statistics
	ConnectionDuration time.Duration
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom(host string, httpTimeout, wsTimeout time.Duration, maximumUsers, msgLength, frequency int, appId string, rm *RoomManager) *RoomUnit

NewRoom return a RoomUnit object

func (*RoomUnit) Request added in v0.1.4

func (p *RoomUnit) Request() error

func (*RoomUnit) UsersConnection added in v0.1.4

func (p *RoomUnit) UsersConnection(start chan struct{}, ctx context.Context, wg *sync.WaitGroup)

UsersConnection try to connect to the server and exchange message. param when is the time for requesting of websocket concurrently param mode is the mode for requesting. 0 means parallel and 1 means serial

type User

type User struct {
	Lw sync.Mutex // lock for writing

	ConnectionDuration time.Duration
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL