Typedef struct _binint32
{
__INT32 I32 [2];
Bigint32;
Typedef struct _bigint64
{
__INT64 I64;
} Bigint64;
Typedef union _bigint
{BIGINT32 INT32VAL;
Bigint64 INT64VAL;
} Bigint; The following code obtains the high and low position of the clock counter from the operating system, and fill in the __int64 data, respectively:
Bigint Start_Ticks, End_ticks;
_asm {
RDTSC
Mov Start_Ticks.Int32val.i32 [0], EAX
Mov Start_Ticks.Int32val.i32 [4], EDX
} RDTSC (Read Time Stamp Counter is a compilation instruction, its function is to load the contents of the timestamp counter into the EAX and EDX registers. After performing the above code, START_TICKS contains a complete clock count. Top the above code again, replace the start_ticks to end_ticks, then subtract start_ticks from end_ticks, and get the clock cycle that passes during the two calls.