Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
a9b6a0b8
Commit
a9b6a0b8
authored
Nov 15, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve the output fomate
parent
2758c6da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
statistics.go
admin/statistics.go
+5
-9
No files found.
admin/statistics.go
View file @
a9b6a0b8
package
admin
import
(
"fmt"
"io"
"strconv"
"sync"
"time"
)
...
...
@@ -64,16 +64,12 @@ func (m *UrlMap) AddStatistics(requestMethod, requestUrl, requestController stri
func
(
m
*
UrlMap
)
GetMap
(
rw
io
.
Writer
)
{
m
.
lock
.
RLock
()
defer
m
.
lock
.
RUnlock
()
rw
.
Write
([]
byte
(
"requestURL avgTime"
)
)
fmt
.
Fprintf
(
rw
,
"| % -30s| % -10s | % -16s | % -16s | % -16s | % -16s | % -16s |
\n
"
,
"requestUrl"
,
"method"
,
"times"
,
"used (s)"
,
"avg used (μs)"
,
"max used (μs)"
,
"min used (μs)"
)
for
k
,
v
:=
range
m
.
urlmap
{
rw
.
Write
([]
byte
(
k
+
""
))
for
kk
,
vv
:=
range
v
{
rw
.
Write
([]
byte
(
kk
))
rw
.
Write
([]
byte
(
strconv
.
FormatInt
(
vv
.
RequestNum
,
10
)))
rw
.
Write
([]
byte
(
strconv
.
FormatInt
(
int64
(
vv
.
TotalTime
),
10
)))
rw
.
Write
([]
byte
(
strconv
.
FormatInt
(
int64
(
vv
.
MaxTime
),
10
)))
rw
.
Write
([]
byte
(
strconv
.
FormatInt
(
int64
(
vv
.
MinTime
),
10
)))
rw
.
Write
([]
byte
(
strconv
.
FormatInt
(
int64
(
vv
.
TotalTime
)
/
vv
.
RequestNum
,
10
)))
fmt
.
Fprintf
(
rw
,
"| % -30s| % -10s | % -16d | % -16f | % -16f | % -16f | % -16f |
\n
"
,
k
,
kk
,
vv
.
RequestNum
,
vv
.
TotalTime
,
vv
.
MaxTime
,
vv
.
MinTime
,
int64
(
vv
.
TotalTime
)
/
vv
.
RequestNum
,
)
}
}
}
...
...
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