mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-14 22:38:46 +00:00
Update skeleton
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
int fibo(int x) {
|
||||
if (x < 2) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return fibo(x - 1) + fibo(x - 2);
|
||||
}
|
||||
|
||||
int job() {
|
||||
return fibo(25);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
unsigned long read_cycles()
|
||||
{
|
||||
unsigned long cycles;
|
||||
asm volatile ("rdcycle %0" : "=r" (cycles));
|
||||
return cycles;
|
||||
}
|
||||
|
||||
extern int job();
|
||||
|
||||
int main() {
|
||||
unsigned long start, end;
|
||||
int answer;
|
||||
|
||||
start = read_cycles();
|
||||
answer = job();
|
||||
end = read_cycles();
|
||||
|
||||
printf("cycles: %lu\n", end - start);
|
||||
printf("answer: %d\n", answer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ int g_a[5] = {1, 2, 3};
|
||||
|
||||
int main() {
|
||||
int init = 1;
|
||||
int a[5] = {init, 2, 3, 4, -5, 6};
|
||||
int a[5] = {init, 2, 3, 4, -5};
|
||||
int sum = 0;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
|
||||
Reference in New Issue
Block a user