FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pyt/profiling/profiling_runner.py at 8githubScanRefactor · python-security/pyt · GitHub
python-security
pyt
Repository navigation
Code
Issues
26
(26)
Pull requests
2
(2)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pyt
/
profiling
/
profiling_runner.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (30 loc) · 1.2 KB
Breadcrumbs
pyt
/
profiling
/
profiling_runner.py
Copy path
File metadata and controls
38 lines (30 loc) · 1.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Runs the profiler everytime travis is building.
Saves the result for future reference.
"""
from
datetime
import
datetime
from
shutil
import
which
from
subprocess
import
Popen
FIXED_POINT_FLAG
=
'-fp'
KERNPROF
=
'kernprof-3.5'
PROFILER
=
'profiler.py'
PROFILING_DB
=
'db.txt'
TEST_PROJECT_1
=
'test_projects/flaskbb_lite_1/flaskbb/app.py'
TEST_PROJECT_2
=
'test_projects/flaskbb_lite_2/flaskbb/app.py'
TEST_PROJECT_3
=
'test_projects/flaskbb_lite_3/flaskbb/app.py'
TEST_PROJECTS
=
[
TEST_PROJECT_1
,
TEST_PROJECT_2
,
TEST_PROJECT_3
]
TRAVIS_PYTHON
=
'python'
if
which
(
KERNPROF
)
is
None
:
print
(
'You need "kernprof" to run this script. Install: "pip3 install line_profiler".'
)
exit
(
1
)
with
open
(
PROFILING_DB
,
'a'
)
as
fd
:
fd
.
write
(
'############################################### Profiling
\
{} ###############################################
\n
\n
'
.
format
(
datetime
.
now
()))
for
tp
in
TEST_PROJECTS
:
print
(
'Profiling: '
,
tp
)
with
open
(
PROFILING_DB
,
'a'
)
as
fd
:
fd
.
write
(
'##### Profiling {} #####
\n
\n
'
.
format
(
tp
))
with
open
(
PROFILING_DB
,
'a'
)
as
fd
:
p
=
Popen
([
'python3'
,
PROFILER
,
tp
,
FIXED_POINT_FLAG
],
stdout
=
fd
)
p
.
wait
()
with
open
(
PROFILING_DB
,
'a'
)
as
fd
:
fd
.
write
(
'
\n
'
)
Back
|
FazBrowse Home
|
New Git URL