You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot find an option to not print all the lines, but say only the first 500.
I'm trying:
stats=yappi.get_func_stats().sort("ttot")
# keep only the first 500 linesstats=stats[:500] # BUT THIS CONVERTS stats TO A LIST, SO print_all WILL NOT WORKstats.print_all()
The solution is actually quite easy, something like this:
defprint_all(
self,
out=sys.stdout,
columns={0: ("name", 36), 1: ("ncall", 5), 2: ("tsub", 8), 3: ("ttot", 8), 4: ("tavg", 8)},
N: int=None,
):
""" Prints all of the function profiler results to a given file. (stdout by default) """ifself.empty():
returnfor_, colincolumns.items():
_validate_columns(col[0], COLUMNS_FUNCSTATS)
out.write(LINESEP)
out.write(f"Clock type: {self._clock_type.upper()}")
out.write(LINESEP)
out.write(f"Ordered by: {self._sort_type}, {self._sort_order}")
out.write(LINESEP)
out.write(LINESEP)
self._print_header(out, columns)
fori, statinenumerate(self):
ifNisnotNoneandi>=N:
breakstat._print(out, columns)
The text was updated successfully, but these errors were encountered:
I cannot find an option to not print all the lines, but say only the first 500.
I'm trying:
The solution is actually quite easy, something like this:
The text was updated successfully, but these errors were encountered: