[csw-devel] SF.net SVN: gar:[12968] csw/mgar/gar/v2/lib/python/pkgdb.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Mon Jan 17 10:25:47 CET 2011
Revision: 12968
http://gar.svn.sourceforge.net/gar/?rev=12968&view=rev
Author: wahwah
Date: 2011-01-17 09:25:47 +0000 (Mon, 17 Jan 2011)
Log Message:
-----------
checkpkg: Adding a profiling option
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/pkgdb.py
Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py 2011-01-17 09:25:13 UTC (rev 12967)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py 2011-01-17 09:25:47 UTC (rev 12968)
@@ -341,6 +341,9 @@
parser.add_option("--replace", dest="replace",
default=False, action="store_true",
help="Replace packages when importing (importpkg)")
+ parser.add_option("--profile", dest="profile",
+ default=False, action="store_true",
+ help="Turn on profiling")
options, args = parser.parse_args()
if options.debug:
logging.basicConfig(level=logging.DEBUG)
@@ -545,4 +548,12 @@
if __name__ == '__main__':
- main()
+ if "--profile" in sys.argv:
+ import cProfile
+ t_str = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M")
+ home = os.environ["HOME"]
+ cprof_file_name = os.path.join(
+ home, ".checkpkg", "run-modules-%s.cprof" % t_str)
+ cProfile.run("main()", sort=1, filename=cprof_file_name)
+ else:
+ main()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list