2 # -*- coding: utf-8 -*-
4 """Run stg with profiling enabled."""
5 from __future__
import (absolute_import
, division
, print_function
,
13 # Try to detect where it is run from and set prefix and the search path.
14 # It is assumed that the user installed StGIT using the --prefix= option
15 prefix
, bin
= os
.path
.split(sys
.path
[0])
17 if bin
== 'bin' and prefix
!= sys
.prefix
:
19 sys
.exec_prefix
= prefix
21 major
, minor
= sys
.version_info
[0:2]
22 local_path
= [os
.path
.join(prefix
, 'lib', 'python'),
23 os
.path
.join(prefix
, 'lib', 'python%s.%s' % (major
, minor
)),
24 os
.path
.join(prefix
, 'lib', 'python%s.%s' % (major
, minor
),
26 sys
.path
= local_path
+ sys
.path
28 from stgit
.main
import main
31 Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
33 This program is free software; you can redistribute it and/or modify
34 it under the terms of the GNU General Public License version 2 as
35 published by the Free Software Foundation.
37 This program is distributed in the hope that it will be useful,
38 but WITHOUT ANY WARRANTY; without even the implied warranty of
39 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 GNU General Public License for more details.
42 You should have received a copy of the GNU General Public License
43 along with this program; if not, see http://www.gnu.org/licenses/.
46 if __name__
== '__main__':
47 start_time
= time
.time()
49 return time
.time() - start_time
51 prof
= profile
.Profile(timer
)
56 pstats
.Stats(prof
).strip_dirs().sort_stats(-1).print_stats().print_callees()