2 # Copyright (C) 2004 José Matos <jamatos@lyx.org>
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 # We need all this because lyx2lyx does not have the .py termination
21 lyx2lyx = imp.load_source("lyx2lyx", "lyx2lyx", open("lyx2lyx"))
23 # Profiler used in the study
24 import hotshot, hotshot.stats
30 This program profiles lyx2lyx.
32 ./profiling.py option_to_lyx2lyx
35 ./profiling.py -ou.lyx ../doc/UserGuide.lyx
40 # This will only work with python >= 2.2, the version where this module was added
41 prof = hotshot.Profile("lyx2lyx.prof") # Use temporary file, here?
42 benchtime = prof.runcall(lyx2lyx.main)
45 # After the tests, show the profile analysis.
46 stats = hotshot.stats.load("lyx2lyx.prof")
48 stats.sort_stats("time", "calls")
51 os.unlink("lyx2lyx.prof")
54 if __name__ == "__main__":