Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
apachedex
Commits
8e1bd9f6
Commit
8e1bd9f6
authored
Apr 03, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use more appropriate date locators & formatters.
parent
ddb41afa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
apachedex/__init__.py
apachedex/__init__.py
+25
-9
No files found.
apachedex/__init__.py
View file @
8e1bd9f6
...
...
@@ -51,9 +51,14 @@ except ImportError:
else
:
matplotlib
.
use
(
'Agg'
)
import
matplotlib.pyplot
as
pyplot
from
matplotlib.dates
import
DateFormatter
,
DayLocator
day_formatter
=
DateFormatter
(
'%Y-%m-%d'
)
all_days
=
DayLocator
()
from
matplotlib.dates
import
(
DateFormatter
,
DayLocator
,
HourLocator
,
AutoDateLocator
,
AutoDateFormatter
,
)
MONTH_VALUE_DICT
=
dict
((
y
,
x
)
for
(
x
,
y
)
in
enumerate
((
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'Jun'
,
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
),
1
))
...
...
@@ -455,17 +460,28 @@ def main():
daily_data
=
data
.
getApdexData
()
date_list
=
[
datetime
.
strptime
(
x
[
0
],
'%Y/%m/%d'
+
{
'hour'
:
' %H'
}.
get
(
args
.
period
,
''
))
for
x
in
daily_data
]
date_range
=
date_list
[
-
1
]
-
date_list
[
0
]
if
date_range
<
timedelta
(
2
):
date_formatter
=
DateFormatter
(
'%Y-%m-%dT%H'
)
date_locator
=
HourLocator
(
interval
=
int
((
date_range
/
4
).
total_seconds
()
/
3600
))
elif
date_range
<
timedelta
(
6
):
date_formatter
=
DateFormatter
(
'%Y-%m-%d'
)
date_locator
=
DayLocator
()
else
:
date_locator
=
AutoDateLocator
()
date_formatter
=
AutoDateFormatter
(
date_locator
)
apdex_plot
=
pyplot
.
subplot
(
2
,
1
,
1
)
apdex_plot
.
xaxis
.
set_major_locator
(
all_days
)
apdex_plot
.
xaxis
.
set_major_formatter
(
da
y
_formatter
)
apdex_plot
.
xaxis
.
set_major_locator
(
date_locator
)
apdex_plot
.
xaxis
.
set_major_formatter
(
da
te
_formatter
)
pyplot
.
title
(
'Apdex'
)
pyplot
.
ylabel
(
'%'
)
pyplot
.
plot
(
date_list
,
[
x
[
1
]
for
x
in
daily_data
],
'-'
)
pyplot
.
plot
(
date_list
,
[
x
[
1
]
for
x
in
daily_data
],
'.'
)
# response_time_plot = pyplot.subplot(3, 1, 2)
# response_time_plot.xaxis.set_major_locator(
all_days
)
# response_time_plot.xaxis.set_major_formatter(da
y
_formatter)
# response_time_plot.xaxis.set_major_locator(
date_locator
)
# response_time_plot.xaxis.set_major_formatter(da
te
_formatter)
# pyplot.title('Response time')
# pyplot.ylabel('time (s)')
# pyplot.plot(date_list, [x[2] for x in daily_data], '-', label='Average')
...
...
@@ -473,8 +489,8 @@ def main():
# pyplot.legend()
hit_plot
=
pyplot
.
subplot
(
2
,
1
,
2
)
hit_plot
.
xaxis
.
set_major_locator
(
all_days
)
hit_plot
.
xaxis
.
set_major_formatter
(
da
y
_formatter
)
hit_plot
.
xaxis
.
set_major_locator
(
date_locator
)
hit_plot
.
xaxis
.
set_major_formatter
(
da
te
_formatter
)
pyplot
.
title
(
'Hits'
)
pyplot
.
plot
(
date_list
,
[
x
[
4
]
for
x
in
daily_data
],
'-'
)
pyplot
.
plot
(
date_list
,
[
x
[
4
]
for
x
in
daily_data
],
'.'
)
...
...
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