2013/11/25 Jim Jewett <jimjjew...@gmail.com>: > Why are these functions (get_traces and get_object_traceback) private?
_get_object_traceback() is wrapped to get a nice Python object: http://hg.python.org/cpython/file/6ec6facb69ca/Lib/tracemalloc.py#l208 _get_traces() is private, it is used internally by take_snapshot(): http://hg.python.org/cpython/file/6ec6facb69ca/Lib/tracemalloc.py#l455 So it's possible to modify the low-level (private) structure used in the C module without touching the high-level (public) Python API. > (1) Is the whole module provisional? At one point, I had thought so, but I > don't see that in the PEP or implementation. (I'm not sure that it should > be provisional, but I want to be sure that the decision is intentional.) I don't know. > (2) This implementation does lock in certain choices about the nature of > traces. (What data to include for analysis vs excluding to save memory; > which events are tracked separately and which combined into a single total; > organizing the data that is saved in a hash by certain keys; etc) > > While I would prefer more flexibility, the existing code provides a > reasonable default, and I can't forsee changing traces so much that these > functions *can't* be reasonably supported unless the rest of the module API > changes too. Sorry, I don't see which kind of information is "excluded" to save memory. Maybe you read an old version of the PEP? About "events": tracemalloc doesn't store functions calls as event, there is no timestamp. I didn't try to implement that, and I doesn't want to. If you develop it (maybe on top of tracemalloc, I mean by modify _tracemalloc.c), I would be interested to see your code and test it :-) > (3) get_object_traceback is the killer app that justifies the specific > data-collection choices Victor made; if it isn't public, the implementation > starts to look overbuilt. It is public, see the doc and the doc: http://docs.python.org/dev/library/tracemalloc.html#tracemalloc.get_object_traceback http://www.python.org/dev/peps/pep-0454/ > (4) get_traces is about the only way to get at even the all the data that > *is* stored, prior to additional summarization. If it isn't public, those > default summarization options become even more locked in.. Snapshot.traces contains exactly the same data than _get_traces(). In a previous version of the PEP/code, statistics were computed while traces were collected. It's not more the case. Now the API only collect raw data, and then you have call to Snapshot.statistics() or Snapshot.compare_to(). Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com