Script edna_analyse_profile_py
[hide private]
[frames] | no frames]

Source Code for Script script-edna_analyse_profile_py

 1  #!/usr/bin/env python 
 2  #-*- coding: UTF8 -*- 
 3  # 
 4  #    Project: The EDNA Kernel 
 5  #             http://www.edna-site.org 
 6  # 
 7  #    File: "$Id$" 
 8  # 
 9  #    Copyright (C) 2008-2010 European Synchrotron Radiation Facility 
10  #                            Grenoble, France 
11  # 
12  #    Principal authors: Jérôme Kieffer (Jerome.Kieffer@esrf.fr) 
13  # 
14  #    This program is free software: you can redistribute it and/or modify 
15  #    it under the terms of the GNU Lesser General Public License as published 
16  #    by the Free Software Foundation, either version 3 of the License, or 
17  #    (at your option) any later version. 
18  # 
19  #    This program is distributed in the hope that it will be useful, 
20  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
21  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
22  #    GNU Lesser General Public License for more details. 
23  # 
24  #    You should have received a copy of the GNU General Public License 
25  #    and the GNU Lesser General Public License  along with this program.   
26  #    If not, see <http://www.gnu.org/licenses/>. 
27   
28  __author__ = "Jerome Kieffer" 
29  __contact__ = "Jerome.Kieffer@esrf.fr" 
30  __license__ = "GPLv3" 
31  __date__ = "2010-02-02" 
32  __copyright__ = "ESRF" 
33   
34   
35  import pstats   as PyPstats 
36  import sys      as PySys 
37  import os       as PyOs 
38   
39  print "We are currently running python %s" % PySys.version 
40   
41  filename = 'profile.log' 
42  for i in PySys.argv[1:]: 
43      if PyOs.path.isfile(i): filename = i 
44   
45  if PyOs.path.isfile(filename): 
46      p = PyPstats.Stats(filename) 
47      p.sort_stats('time').print_stats(100) 
48