Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'perf/org.eclipse.linuxtools.perf.swtbot.tests/resources/fibTest/fib.cpp')
-rw-r--r--perf/org.eclipse.linuxtools.perf.swtbot.tests/resources/fibTest/fib.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/perf/org.eclipse.linuxtools.perf.swtbot.tests/resources/fibTest/fib.cpp b/perf/org.eclipse.linuxtools.perf.swtbot.tests/resources/fibTest/fib.cpp
new file mode 100644
index 0000000000..2cd45e2bc3
--- /dev/null
+++ b/perf/org.eclipse.linuxtools.perf.swtbot.tests/resources/fibTest/fib.cpp
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+//#include <vector>
+
+using namespace std;
+
+long leftfib(unsigned long n);
+long rightfib(unsigned long n);
+
+long leftfib(unsigned long n) {
+ if (n <= 1) {
+ return n;
+ } else {
+ return leftfib(n-1)+rightfib(n-2);
+ }
+}
+long rightfib(unsigned long n) {
+ if (n <= 1) {
+ return n;
+ } else {
+ return leftfib(n-1)+rightfib(n-2);
+ }
+}
+
+int main(int argc, char *argv[]) {
+ //vector<int> first;
+ if (argc != 2) {
+ cout << "Not right args" << endl;
+ return 1;
+ }
+ cout << atoi(argv[1]) << endl;
+ cout << leftfib(atoi(argv[1])) << endl;
+ //cout << first.front() << endl;
+ //cout << "Hello" << endl;
+ return 0;
+}

Back to the top