/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this C++ g++ program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 10 | 0.30 | 0.30 | 288 | 593 | 0% 3% 0% 100% |
| 11 | 3.74 | 3.75 | 288 | 593 | 0% 3% 1% 100% |
| 12 | 50.57 | 50.59 | 292 | 593 | 0% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read fannkuch-redux benchmark to see what this program should do.
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
/* The Computer Language Benchmarks Game http://benchmarksgame.alioth.debian.org/ contributed by Branimir Maksimovic */ #include <cstdlib> #include <cstdio> #include <algorithm> typedef unsigned char int_t; void rotate(int_t* p, int n) { int_t tmp = p[0]; for(int i = 0; i < n; ++i)p[i]=p[i+1]; p[n] = tmp; } bool next_permutation(int_t* beg, int n, int_t* c) { int i = 1; while(i<n) { rotate(beg,i); if(c[i]>=i)c[i++]=0; else break; } if(i>=n)return false; ++c[i]; return true; } struct Result{ int checksum; int maxflips; }; Result fannkuch(int n) { Result tmp = {0}; int i=0,permcount=0; int_t perm[16],tperm[16],cnt[16]={0}; std::generate(perm,perm+n,[&i](){ return ++i; }); do { std::copy(perm,perm+n,tperm); int flips = 0; while(tperm[0] != 1) { std::reverse(tperm,tperm+tperm[0]); ++flips; } tmp.checksum += (permcount%2 == 0)?flips:-flips; tmp.maxflips = std::max(tmp.maxflips,flips); }while(++permcount,next_permutation(perm,n,cnt)); return tmp; } int main(int argc, char** argv) { int n = 7; if(argc > 1)n = atoi(argv[1]); if(n < 3 || n > 16) { printf("n should be between [3 and 16]\n"); return 0; } Result r = fannkuch(n); printf("%d\nPfannkuchen(%d) = %d\n",r.checksum,n,r.maxflips); }
Wed, 01 May 2013 21:02:06 GMT
MAKE:
/usr/bin/g++ -c -pipe -O3 -fomit-frame-pointer -march=native -std=c++0x fannkuchredux.gpp-3.c++ -o fannkuchredux.gpp-3.c++.o && \
/usr/bin/g++ fannkuchredux.gpp-3.c++.o -o fannkuchredux.gpp-3.gpp_run -lpthread
rm fannkuchredux.gpp-3.c++
0.57s to complete and log all make actions
COMMAND LINE:
./fannkuchredux.gpp-3.gpp_run 12
PROGRAM OUTPUT:
3968050
Pfannkuchen(12) = 65