Added 'profile' and 'profile-view' Make targets.

parent c6d1f38e
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
*.toc *.toc
*.synctex.gz *.synctex.gz
/build /build
core /core
.coverage /.coverage
coverage /coverage
config.mk /config.mk
/profiles
TESTS=$(wildcard tests/test_*.py) TESTS=$(wildcard tests/test_*.py)
COVERAGE_OUTPUT_DIR := coverage COVERAGE_OUTPUT_DIR := coverage
PROFILER_OUTPUT_DIR := profiles
OMIT := /usr/share/pyshared/*,/usr/lib/pymodules/python2.7/sympy/* OMIT := /usr/share/pyshared/*,/usr/lib/pymodules/python2.7/sympy/*
ifeq ($(findstring python-coverage,$(wildcard /usr/bin/*)), python-coverage) ifeq ($(findstring python-coverage,$(wildcard /usr/bin/*)), python-coverage)
...@@ -9,7 +10,8 @@ else ...@@ -9,7 +10,8 @@ else
COVERAGE=/usr/bin/coverage COVERAGE=/usr/bin/coverage
endif endif
CLEAN := $(CLEAN) $(COVERAGE_OUTPUT_DIR) CLEAN := $(CLEAN) $(COVERAGE_OUTPUT_DIR) $(PROFILER_OUTPUT_DIR)
TGT_DIR := $(TGT_DIR) $(PROFILER_OUTPUT_DIR)
.PHONY: test coverage $(TESTS) .PHONY: test coverage $(TESTS)
...@@ -43,3 +45,17 @@ ${COVERAGE}: ...@@ -43,3 +45,17 @@ ${COVERAGE}:
@echo "On Debian/Ubuntu use: sudo apt-get install python-coverage"; false @echo "On Debian/Ubuntu use: sudo apt-get install python-coverage"; false
$(TESTS): build; @python -m testrunner $@ $(TESTS): build; @python -m testrunner $@
profile-test-%: $(PROFILER_OUTPUT_DIR) build
python -m cProfile -s cumulative \
-o $(PROFILER_OUTPUT_DIR)/tests_test_$*.py.profile test.py tests/test_$*.py
profile-test-view-%: $(PROFILER_OUTPUT_DIR) build
python utils/view_profile.py "$(PROFILER_OUTPUT_DIR)/tests_test_$*.py.profile"
profile-view-%: $(PROFILER_OUTPUT_DIR) build
python utils/view_profile.py "$(PROFILER_OUTPUT_DIR)/src_$*.py.profile"
profile-%: $(PROFILER_OUTPUT_DIR) build
python -m cProfile -s cumulative \
-o $(PROFILER_OUTPUT_DIR)/src_$*.py.profile src/$*.py
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