xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 29KB
    文件類(lèi)型: .zip
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2021-05-16
  • 語(yǔ)言: Java
  • 標(biāo)簽: cache??java??緩存技術(shù)??

資源簡(jiǎn)介

java開(kāi)發(fā)的cache模擬器,帶有界面,能夠設(shè)置 Cache、 Cache 塊的大小,能夠設(shè)置Cache 的映射機(jī)制:直接映射、n-路組相聯(lián),能夠設(shè)置 Cache 的替換策略:LRU、FIFO,能夠設(shè)置 Cache 的寫(xiě)策略:寫(xiě)回法、寫(xiě)直達(dá)法

資源截圖

代碼片段和文件信息

import?java.awt.BorderLayout;
import?java.awt.Dimension;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.ItemEvent;
import?java.awt.event.ItemListener;
import?java.io.*;
import?java.util.ArrayList;
import?java.util.List;

import?javax.swing.JButton;
import?javax.swing.JComboBox;
import?javax.swing.JFileChooser;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JPanel;
import?javax.swing.border.EtchedBorder;
public?class?CCacheSim?extends?Jframe?implements?ActionListener{

private?JPanel?panelTop?panelLeft?panelRight?panelBottom;
private?JButton?execStepBtn?execAllBtn?fileBotton;
private?JComboBox?csBox?bsBox?wayBox?replaceBox?prefetchBox?writeBox?allocBox;
private?JFileChooser?fileChoose;

private?JLabel?labelToplabelLeftrightLabelbottomLabelfileLabelfileAddrBtn?stepLabel1?stepLabel2
????csLabel?bsLabel?wayLabel?replaceLabel?prefetchLabel?writeLabel?allocLabel;
private?JLabel?results[];
//添加
private?JLabel?hitCount[];
private?JLabel?hitRate[];
private?JLabel?stepLabel[];


????//參數(shù)定義
private?String?cachesize[]?=?{?“2KB“?“8KB“?“32KB“?“128KB“?“512KB“?“2MB“?};
private?String?blocksize[]?=?{?“16B“?“32B“?“64B“?“128B“?“256B“?};
private?String?way[]?=?{?“直接映象“?“2路“?“4路“?“8路“?“16路“?“32路“?};
private?String?replace[]?=?{?“LRU“?“FIFO“?“RAND“?};
private?String?pref[]?=?{?“不預(yù)取“?“不命中預(yù)取“?};
private?String?write[]?=?{?“寫(xiě)回法“?“寫(xiě)直達(dá)法“?};
private?String?alloc[]?=?{?“按寫(xiě)分配“?“不按寫(xiě)分配“?};
private?String?typename[]?=?{?“讀數(shù)據(jù)“?“寫(xiě)數(shù)據(jù)“?“讀指令“?};
private?String?hitname[]?=?{“不命中“?“命中“?};

//右側(cè)結(jié)果顯示
private?String?rightLable[]={“訪問(wèn)總次數(shù):““讀指令次數(shù):““讀數(shù)據(jù)次數(shù):““寫(xiě)數(shù)據(jù)次數(shù):“};
//添加
private?String?ShitCount=“不命中次數(shù):?“;
private?String?ShitRate=“不命中率:?“;
private?String?SstepLabel[]={“訪問(wèn)類(lèi)型:?““地址:?““塊號(hào):““塊內(nèi)地址:““索引:?““命中情況:?“};

//打開(kāi)文件
private?File?file;

//分別表示左側(cè)幾個(gè)下拉框所選擇的第幾項(xiàng),索引從?0?開(kāi)始
private?int?csIndex?bsIndex?wayIndex?replaceIndex?prefetchIndex?writeIndex?allocIndex;

//其它變量定義
//...
static?int?[]?InstCount=new?int[4];
static?int?readData;??????//讀數(shù)據(jù)指令條數(shù)
static?int?writeData; ???//寫(xiě)數(shù)據(jù)指令條數(shù)
static?int?readInst; //讀指令條數(shù)
static?int?count;?????????//指令總條數(shù)
int?offset;? //字節(jié)偏移量

List??instruction=new?ArrayList();??//存放指令的數(shù)組
public?class?Instruction{
String?type;????//指令類(lèi)型
String?addr;????//指令地址
}

/*
?*?構(gòu)造函數(shù),繪制模擬器面板
?*/
public?CCacheSim(){
super(“Cache?Simulator“);
draw();
}


//響應(yīng)事件,共有三種事件:
//???1.?執(zhí)行到底事件
//???2.?單步執(zhí)行事件
//???3.?文件選擇事件
public?void?actionPerformed(ActionEvent?e){

if?(e.getSource()?==?execAllBtn)?{
simExecAll();
}
if?(e.getSource()?==?execStepBtn)?{
simExecStep();
}
if?(e.getSource()?==?fileBotton){
fileChoose=new?JFileChooser();
int?fileOver?=?fileChoose.showOpenDialog(null);
//System.out.println(“fileOver:?“+fileOver);
if?(fileOver?==?0)?{

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2014-11-25?23:35??cache\
?????目錄???????????0??2014-11-25?23:35??cache\mycache\
?????文件?????????232??2014-11-20?18:32??cache\mycache\.classpath
?????文件?????????383??2014-11-20?18:32??cache\mycache\.project
?????目錄???????????0??2014-11-25?23:35??cache\mycache\bin\
?????文件?????????777??2014-11-25?23:33??cache\mycache\bin\CCacheSim$1.class
?????文件?????????777??2014-11-25?23:33??cache\mycache\bin\CCacheSim$2.class
?????文件?????????777??2014-11-25?23:33??cache\mycache\bin\CCacheSim$3.class
?????文件?????????777??2014-11-25?23:33??cache\mycache\bin\CCacheSim$4.class
?????文件?????????777??2014-11-25?23:33??cache\mycache\bin\CCacheSim$5.class
?????文件?????????779??2014-11-25?23:33??cache\mycache\bin\CCacheSim$6.class
?????文件?????????779??2014-11-25?23:33??cache\mycache\bin\CCacheSim$7.class
?????文件?????????446??2014-11-25?23:33??cache\mycache\bin\CCacheSim$Cache.class
?????文件?????????450??2014-11-25?23:33??cache\mycache\bin\CCacheSim$Instruction.class
?????文件???????20527??2014-11-25?23:33??cache\mycache\bin\CCacheSim.class
?????文件???????14615??2014-11-21?19:17??cache\mycache\CCacheSim.java
?????目錄???????????0??2014-11-25?23:35??cache\mycache\src\
?????文件???????28974??2014-11-25?23:33??cache\mycache\src\CCacheSim.java

評(píng)論

共有 條評(píng)論

相關(guān)資源