~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to intern/opennl/superlu/superlu_timer.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Purpose
 
3
 * ======= 
 
4
 *      Returns the time in seconds used by the process.
 
5
 *
 
6
 * Note: the timer function call is machine dependent. Use conditional
 
7
 *       compilation to choose the appropriate function.
 
8
 *
 
9
 */
 
10
 
 
11
/* We want this flag, safer than putting in build system */
 
12
#define NO_TIMER
 
13
 
 
14
double  SuperLU_timer_ ();
 
15
 
 
16
#ifdef SUN 
 
17
/*
 
18
 *      It uses the system call gethrtime(3C), which is accurate to 
 
19
 *      nanoseconds. 
 
20
*/
 
21
#include <sys/time.h>
 
22
 
 
23
double SuperLU_timer_() {
 
24
    return ( (double)gethrtime() / 1e9 );
 
25
}
 
26
 
 
27
#else
 
28
 
 
29
#ifndef NO_TIMER
 
30
#include <sys/types.h>
 
31
#include <sys/times.h>
 
32
#include <time.h>
 
33
#include <sys/time.h>
 
34
#endif
 
35
 
 
36
#ifndef CLK_TCK
 
37
#define CLK_TCK 60
 
38
#endif
 
39
double SuperLU_timer_(void);
 
40
 
 
41
double SuperLU_timer_(void)
 
42
{
 
43
#ifdef NO_TIMER
 
44
    /* no sys/times.h on WIN32 */
 
45
    double tmp;
 
46
    tmp = 0.0;
 
47
#else
 
48
    struct tms use;
 
49
    double tmp;
 
50
    times(&use);
 
51
    tmp = use.tms_utime;
 
52
    tmp += use.tms_stime;
 
53
#endif
 
54
    return (double)(tmp) / CLK_TCK;
 
55
}
 
56
 
 
57
#endif
 
58