dest="nomemory",
help="Don't run memory profiling tests",
)
+ make_option(
+ "--profile-sort",
+ type="string",
+ default="cumulative",
+ dest="profilesort",
+ help="Type of sort for profiling standard output",
+ )
make_option(
"--postgresql-templatedb",
type="string",
from sqlalchemy.testing import profiling
profiling._profile_stats = profiling.ProfileStatsFile(
- file_config.get("sqla_testing", "profile_file")
+ file_config.get("sqla_testing", "profile_file"),
+ sort=options.profilesort,
)
"""
- def __init__(self, filename):
+ def __init__(self, filename, sort="cumulative"):
self.force_write = (
config.options is not None and config.options.force_write_profiles
)
self.data = collections.defaultdict(
lambda: collections.defaultdict(dict)
)
+ self.sort = sort
self._read()
if self.write:
# rewrite for the case where features changed,
line_no, expected_count = expected
print(("Pstats calls: %d Expected %s" % (callcount, expected_count)))
- stats.sort_stats("cumulative")
+ stats.sort_stats(_profile_stats.sort)
stats.print_stats()
if _profile_stats.force_write: