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
Sebastien Robin
apachedex
Commits
61598f8f
Commit
61598f8f
authored
Apr 18, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --period halfday and --period halfhour
parent
57731c74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
apachedex/__init__.py
apachedex/__init__.py
+53
-0
No files found.
apachedex/__init__.py
View file @
61598f8f
...
...
@@ -121,6 +121,13 @@ ITEMGETTER0 = itemgetter(0)
ITEMGETTER1
=
itemgetter
(
1
)
APDEX_TOLERATING_COEF
=
4
AUTO_PERIOD_COEF
=
200
# X -> Y: Z Switch from period X to Y after Z periods
# quarter -> year: 15 quarters (3.75 years)
# month -> quarter: 6.5 months
# week -> month: 7.14 weeks (50 days)
# day -> week: 8.3 days
# halfday -> day: 8.2 halfdays (100 hours, 4.1 days)
# halfhour -> halfday: 6.6 halfhours (200 minutes)
# Larger (x < LARGER_THAN_INTEGER_STR == True) than any string starting with
# a number
...
...
@@ -940,6 +947,27 @@ def _asHourString(timestamp):
day
,
month
,
year
=
dt_date
.
split
(
'/'
)
return
'%s/%02i/%s %s'
%
(
year
,
MONTH_VALUE_DICT
[
month
],
day
,
hour
)
def
_asHalfDayString
(
timestamp
):
prefix
,
_
=
timestamp
.
rsplit
(
':'
,
1
)
prefix
,
hours
=
prefix
.
split
(
' '
)
return
'%s %02i'
%
(
prefix
,
int
(
hours
)
//
12
*
12
)
def
_as30MinutesString
(
timestamp
):
dt
,
_
=
timestamp
.
split
(
' '
)
dt_date
,
hour
,
minute
,
_
=
dt
.
split
(
':'
,
3
)
day
,
month
,
year
=
dt_date
.
split
(
'/'
)
return
'%s/%02i/%s %s:%02i'
%
(
year
,
MONTH_VALUE_DICT
[
month
],
day
,
hour
,
int
(
minute
)
//
30
*
30
)
def
_asMinuteString
(
timestamp
):
dt
,
_
=
timestamp
.
split
(
' '
)
dt_date
,
hour
,
minute
,
_
=
dt
.
split
(
':'
,
3
)
day
,
month
,
year
=
dt_date
.
split
(
'/'
)
return
'%s/%02i/%s %s:%s'
%
(
year
,
MONTH_VALUE_DICT
[
month
],
day
,
hour
,
minute
)
def
_asHalfHourString
(
timestamp
):
prefix
,
minute
=
timestamp
.
rsplit
(
':'
,
1
)
return
'%s:%02i'
%
(
prefix
,
int
(
minute
)
//
30
*
30
)
# Key: argument (represents table granularity)
# Value:
# - cheap conversion from apache date format to graph granularity
...
...
@@ -958,6 +986,7 @@ def _asHourString(timestamp):
# than what it should be.
period_parser
=
{
'year'
:
(
# graph/table ratio: 12
_asMonthString
,
lambda
x
:
x
.
split
(
'/'
,
1
)[
0
],
'month'
,
...
...
@@ -969,6 +998,7 @@ period_parser = {
lambda
x
:
31.
/
calendar
.
monthrange
(
x
.
year
,
x
.
month
)[
1
],
),
'quarter'
:
(
# graph/table ratio: 13(.2)
_asWeekString
,
_weekStringAsQuarterString
,
# Note: Not calendar weeks, but chunks of 7 days starting on first year's
...
...
@@ -981,6 +1011,7 @@ period_parser = {
_getWeekCoefficient
,
),
'month'
:
(
# graph/table ratio: 31
_asDayString
,
lambda
x
:
'/'
.
join
(
x
.
split
(
'/'
,
2
)[:
2
]),
'day'
,
...
...
@@ -992,6 +1023,7 @@ period_parser = {
lambda
x
:
1
,
),
'week'
:
(
# graph/table ratio: 28
_as6HourString
,
_hourAsWeekString
,
'6 hours'
,
...
...
@@ -1002,6 +1034,7 @@ period_parser = {
lambda
x
:
1
,
),
'day'
:
(
# graph/table ratio: 24
_asHourString
,
lambda
x
:
x
.
split
(
' '
)[
0
],
'hour'
,
...
...
@@ -1012,6 +1045,26 @@ period_parser = {
# Error margin without correction: (leap) 1/3600 = .03%
lambda
x
:
1
,
),
'halfday'
:
(
# graph/table ratio: 24
_as30MinutesString
,
_asHalfDayString
,
'30 minutes'
,
'%Y/%m/%d %H:%M'
,
timedelta
(
seconds
=
30
*
60
),
lambda
x
:
x
.
replace
(
minute
=
x
.
minute
//
30
*
30
),
lambda
x
:
1
,
),
'halfhour'
:
(
# graph/table ratio: 30
_asMinuteString
,
_asHalfHourString
,
'minute'
,
'%Y/%m/%d %H:%M'
,
timedelta
(
seconds
=
60
),
lambda
x
:
x
,
lambda
x
:
1
,
),
}
apdex_y_scale_dict
=
{
...
...
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