国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

取得自從開機到現在CPU運行的周期數,超毫秒級的精度

2019-11-18 18:43:02
字體:
來源:轉載
供稿:網友

取得自從開機到現在CPU運行的周期數,超毫秒級的精度
function Ticker : DWord; register;
begin
  asm
          push EAX
          push EDX
          db $0f,$31
          mov Result, EAX
          pop EDX
          pop EAX
  end;
end;

PRocedure TForm1.Button1Click(Sender: TObject);
begin
 showmessage(inttostr( Ticker));
end;

//rock
//轉載請保留此信息


相關文章
對該文的評論
black_fox ( 2002-08-23)
貼老外的貼子。異曲同共之妙。。。
const
  D32               = $66;

function RDTSC: comp;
var
  TimeStamp         : record
    case byte of
      1: (Whole: comp);
      2: (Lo, Hi: LongInt);
  end;
begin
  asm
db $0F; db $31; {BASM doesn't support RDTSC}
        {Pentium RDTSC - Read Time Stamp Counter - instruction}
{$ifdef Cpu386}
mov [TimeStamp.Lo],eax // the low dword
mov [TimeStamp.Hi],edx // the high dword
{$else}
db D32
mov word ptr TimeStamp.Lo,AX
        {mov [TimeStamp.Lo],eax - the low dword}
db D32
mov word ptr TimeStamp.Hi,DX
        {mov [TimeStamp.Hi],edx - the high dword}
{$endif}
  end;
  Result := TimeStamp.Whole;
end;


type
  CompStr = string[25];
  {Comps have up to 18 digits, plus commas, and sign}

function CompToStr(N: comp): CompStr;
var
  Low3              : string[3];
  N1                : extended;
begin
  if N < 0
    then Result := '-' + CompToStr(-N)
  else begin
      N1 := N / 1000;
      Str(Round(Frac(N1) * 1000), Low3);
      N := Int(N1);
      if N > 0
        then begin
          while Length(Low3) < 3 do Low3 := '0' + Low3;
          Result := CompToStr(N) + ThousandSeparator + Low3;
        end
      else Result := Low3
    end;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
//showmessage(inttostr( Ticker));
  memo1.Lines.Add(CompToStr(RDTSC));
end;

上一篇:取得某一dll所有輸出函數名

下一篇:提取win98上網密碼

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
學習交流
熱門圖片

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 临西县| 阿瓦提县| 凤冈县| 宜都市| 开鲁县| 白银市| 沿河| 武陟县| 修文县| 元阳县| 都安| 蒙城县| 浑源县| 平乐县| 凌海市| 汉寿县| 榆中县| 江阴市| 海盐县| 新竹县| 平果县| 扬州市| 沈阳市| 临潭县| 盈江县| 北票市| 台江县| 搜索| 信阳市| 全州县| 元江| 福贡县| 彭州市| 肥东县| 汉源县| 咸阳市| 屯门区| 赞皇县| 民县| 浙江省| 开阳县|