Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
energy
bmon
Commits
c4f21512
Commit
c4f21512
authored
Feb 04, 2015
by
Alan Mitchell
Browse files
Added Load and DB Size info to Report Results
To get server info for performance testing recording.
parent
8576c661
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
bmsapp/views.py
bmsapp/views.py
+8
-0
No files found.
bmsapp/views.py
View file @
c4f21512
# Create your views here.
import
sys
,
logging
,
json
,
random
,
time
import
os
import
subprocess
from
django.http
import
HttpResponse
from
django.shortcuts
import
render_to_response
,
redirect
...
...
@@ -86,6 +88,12 @@ def get_report_results(request):
# Make the chart object
chart_obj
=
basechart
.
get_chart_object
(
request
.
GET
)
result
=
chart_obj
.
result
()
# add some info about load and size of the database
dbsize
=
os
.
path
.
getsize
(
chart_obj
.
reading_db
.
db_fname
)
loads
=
subprocess
.
check_output
(
'uptime'
).
split
(
':'
)[
-
1
].
split
(
','
)
loads
=
[
float
(
ld
)
for
ld
in
loads
]
result
[
'objects'
]
=
result
[
'objects'
].
append
(
(
'stats'
,
{
'dbsize'
:
dbsize
,
'loads'
:
loads
})
)
except
:
_logger
.
exception
(
'Error in get_report_results'
)
...
...
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