~logan/ubuntu/trusty/suitesparse/4.2.1-3ubuntu1

« back to all changes in this revision

Viewing changes to KLU/Demo/dsecnd.c

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2007-05-29 09:36:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529093629-zowquo0b7slkk6nc
Tags: 3.0.0-2
* suitesparse builds properly twice in a row
* Bug fix: "suitesparse - FTBFS: Broken build depens: libgfortran1-dev",
  thanks to Bastian Blank (Closes: #426349).
* Bug fix: "suitesparse_3.0.0-1: FTBFS: build-depends on
  libgfortran1-dev", thanks to Steve Langasek (Closes: #426354).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "dsecnd.h"
2
 
 
3
 
#ifdef USE_NANOTIME
4
 
 
5
 
/* from http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IA32LinuxCluster/Doc/timing.html */
6
 
 
7
 
unsigned long long int nanotime_ia32(void)
8
 
{
9
 
    unsigned long long int val;
10
 
    __asm__ __volatile__("rdtsc" : "=A" (val) : );
11
 
    return(val);
12
 
}
13
 
 
14
 
#define SPARSE    3192963000.           /* persimmon */
15
 
/* #define SPARSE 1994171000. */        /* Dell Latitude C840 ("sparse") */
16
 
/* #define SPARSE 1395738000. */        /* IBM Thinkpad */
17
 
 
18
 
/*
19
 
static long int CPS;
20
 
static double iCPS;
21
 
static unsigned start=0;
22
 
*/
23
 
 
24
 
double dsecnd_ (void) /* Include an '_' if you will be calling from Fortan */
25
 
{
26
 
    return (((double) nanotime_ia32 ( )) / SPARSE) ;
27
 
}
28
 
 
29
 
 
30
 
#if 0
31
 
    double foo;
32
 
    if (!start)
33
 
    {
34
 
        /* CPU Clock Freq. in Hz from routine in /usr/lib/librt.a */
35
 
        /* CPS=__get_clockfreq(); */
36
 
        /* CPU Clock Freq. in Hz taken from /proc/cpuinfo */
37
 
        CPS=1994171000 ;
38
 
        iCPS=1.0/(double)CPS;
39
 
        start=1;
40
 
    }
41
 
    /* Uncomment one of the following */
42
 
    foo=iCPS*nanotime_ia32();       /* If running on IA32 machine */
43
 
    /* foo=iCPS*nanotime_ia64(); */   /* If running on IA64 machine */
44
 
 
45
 
    return(foo);
46
 
}
47
 
#endif
48
 
 
49
 
#else
50
 
 
51
 
/* generic ANSI C version */
52
 
#include <time.h>
53
 
double dsecnd_ (void)
54
 
{
55
 
    double x = clock ( ) ;
56
 
    return (x / CLOCKS_PER_SEC) ;
57
 
}
58
 
 
59
 
#endif