⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cacheshow.inc

📁 pipe类 pipe类 pipe类 pipe类 pipe类
💻 INC
字号:
function AssocToStr(assoc:word): ShortString;
begin
  case assoc of
    0: result:='off';
    1: result:='direct map';
    2: result:='2-way';
    4: result:='4-way';
    8: result:='8-way';
    16: result:='16-way';
    32: result:='32-way';
    255: result:='fully';
  end;
end;

procedure TMainFrm.ShowLevel1(index: byte);
var
  GroupBox: TRzGroupBox;
  i: byte;
  L1Type: ShortString;
begin
  Level2bt.Font.Color:=$00BE773D;
  Level2btB.Color:=$00FCF6F1;
  Level3bt.Font.Color:=$00BE773D;
  Level3btB.Color:=$00FCF6F1;
  for i:=1 to 6 do
    begin
      GroupBox:=FindComponent('Block'+IntToStr(i)+'GB') as TRzGroupBox;
      GroupBox.Visible:=true;
    end;
  Block1GB.Caption:='L1 Data Cache';
  if not CPUInfo[index].level1.icache.is_trace then L1Type:='Instr.'
                                               else L1Type:='Trace';
  Block2GB.Caption:='L1 '+L1Type+' Cache';
  Block3GB.Caption:='L1 Data TLB (4Kb pages)';
  Block4GB.Caption:='L1 '+L1Type+' TLB (4Kb pages)';
  Block5GB.Caption:='L1 Data TLB (2Mb pages)';
  Block6GB.Caption:='L1 '+L1Type+' TLB (2Mb pages)';

  Bl1LPT.Caption:='Lines per Tag';
  Bl1SizeV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.dcache.size)+' KBytes';
  Bl1assocV.Caption:=AssocToStr(CPUInfo[index].level1{[index]}.dcache.associativity);
  Bl1LSV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.dcache.linesize)+' Bytes';
  Bl1LPTV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.dcache.linespertag);

  Bl2SizeV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.icache.size);
  if not CPUInfo[index].level1{[index]}.icache.is_trace then Bl2SizeV.Caption:=Bl2SizeV.Caption+' KBytes'
                                               else Bl2SizeV.Caption:=Bl2SizeV.Caption+' K礝ps';
  Bl2assocV.Caption:=AssocToStr(CPUInfo[index].level1{[index]}.icache.associativity);
  Bl2LSV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.icache.linesize);
  if not CPUInfo[index].level1{[index]}.icache.is_trace then Bl2LSV.Caption:=Bl2LSV.Caption+' Bytes'
                                               else Bl2LSV.Caption:=Bl2LSV.Caption+' 礝ps';
  Bl2LPTV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.icache.linespertag);

  Bl3assocV.Caption:=AssocToStr(CPUInfo[index].level1{[index]}.dtlb.associativity_4k);
  Bl3entrV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.dtlb.entries_4k);

  Bl4assocV.Caption:=AssocToStr(CPUInfo[index].level1{[index]}.itlb.associativity_4k);
  Bl4entrV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.itlb.entries_4k);

  Bl5assocV.Caption:=AssocToStr(CPUInfo[index].level1{[index]}.dtlb.associativity_2m);
  Bl5entrV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.dtlb.entries_2m);

  Bl6assocV.Caption:=AssocToStr(CPUInfo[index].level1{[index]}.itlb.associativity_2m);
  Bl6entrV.Caption:=IntToStr(CPUInfo[index].level1{[index]}.itlb.entries_2m);
end;

procedure TMainFrm.ShowLevel2(index: byte);
var
  GroupBox: TRzGroupBox;
  i: byte;
  L1Type: ShortString;
begin
  Level1bt.Font.Color:=$00BE773D;
  Level1btB.Color:=$00FCF6F1;
  Level3bt.Font.Color:=$00BE773D;
  Level3btB.Color:=$00FCF6F1;
  for i:=1 to 6 do
    begin
      GroupBox:=FindComponent('Block'+IntToStr(i)+'GB') as TRzGroupBox;
      if i in [2] then
                    begin
                      GroupBox.Visible:=false;
                      continue;
                    end;
      GroupBox.Visible:=true;
    end;
  Block1GB.Caption:='L2 Cache';
  if not CPUInfo[index].level1{[index]}.icache.is_trace then L1Type:='Instr.'
                                               else L1Type:='Trace';
  Block3GB.Caption:='L2 Data TLB (4Kb pages)';
  Block4GB.Caption:='L2 '+L1Type+' TLB (4Kb pages)';
  Block5GB.Caption:='L2 Data TLB (2Mb pages)';
  Block6GB.Caption:='L2 '+L1Type+' TLB (2Mb pages)';

  Bl1LPT.Caption:='Lines per Tag';
  Bl1SizeV.Caption:=IntToStr(CPUInfo[index].level2{[index]}.cache.size)+' KBytes';
  Bl1assocV.Caption:=AssocToStr(CPUInfo[index].level2{[index]}.cache.associativity);
  Bl1LSV.Caption:=IntToStr(CPUInfo[index].level2{[index]}.cache.linesize)+' Bytes';
  Bl1LPTV.Caption:=IntToStr(CPUInfo[index].level2{[index]}.cache.linespertag);

  Bl3assocV.Caption:=AssocToStr(CPUInfo[index].level2{[index]}.dtlb.associativity_4k);
  Bl3entrV.Caption:=IntToStr(CPUInfo[index].level2{[index]}.dtlb.entries_4k);

  Bl4assocV.Caption:=AssocToStr(CPUInfo[index].level2{[index]}.itlb.associativity_4k);
  Bl4entrV.Caption:=IntToStr(CPUInfo[index].level2{[index]}.itlb.entries_4k);

  Bl5assocV.Caption:=AssocToStr(CPUInfo[index].level2{[index]}.dtlb.associativity_2m);
  Bl5entrV.Caption:=IntToStr(CPUInfo[index].level2{[index]}.dtlb.entries_2m);

  Bl6assocV.Caption:=AssocToStr(CPUInfo[index].level2{[index]}.itlb.associativity_2m);
  Bl6entrV.Caption:=IntToStr(CPUInfo[index].level2{[index]}.itlb.entries_2m);
end;

procedure TMainFrm.ShowLevel3(index: byte);
var
  GroupBox: TRzGroupBox;
  i: byte;
begin
  Level1bt.Font.Color:=$00BE773D;
  Level1btB.Color:=$00FCF6F1;
  Level2bt.Font.Color:=$00BE773D;
  Level2btB.Color:=$00FCF6F1;
  for i:=1 to 6 do
    begin
      GroupBox:=FindComponent('Block'+IntToStr(i)+'GB') as TRzGroupBox;
      if i in [2..6] then
                    begin
                      GroupBox.Visible:=false;
                      continue;
                    end;
      GroupBox.Visible:=true;
    end;
  Block1GB.Caption:='L3 Cache';

  Bl1LPT.Caption:='Sectors';
  Bl1SizeV.Caption:=IntToStr(CPUInfo[index].level3{[index]}.cache.size)+' KBytes';
  Bl1assocV.Caption:=AssocToStr(CPUInfo[index].level3{[index]}.cache.associativity);
  Bl1LSV.Caption:=IntToStr(CPUInfo[index].level3{[index]}.cache.linesize)+' Bytes';
  Bl1LPTV.Caption:=IntToStr(CPUInfo[index].level3{[index]}.cache.sectors);
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -