| Trees | Indices | Help |
|
|---|
|
|
1 # This program is free software; you can redistribute it and/or modify
2 # it under the terms of the (LGPL) GNU Lesser General Public License as
3 # published by the Free Software Foundation; either version 3 of the
4 # License, or (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU Library Lesser General Public License for more details at
10 # ( http://www.gnu.org/licenses/lgpl.html ).
11 #
12 # You should have received a copy of the GNU Lesser General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 # written by: Jeff Ortel ( jortel@redhat.com )
16
17 """
18 The I{metrics} module defines classes and other resources
19 designed for collecting and reporting performance metrics.
20 """
21
22 import time
23 from logging import getLogger
24 from suds import *
25 from math import modf
26
27 log = getLogger(__name__)
28
30
34
39
44
47
49 if self.started == 0:
50 return 'not-running'
51 if self.started > 0 and self.stopped == 0:
52 return 'started: %d (running)' % self.started
53 duration = self.duration()
54 jmod = ( lambda m : (m[1], m[0]*1000) )
55 if duration < 1:
56 ms = (duration*1000)
57 return '%d (ms)' % ms
58 if duration < 60:
59 m = modf(duration)
60 return '%d.%.3d (seconds)' % jmod(m)
61 m = modf(duration/60)
62 return '%d.%.3d (minutes)' % jmod(m)
63
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Jun 20 03:54:30 2014 | http://epydoc.sourceforge.net |