File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 293
293
The profiling is activated by the ``profile`` parameter. The value provided
294
294
should be a prefix (including a possible directory) for the profile dump::
295
295
296
- sage: prof = tmp_dir('RESetMR_profile') + 'profcomp'
297
- sage: res = S.run(profile=prof) # random
296
+ sage: import tempfile
297
+ sage: d = tempfile.TemporaryDirectory(prefix="RESetMR_profile")
298
+ sage: res = S.run(profile=d.name) # random
298
299
[RESetMapReduceWorker-1:58] (20:00:41.444) Profiling in
299
300
/home/user/.sage/temp/.../32414/RESetMR_profilewRCRAx/profcomp1
300
301
...
309
310
:class:`cProfile.Profile` for more details::
310
311
311
312
sage: import cProfile, pstats
312
- sage: st = pstats.Stats(prof +'0')
313
+ sage: st = pstats.Stats(d.name +'0')
313
314
sage: st.strip_dirs().sort_stats('cumulative').print_stats() # random
314
315
...
315
316
Ordered by: cumulative time
320
321
...
321
322
<pstats.Stats instance at 0x7fedea40c6c8>
322
323
324
+ Like a good neighbor we clean up our temporary directory as soon as
325
+ possible::
326
+
327
+ sage: d.cleanup()
328
+
323
329
.. SEEALSO::
324
330
325
331
`The Python Profilers <https://docs.python.org/2/library/profile.html>`_
You can’t perform that action at this time.
0 commit comments