annotate TaskManager/Fifo/gettime.h @ 2041:363b7c401c79 draft

Make Rendefing Engine
author Shin,ichi Uehara
date Mon, 23 Mar 2015 17:47:12 +0900
parents e9dc25836520
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1400
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #ifndef GETTIME_H_
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #define GETTIME_H_
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include <time.h>
1401
2187bd10f16d remove mail_write_queue
sugi
parents: 1400
diff changeset
5 #ifdef __APPLE__
1698
7673e2ad2623 fix profile
kkb
parents: 1517
diff changeset
6 #include "rdtsc.h"
1401
2187bd10f16d remove mail_write_queue
sugi
parents: 1400
diff changeset
7 #endif
1698
7673e2ad2623 fix profile
kkb
parents: 1517
diff changeset
8
1400
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 inline unsigned long long gettime() {
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
1517
411401d1cb71 remove minor warning.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1401
diff changeset
11 unsigned long long time = 0;
1400
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 #ifndef __APPLE__
1698
7673e2ad2623 fix profile
kkb
parents: 1517
diff changeset
13 struct timespec ts;
1400
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 clock_gettime(CLOCK_REALTIME, &ts);
1698
7673e2ad2623 fix profile
kkb
parents: 1517
diff changeset
15 time = ((ts.tv_sec << 32) | ts.tv_nsec );
1400
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 #else
1698
7673e2ad2623 fix profile
kkb
parents: 1517
diff changeset
17 time = rdtsc();
1400
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 #endif
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 return time;
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 }
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
3152bb4429da add gettime
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #endif