Permalink
Browse files

adds test directory and a test for direct attach calls

1 parent 0667e71 commit b3ca8231c804d6ddef452bae6f4fc92e44df5174 shaun committed Apr 17, 2012
Showing with 39 additions and 0 deletions.
  1. +39 −0 tests/attach.py
  2. 0 attach_test.py → tests/attach_on_signal.py
View
@@ -0,0 +1,39 @@
+
+import sys
+
+sys.path = ['.'] + sys.path
+
+import time
+import gevent
+import gevent_profiler
+from gevent import monkey
+
+def eat_up_cpu():
+ for x in range(100):
+ for y in range(100):
+ z = x * y
+
+def eat_up_some_more_cpu():
+ for x in range(100):
+ for y in range(100):
+ z = x * y
+
+def task():
+ time.sleep(3)
+ eat_up_cpu()
+ eat_up_some_more_cpu()
+ print "hi!"
+
+def main():
+ monkey.patch_all()
+
+ tasks = []
+
+ gevent_profiler.attach()
+ g = gevent.spawn(eat_up_cpu)
+ g.join()
+ gevent_profiler.detach()
+
+if __name__ == "__main__":
+ main()
+
File renamed without changes.

0 comments on commit b3ca823

Please sign in to comment.