mirror of
https://github.com/wassname/simpeg.git
synced 2026-08-11 11:26:01 +08:00
test counter utils
This commit is contained in:
@@ -51,3 +51,39 @@ Interpolation Utilities
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
Counter Utilities
|
||||
=======================
|
||||
|
||||
::
|
||||
class MyClass(object):
|
||||
def __init__(self, url):
|
||||
self.counter = Counter()
|
||||
|
||||
@count
|
||||
def MyMethod(self):
|
||||
pass
|
||||
|
||||
@timeIt
|
||||
def MySecondMethod(self):
|
||||
pass
|
||||
|
||||
c = MyClass('blah')
|
||||
for i in range(100): c.MyMethod()
|
||||
for i in range(300): c.MySecondMethod()
|
||||
c.counter.summary()
|
||||
|
||||
::
|
||||
|
||||
Counters:
|
||||
MyClass.MyMethod : 100
|
||||
|
||||
Times: mean sum
|
||||
MyClass.MySecondMethod : 1.70e-06, 5.10e-04, 300x
|
||||
|
||||
The API
|
||||
-------
|
||||
|
||||
.. automodule:: SimPEG.Utils.CounterUtils
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user