Timer i Linux?

Här pratar vi programmering i dessa olika former. Perl, C/C++, Pascal, ADA, Lisp, COBOL, ZX Basic och mm.
Post Reply
Pelle-48
Posts: 36
Joined: 14 June 2011, 16:04

Timer i Linux?

Post by Pelle-48 » 16 June 2011, 18:27

Hej!
Jag har kört en del benchmarks i Windows med CPP 4 från Borland. Nu undra jag vilken timer som är bäst i Linux?
Detta är fib som är kort (utan alla onödiga timers).
Någon annan som provat dessa Alburto-program?
Sim.exe är nog det enda brukar krascha i Windows.....nåt med minnesalokering?

/**********************/
/* fib.c, 02 Mar 1997 */
/* Al Aburto Jr. */
/**********************/
/***************************************************************/
/* Timer options. You MUST uncomment one of the options below */
/* or compile, for example, with the '-DUNIX' option. */
/***************************************************************/
/* #define Amiga */
/* #define UNIX */
/* #define UNIX_Old */
/* #define VMS */
/* #define BORLAND_C */
/* #define MSC */
/* #define MAC */
/* #define IPSC */
/* #define FORTRAN_SEC */
/* #define GTODay */
/* #define CTimer */
/* #define UXPM */
/* #define MAC_TMgr */
/* #define PARIX */
/* #define POSIX */
/* #define WIN32 */
/* #define POSIX1 */
/***********************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
void main(void);
unsigned long fib(long);
unsigned long fib(x)
long x;
{
if (x > 2)
return(fib(x-1)+fib(x-2));
else
return(1);
}
void main()
{
register unsigned long IMax,value;
double starttime, benchtime, dtime();
IMax = 40;
printf("\n");
printf("Fibonacci Benchmark\n");
starttime = dtime();
value = fib(IMax);
benchtime = dtime() - starttime;

printf("\n");
printf("The %02d'th Fibonacci Number is: %d\n",IMax,value);
printf("Run Time (sec) = %10.3lf\n\n",benchtime);
}
/*****************************************************/
/* Various timer routines. */

Pelle-48
Posts: 36
Joined: 14 June 2011, 16:04

Re: Timer i Linux?

Post by Pelle-48 » 19 July 2011, 11:11

Alternativet UNIX fungerar bra.

Post Reply