diff --git a/tests/ansible/bench/loop-100-copies.yml b/tests/ansible/bench/loop-100-copies.yml new file mode 100644 index 00000000..231bf4a1 --- /dev/null +++ b/tests/ansible/bench/loop-100-copies.yml @@ -0,0 +1,25 @@ + +- hosts: all + any_errors_fatal: true + tasks: + + - name: Create file tree + connection: local + shell: > + mkdir -p /tmp/filetree.in; + for i in `seq -f /tmp/filetree.in/%g 1 100`; do echo $RANDOM > $i; done; + + - name: Delete remote file tree + file: path=/tmp/filetree.out state=absent + when: 0 + + - file: + state: directory + path: /tmp/filetree.out + + - name: Trigger nasty process pileup + copy: + src: "{{item.src}}" + dest: "/tmp/filetree.out/{{item.path}}" + with_filetree: /tmp/filetree.in + when: item.state == 'file' diff --git a/tests/ansible/tests/__init__.py b/tests/ansible/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/bench/README.md b/tests/bench/README.md new file mode 100644 index 00000000..0ef27df3 --- /dev/null +++ b/tests/bench/README.md @@ -0,0 +1,5 @@ + +# tests/bench/ + +Various manually executed scripts to aid benchmarking, or trigger old +performance problems. diff --git a/tests/bench/roundtrip.py b/tests/bench/roundtrip.py index 13b9413d..7c5a9252 100644 --- a/tests/bench/roundtrip.py +++ b/tests/bench/roundtrip.py @@ -12,6 +12,6 @@ def do_nothing(): def main(router): f = router.fork() t0 = time.time() - for x in xrange(10000): + for x in range(1000): f.call(do_nothing) print '++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec' diff --git a/tests/bench/service.py b/tests/bench/service.py new file mode 100644 index 00000000..6d866b5c --- /dev/null +++ b/tests/bench/service.py @@ -0,0 +1,23 @@ +""" +Measure latency of local service RPC. +""" + +import time + +import mitogen.service +import mitogen + + +class MyService(mitogen.service.Service): + @mitogen.service.expose(policy=mitogen.service.AllowParents()) + def ping(self): + return 'pong' + + +@mitogen.main() +def main(router): + f = router.fork() + t0 = time.time() + for x in range(1000): + f.call_service(service_name=MyService, method_name='ping') + print('++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec') diff --git a/tests/data/stubs/README.md b/tests/data/stubs/README.md index 3f9af3c8..02de6456 100644 --- a/tests/data/stubs/README.md +++ b/tests/data/stubs/README.md @@ -1,5 +1,5 @@ -# stubs/ +# tests/data/stubs/ Dummy implementations of various third party tools that just spawn local Python interpreters. Used to roughly test the tools' associated Mitogen classes.