Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
getty
Commits
87189d12
Unverified
Commit
87189d12
authored
Jun 30, 2021
by
Xin.Zh
Committed by
GitHub
Jun 30, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #65 from georgehao/improve/delte-handleLoop
feat: go fmt
parents
78fbb15a
372309a4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
25 deletions
+20
-25
main.go
benchmark/client/main.go
+7
-6
main.go
benchmark/loop_client/main.go
+7
-5
main.go
benchmark/server/main.go
+3
-5
connection.go
connection.go
+2
-6
session.go
session.go
+1
-3
No files found.
benchmark/client/main.go
View file @
87189d12
...
...
@@ -48,8 +48,10 @@ var (
var
taskPool
gxsync
.
GenericTaskPool
const
CronPeriod
=
20e9
const
WritePkgTimeout
=
1e8
const
(
CronPeriod
=
20e9
WritePkgTimeout
=
1e8
)
func
main
()
{
flag
.
Parse
()
...
...
@@ -80,9 +82,9 @@ func main() {
)
var
tmpSession
getty
.
Session
var
NewHelloClientSession
=
func
(
session
getty
.
Session
)
(
err
error
)
{
var
pkgHandler
=
&
PackageHandler
{}
var
EventListener
=
&
MessageHandler
{}
NewHelloClientSession
:
=
func
(
session
getty
.
Session
)
(
err
error
)
{
pkgHandler
:
=
&
PackageHandler
{}
EventListener
:
=
&
MessageHandler
{}
EventListener
.
SessionOnOpen
=
func
(
session
getty
.
Session
)
{
tmpSession
=
session
...
...
@@ -173,7 +175,6 @@ func main() {
log
.
Printf
(
"throughput (TPS) : %d
\n
"
,
int64
(
n
*
m
)
*
1000
/
totalT
)
log
.
Printf
(
"mean: %.f ns, median: %.f ns, max: %.f ns, min: %.f ns, p99: %.f ns
\n
"
,
mean
,
median
,
max
,
min
,
p99
)
log
.
Printf
(
"mean: %d ms, median: %d ms, max: %d ms, min: %d ms, p99: %d ms
\n
"
,
int64
(
mean
/
1000000
),
int64
(
median
/
1000000
),
int64
(
max
/
1000000
),
int64
(
min
/
1000000
),
int64
(
p99
/
1000000
))
}
type
MessageHandler
struct
{
...
...
benchmark/loop_client/main.go
View file @
87189d12
...
...
@@ -45,8 +45,10 @@ var (
var
taskPool
gxsync
.
GenericTaskPool
const
CronPeriod
=
20e9
const
WritePkgTimeout
=
1e8
const
(
CronPeriod
=
20e9
WritePkgTimeout
=
1e8
)
func
main
()
{
flag
.
Parse
()
...
...
@@ -63,9 +65,9 @@ func main() {
)
var
tmpSession
getty
.
Session
var
NewHelloClientSession
=
func
(
session
getty
.
Session
)
(
err
error
)
{
var
pkgHandler
=
&
PackageHandler
{}
var
EventListener
=
&
MessageHandler
{}
NewHelloClientSession
:
=
func
(
session
getty
.
Session
)
(
err
error
)
{
pkgHandler
:
=
&
PackageHandler
{}
EventListener
:
=
&
MessageHandler
{}
EventListener
.
SessionOnOpen
=
func
(
session
getty
.
Session
)
{
tmpSession
=
session
...
...
benchmark/server/main.go
View file @
87189d12
...
...
@@ -43,9 +43,7 @@ var (
pprofPort
=
flag
.
Int
(
"pprof_port"
,
65432
,
"pprof http port"
)
)
var
(
taskPool
gxsync
.
GenericTaskPool
)
var
taskPool
gxsync
.
GenericTaskPool
const
CronPeriod
=
20e9
...
...
@@ -75,8 +73,8 @@ func main() {
}
func
NewHelloServerSession
(
session
getty
.
Session
)
(
err
error
)
{
var
pkgHandler
=
&
PackageHandler
{}
var
EventListener
=
&
MessageHandler
{}
pkgHandler
:
=
&
PackageHandler
{}
EventListener
:
=
&
MessageHandler
{}
tcpConn
,
ok
:=
session
.
Conn
()
.
(
*
net
.
TCPConn
)
if
!
ok
{
...
...
connection.go
View file @
87189d12
...
...
@@ -34,17 +34,13 @@ import (
uatomic
"go.uber.org/atomic"
)
var
(
launchTime
=
time
.
Now
()
)
var
launchTime
=
time
.
Now
()
/////////////////////////////////////////
// getty connection
/////////////////////////////////////////
var
(
connID
uatomic
.
Uint32
)
var
connID
uatomic
.
Uint32
type
gettyConn
struct
{
id
uint32
...
...
session.go
View file @
87189d12
...
...
@@ -58,9 +58,7 @@ const (
// session
/////////////////////////////////////////
var
(
defaultTimerWheel
*
gxtime
.
TimerWheel
)
var
defaultTimerWheel
*
gxtime
.
TimerWheel
func
init
()
{
gxtime
.
InitDefaultTimerWheel
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment