Commit 52ca0798 authored by Linus Pithan's avatar Linus Pithan

add pytest-profiling dependency and use it in tests (except master)

parent 138f1fac
Pipeline #10229 passed with stages
in 81 minutes and 4 seconds
......@@ -25,3 +25,4 @@ htmlcov/
.vscode/*
*.so
bliss/release.py
prof
......@@ -24,9 +24,13 @@ tests:
# create test env and install BLISS
- conda create --quiet --name testenv --channel http://bcu-ci.esrf.fr/stable --channel defaults --channel conda-forge python=3 --file requirements-conda.txt --file requirements-test-conda.txt
- source activate testenv
- pip install git+https://github.com/manahl/pytest-plugins#subdirectory=pytest-profiling
- pip install .
script:
- "(if ! (git diff --name-only $(git merge-base HEAD origin/master) | grep -E '.py|requirements'); then echo 'Nothing to do' ;else (python setup.py test --addopts '--cov bliss --cov-report html --cov-report term --durations=20' );fi)"
- "(if ! (git diff --name-only $(git merge-base HEAD origin/master) | grep -E '.py|requirements'); then echo 'Nothing to do' ;else (python setup.py test --addopts '--cov bliss --cov-report html --cov-report term --profile --durations=30' );fi)"
after_script:
- python scripts/profining2txt.py
- sh scripts/print_test_profiling.sh
except:
- master
......
......@@ -655,6 +655,3 @@ class calc_motor_mockup(CalcController):
real_pos = positions_dict["calc_mot"] / s_param
return {"real_mot": real_pos}
# a fake change
#!/bin/sh
echo ""
echo ""
echo "========================== profiler statistics ==========================="
echo ""
head -n4 prof/combined.txt
echo ""
echo "========================== most time consuming (top 30) ==========================="
echo ""
head -n7 prof/combined.txt |tail -n 1
cat prof/combined.txt | grep '/bliss/' | sort -g -rk4 | head -n 30
echo ""
echo ""
echo "========================== most time consuming per call (top 30) ==========================="
echo ""
head -n7 prof/combined.txt |tail -n 1
cat prof/combined.txt | grep '/bliss/bliss/bliss/' | sort -g -rk5 | head -n 30
import pstats
with open("prof/combined.txt", "w") as f:
stats = pstats.Stats("prof/combined.prof", stream=f)
stats.print_stats()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment