Revision 618
org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/scripts/libs/timeit.py | ||
---|---|---|
1 |
import time |
|
2 |
|
|
3 |
def timeit(method): |
|
4 |
|
|
5 |
def timed(*args, **kw): |
|
6 |
ts = time.time() |
|
7 |
result = method(*args, **kw) |
|
8 |
te = time.time() |
|
9 |
|
|
10 |
print '%r (%r, %r) %2.2f sec' % \ |
|
11 |
(method.__name__, args, kw, te-ts) |
|
12 |
return result |
|
13 |
|
|
14 |
return timed |
org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/scripts/libs/timeit.inf | ||
---|---|---|
1 |
[Unit] |
|
2 |
type = Script |
|
3 |
name = timeit |
|
4 |
description = |
|
5 |
createdBy = |
|
6 |
version = |
|
7 |
|
|
8 |
[Script] |
|
9 |
main = main |
|
10 |
Lang = python |
|
11 |
|
Also available in: Unified diff