[GRASS-SVN] r58114 - grass/trunk/lib/python/pygrass/modules/interface
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Oct 28 05:35:13 PDT 2013
Author: zarch
Date: 2013-10-28 05:35:12 -0700 (Mon, 28 Oct 2013)
New Revision: 58114
Modified:
grass/trunk/lib/python/pygrass/modules/interface/module.py
Log:
Add execution time attribute to the class Module
Modified: grass/trunk/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/module.py 2013-10-28 03:18:56 UTC (rev 58113)
+++ grass/trunk/lib/python/pygrass/modules/interface/module.py 2013-10-28 12:35:12 UTC (rev 58114)
@@ -52,6 +52,7 @@
import subprocess
from itertools import izip_longest
from xml.etree.ElementTree import fromstring
+import time
from grass.pygrass.errors import GrassError, ParameterError
@@ -298,6 +299,7 @@
diz['name'] = 'stderr'
self.outputs['stderr'] = Parameter(diz=diz)
self.popen = None
+ self.time = None
if args or kargs:
self.__call__(*args, **kargs)
@@ -460,6 +462,7 @@
if self.outputs['stderr'].value:
self.stderr_ = self.outputs['stderr'].value
cmd = self.make_cmd()
+ start = time.time()
self.popen = subprocess.Popen(cmd,
stdin=self.stdin_,
stdout=self.stdout_,
@@ -469,6 +472,7 @@
stdout, stderr = self.popen.communicate(input=self.stdin)
self.outputs['stdout'].value = stdout if stdout else ''
self.outputs['stderr'].value = stderr if stderr else ''
+ self.time = time.time() - start
###############################################################################
More information about the grass-commit
mailing list