wasCSharpSQLite – Blame information for rev

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 namespace Community.CsharpSqlite
2 {
3 using sqlite_u3264 = System.UInt64;
4  
5 public partial class Sqlite3
6 {
7 /*
8 ** 2008 May 27
9 **
10 ** The author disclaims copyright to this source code. In place of
11 ** a legal notice, here is a blessing:
12 **
13 ** May you do good and not evil.
14 ** May you find forgiveness for yourself and forgive others.
15 ** May you share freely, never taking more than you give.
16 **
17 ******************************************************************************
18 **
19 ** This file contains inline asm code for retrieving "high-performance"
20 ** counters for x86 class CPUs.
21 **
22 ** $Id: hwtime.h,v 1.3 2008/08/01 14:33:15 shane Exp $
23 **
24 *************************************************************************
25 ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
26 ** C#-SQLite is an independent reimplementation of the SQLite software library
27 **
28 *************************************************************************
29 */
30  
31 static sqlite_u3264 sqlite3Hwtime()
32 {
33 return (sqlite_u3264)System.DateTime.Now.Ticks;
34 }
35  
36 // //#if !_HWTIME_H_
37 // //#define _HWTIME_H_
38 //
39 // /*
40 // ** The following routine only works on pentium-class (or newer) processors.
41 // ** It uses the RDTSC opcode to read the cycle count value out of the
42 // ** processor and returns that value. This can be used for high-res
43 // ** profiling.
44 // */
45 //#if ((__GNUC__) || (_MSC_VER)) && ((i386) || (__i386__) || (_M_IX86))
46 //
47 //#if (__GNUC__)
48 //
49 //__inline__ sqlite_u3264 sqlite3Hwtime(void){
50 //unsigned int lo, hi;
51 //__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
52 //return (sqlite_u3264)hi << 32 | lo;
53 //}
54 //
55 //#elif (_MSC_VER)
56 //
57 //__declspec(naked) __inline sqlite_u3264 __cdecl sqlite3Hwtime(void){
58 //__asm {
59 //rdtsc
60 //ret ; return value at EDX:EAX
61 //}
62 //}
63 //
64 //#endif
65 //
66 //#elif ((__GNUC__) && (__x86_64__))
67 //
68 //__inline__ sqlite_u3264 sqlite3Hwtime(void){
69 //unsigned long val;
70 //__asm__ __volatile__ ("rdtsc" : "=A" (val));
71 //return val;
72 //}
73 //
74 //#elif ( (__GNUC__) && (__ppc__))
75 //
76 //__inline__ sqlite_u3264 sqlite3Hwtime(void){
77 //unsigned long long retval;
78 //unsigned long junk;
79 //__asm__ __volatile__ ("\n\
80 //1: mftbu %1\n\
81 //mftb %L0\n\
82 //mftbu %0\n\
83 //cmpw %0,%1\n\
84 //bne 1b"
85 //: "=r" (retval), "=r" (junk));
86 //return retval;
87 //}
88 //
89 //#else
90 //
91 // //#error Need implementation of sqlite3Hwtime() for your platform.
92 //
93 // /*
94 // ** To compile without implementing sqlite3Hwtime() for your platform,
95 // ** you can remove the above #error and use the following
96 // ** stub function. You will lose timing support for many
97 // ** of the debugging and testing utilities, but it should at
98 // ** least compile and run.
99 // */
100 // static sqlite_u3264 sqlite3Hwtime()
101 // { (sqlite_u3264)0 ); }
102 //
103 //#endif
104 //
105 // //#endif //* !_HWTIME_H_) */
106 }
107 }