summaryrefslogtreecommitdiffstats
path: root/Code/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Code/Python')
-rwxr-xr-xCode/Python/func_abc.py19
-rwxr-xr-xCode/Python/func_slow.py26
2 files changed, 45 insertions, 0 deletions
diff --git a/Code/Python/func_abc.py b/Code/Python/func_abc.py
new file mode 100755
index 0000000..0d4919f
--- /dev/null
+++ b/Code/Python/func_abc.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+import time
+
+def func_c():
+ print "Function C"
+ time.sleep(1)
+
+def func_b():
+ print "Function B"
+ time.sleep(1)
+ func_c()
+
+def func_a():
+ print "Function A"
+ time.sleep(1)
+ func_b()
+
+func_a()
diff --git a/Code/Python/func_slow.py b/Code/Python/func_slow.py
new file mode 100755
index 0000000..9cba9c5
--- /dev/null
+++ b/Code/Python/func_slow.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+def func_c():
+ print "Function C"
+ i = 0
+ while (i < 3000000):
+ i = i + 1
+ j = i + 1
+
+def func_b():
+ print "Function B"
+ i = 0
+ while (i < 2000000):
+ i = i + 1
+ j = i + 1
+ func_c()
+
+def func_a():
+ print "Function A"
+ i = 0
+ while (i < 1000000):
+ i = i + 1
+ j = i + 1
+ func_b()
+
+func_a()
OpenPOWER on IntegriCloud