Open jayvdb opened 6 years ago
@jayvdb The only configuration option currently triggering/used by this plugin is profile
or profile_svg
. Do you think sort_stats_by
, restrict_stats_by
, profiler_timeunit
, profiler_subcalls
and profiler_builtins
are good configuration names?
Maybe the same can be done by the order in pytest.ini.
I do not see why this should not be possible via pytest.ini
.
All args should mention profile (or maybe profiler), to avoid name clashes with other plugins.
You will find it easier to name things as you develop and run it with various settings.
Would also be very nice to be able to limit the depth of the graph, and/or exclude functions from system libraries
@jayvdb The only configuration option currently triggering/used by this plugin is
profile
orprofile_svg
.
3 years later this seems to still be the case... I had been hoping to override element_number
to get more in the test report but I have not been able to figure out how to do that. :(
For those still interested in this feature, it was implemented in commit 055bf70fd0fd2e0a06afb014e0ea3da16b2507da. Unfortunately it was never published to pypi.
Hi, thanks for the good suggestion and sorry for the huge delays! I'll look at adding pytest.ini / setup.cfg / pyproject.toml etc support.
I looked into commit 055bf70 as mentioned by @kronenpj last July 31. While changing the default print_stats() list length from 20 to some config element_number value is great, some means of exposing the complete set of possible restrictions for the various pstats methods would be ideal. Filtering out (or only including) symbols via the RE restriction would allow one to ignore (or focus on) those profiling results that won't be actionable (ie. I'm not really concerned with the performance of str methods or most standard library classes, functions - it is what is is. Smarter folks than I have worked quite hard to optimize those implementations). I'd rather focus on stuff I've (or project teammates) written & ought to optimize. So using various restrictions would help to do that.
@eeaston - have you done any work on this per your Nov 19, 2021 comment? The above seem like some features that I might work on, might spend more time once the EPL season wraps up? I need to investigate the means other pytest plugins use to grab their config properties from the pytest.ini/setup.cfg/ etc. files. CLI is obvious in the pytest_addoption impl. Good chance for me to learn.
There are various arguments which are available when calling
profile
andpstats
.It would be nice to be able to select those via
pytest.ini
sort: https://docs.python.org/3.6/library/profile.html#pstats.Stats.sort_stats , needs to be comma separated list.
percentage or count of lines to print
regular expression to limit names of printed functions
timeunit
,subcalls
(bool) &builtins
(bool)As percentage or count and regular expression can be in either order, it might be wiser to have that as a single config option. On the command line, the order can be derived from the arg order. Maybe the same can be done by the order in
pytest.ini
.. ?