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
372309a4
Commit
372309a4
authored
Jun 30, 2021
by
georgehao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: go fmt
parent
69cc8c6f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
26 deletions
+21
-26
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
server.go
demo/hello/tls/server/server.go
+1
-1
session.go
session.go
+1
-3
No files found.
benchmark/client/main.go
View file @
372309a4
...
...
@@ -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 @
372309a4
...
...
@@ -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 @
372309a4
...
...
@@ -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 @
372309a4
...
...
@@ -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
...
...
demo/hello/tls/server/server.go
View file @
372309a4
...
...
@@ -28,8 +28,8 @@ import (
import
(
"github.com/apache/dubbo-getty"
"github.com/apache/dubbo-getty/demo/util"
tls
"github.com/apache/dubbo-getty/demo/hello/tls"
"github.com/apache/dubbo-getty/demo/util"
)
var
(
...
...
session.go
View file @
372309a4
...
...
@@ -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