📄 wkldstatsdlg.java
字号:
randClustOhFld.setMargin(defaultInsets); randClustOhFld.setHorizontalAlignment(SwingConstants.RIGHT); randClustOhFld.setEditable(false); randClustOhFld.setBounds(235,150,105,20); randClustOhFld.setBackground(Color.white); randClustOhFld.setFont(defaultFont); leafPanel.add(randClustOhFld); leafClOhFld = new JTextField(); leafClOhFld.setMargin(defaultInsets); leafClOhFld.setHorizontalAlignment(SwingConstants.RIGHT); leafClOhFld.setEditable(false); leafClOhFld.setBounds(235,175,105,20); leafClOhFld.setBackground(Color.white); leafClOhFld.setFont(defaultFont); leafPanel.add(leafClOhFld); leafClIoFld = new JTextField(); leafClIoFld.setMargin(defaultInsets); leafClIoFld.setHorizontalAlignment(SwingConstants.RIGHT); leafClIoFld.setEditable(false); leafClIoFld.setBounds(120,175,105,20); leafClIoFld.setBackground(Color.white); leafClIoFld.setFont(defaultFont); leafPanel.add(leafClIoFld); leafUlIoFld = new JTextField(); leafUlIoFld.setMargin(defaultInsets); leafUlIoFld.setHorizontalAlignment(SwingConstants.RIGHT); leafUlIoFld.setEditable(false); leafUlIoFld.setBounds(120,200,105,20); leafUlIoFld.setBackground(Color.white); leafUlIoFld.setFont(defaultFont); leafPanel.add(leafUlIoFld); leafUlOhFld = new JTextField(); leafUlOhFld.setMargin(defaultInsets); leafUlOhFld.setHorizontalAlignment(SwingConstants.RIGHT); leafUlOhFld.setEditable(false); leafUlOhFld.setBounds(235,200,105,20); leafUlOhFld.setBackground(Color.white); leafUlOhFld.setFont(defaultFont); leafPanel.add(leafUlOhFld); leafElIoFld = new JTextField(); leafElIoFld.setMargin(defaultInsets); leafElIoFld.setHorizontalAlignment(SwingConstants.RIGHT); leafElIoFld.setEditable(false); leafElIoFld.setBounds(120,225,105,20); leafElIoFld.setBackground(Color.white); leafElIoFld.setFont(defaultFont); leafPanel.add(leafElIoFld); leafElOhFld = new JTextField(); leafElOhFld.setMargin(defaultInsets); leafElOhFld.setHorizontalAlignment(SwingConstants.RIGHT); leafElOhFld.setEditable(false); leafElOhFld.setBounds(235,225,105,20); leafElOhFld.setBackground(Color.white); leafElOhFld.setFont(defaultFont); leafPanel.add(leafElOhFld); leafTotalIoFld = new JTextField(); leafTotalIoFld.setMargin(defaultInsets); leafTotalIoFld.setHorizontalAlignment(SwingConstants.RIGHT); leafTotalIoFld.setEditable(false); leafTotalIoFld.setBounds(120,250,105,20); leafTotalIoFld.setBackground(Color.white); leafTotalIoFld.setFont(defaultFont); leafPanel.add(leafTotalIoFld); leafTotalOhFld = new JTextField(); leafTotalOhFld.setMargin(defaultInsets); leafTotalOhFld.setHorizontalAlignment(SwingConstants.RIGHT); leafTotalOhFld.setEditable(false); leafTotalOhFld.setBounds(235,250,105,20); leafTotalOhFld.setBackground(Color.white); leafTotalOhFld.setFont(defaultFont); leafPanel.add(leafTotalOhFld); minLbl = new JLabel(); minLbl.setText("Theor. Min.:"); minLbl.setBounds(15,100,100,20); leafPanel.add(minLbl); leafTotalLbl = new JLabel(); leafTotalLbl.setText("Actual Clust.:"); leafTotalLbl.setBounds(15,250,80,20); leafPanel.add(leafTotalLbl); optClustLbl = new JLabel(); optClustLbl.setText("Opt. Clust.:"); optClustLbl.setBounds(15,125,80,20); leafPanel.add(optClustLbl); randClustLbl = new JLabel(); randClustLbl.setText("Random Clust.:"); randClustLbl.setBounds(15,150,95,20); leafPanel.add(randClustLbl); leafClLbl = new JLabel(); leafClLbl.setText("Clust. Loss:"); leafClLbl.setBounds(15,175,80,20); leafPanel.add(leafClLbl); leafUlLbl = new JLabel(); leafUlLbl.setText("Util. Loss:"); leafUlLbl.setBounds(15,200,70,20); leafPanel.add(leafUlLbl); leafElLbl = new JLabel(); leafElLbl.setText("Exc. Cov. Loss:"); leafElLbl.setBounds(15,225,100,20); leafPanel.add(leafElLbl); leafUtilFld = new JTextField(); leafUtilFld.setMargin(defaultInsets); leafUtilFld.setHorizontalAlignment(SwingConstants.RIGHT); leafUtilFld.setEditable(false); leafUtilFld.setBounds(120,35,105,20); leafUtilFld.setBackground(Color.white); leafUtilFld.setFont(defaultFont); leafPanel.add(leafUtilFld); itemsRetrFld = new JTextField(); itemsRetrFld.setMargin(defaultInsets); itemsRetrFld.setHorizontalAlignment(SwingConstants.RIGHT); itemsRetrFld.setEditable(false); itemsRetrFld.setBounds(120,10,105,20); itemsRetrFld.setBackground(Color.white); itemsRetrFld.setFont(defaultFont); leafPanel.add(itemsRetrFld); leafUtilLbl = new JLabel(); leafUtilLbl.setText("Avg. Util.:"); leafUtilLbl.setBounds(15,35,95,20); leafPanel.add(leafUtilLbl); itemsRetrLbl = new JLabel(); itemsRetrLbl.setText("Items Retrieved:"); itemsRetrLbl.setBounds(15,10,105,20); leafPanel.add(itemsRetrLbl); tp.addTab("Leaves", leafPanel); ////////////////////////////////////////////////////////////// // internal/totals panel ////////////////////////////////////////////////////////////// internalPanel = new JPanel(null); internalPanel.setFont(new Font("Dialog", Font.PLAIN, 12)); getContentPane().add(internalPanel); intLbl = new JLabel(); intLbl.setText("Internal"); intLbl.setHorizontalAlignment(SwingConstants.CENTER); intLbl.setBounds(120,10,105,20); internalPanel.add(intLbl); totalsLbl = new JLabel(); totalsLbl.setText("All"); totalsLbl.setHorizontalAlignment(SwingConstants.CENTER); totalsLbl.setBounds(235,10,105,20); internalPanel.add(totalsLbl); totalClFld = new JTextField(); totalClFld.setMargin(defaultInsets); totalClFld.setHorizontalAlignment(SwingConstants.RIGHT); totalClFld.setEditable(false); totalClFld.setBounds(235,35,105,20); totalClFld.setBackground(Color.white); totalClFld.setFont(defaultFont); internalPanel.add(totalClFld); totalUlFld = new JTextField(); totalUlFld.setMargin(defaultInsets); totalUlFld.setHorizontalAlignment(SwingConstants.RIGHT); totalUlFld.setEditable(false); totalUlFld.setBounds(235,60,105,20); totalUlFld.setBackground(Color.white); totalUlFld.setFont(defaultFont); internalPanel.add(totalUlFld); intClFld = new JTextField(); intClFld.setMargin(defaultInsets); intClFld.setHorizontalAlignment(SwingConstants.RIGHT); intClFld.setEditable(false); intClFld.setBounds(120,35,105,20); intClFld.setBackground(Color.white); intClFld.setFont(defaultFont); internalPanel.add(intClFld); intUlFld = new JTextField(); intUlFld.setMargin(defaultInsets); intUlFld.setHorizontalAlignment(SwingConstants.RIGHT); intUlFld.setEditable(false); intUlFld.setBounds(120,60,105,20); intUlFld.setBackground(Color.white); intUlFld.setFont(defaultFont); internalPanel.add(intUlFld); intElFld = new JTextField(); intElFld.setMargin(defaultInsets); intElFld.setHorizontalAlignment(SwingConstants.RIGHT); intElFld.setEditable(false); intElFld.setBounds(120,85,105,20); intElFld.setBackground(Color.white); intElFld.setFont(defaultFont); internalPanel.add(intElFld); totalElFld = new JTextField(); totalElFld.setMargin(defaultInsets); totalElFld.setHorizontalAlignment(SwingConstants.RIGHT); totalElFld.setEditable(false); totalElFld.setBounds(235,85,105,20); totalElFld.setBackground(Color.white); totalElFld.setFont(defaultFont); internalPanel.add(totalElFld); totalTotalFld = new JTextField(); totalTotalFld.setMargin(defaultInsets); totalTotalFld.setHorizontalAlignment(SwingConstants.RIGHT); totalTotalFld.setEditable(false); totalTotalFld.setBounds(235,110,105,20); totalTotalFld.setBackground(Color.white); totalTotalFld.setFont(defaultFont); internalPanel.add(totalTotalFld); intTotalFld = new JTextField(); intTotalFld.setMargin(defaultInsets); intTotalFld.setHorizontalAlignment(SwingConstants.RIGHT); intTotalFld.setEditable(false); intTotalFld.setBounds(120,110,105,20); intTotalFld.setBackground(Color.white); intTotalFld.setFont(defaultFont); internalPanel.add(intTotalFld); totalLbl = new JLabel(); totalLbl.setText("Total:"); totalLbl.setBounds(15,110,70,20); internalPanel.add(totalLbl); clustLossLbl = new JLabel(); clustLossLbl.setText("Clust. Loss:"); clustLossLbl.setBounds(15,35,80,20); internalPanel.add(clustLossLbl); utilLossLbl = new JLabel(); utilLossLbl.setText("Util. Loss:"); utilLossLbl.setBounds(15,60,70,20); internalPanel.add(utilLossLbl); excCovLossLbl = new JLabel(); excCovLossLbl.setText("Exc. Cov. Loss:"); excCovLossLbl.setBounds(15,85,100,20); internalPanel.add(excCovLossLbl); tp.addTab("Internal/Totals", internalPanel); // quit button JButton quitBtn = new JButton("Quit"); quitBtn.setFont(defaultFont); quitBtn.setBounds(125, 540, 80, 30); quitBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { WkldStatsDlg.this.setVisible(false); } }); getContentPane().add(quitBtn); setBounds(0, 0, 400, 620); setVisible(false); //getContentPane().setBounds(0, 0, 400, 600); //pack();}// ((double) ((int) x*1000)/1000): Java's way of printing 3 significant digitsprivate doubletruncate(double d, int digits){ double p = Math.pow(10.0, (double) digits); return ((double) ((int) (d * p))/p);}// ((double) ((int) x*1000)/1000): Java's way of printing 3 significant digitsprivate floattruncate(float d, int digits){ float p = (float) Math.pow(10.0, (double) digits); return ((float) ((int) (d * p))/p);}///////////////////////////////////////////////////////////////////////////////// setQuery - updates display of currently selected query (incl. tree view)//// Description:// - extracts currently selected query number from dialog//// Exceptions: none/////////////////////////////////////////////////////////////////////////////////private voidsetQuery(){ int queryNo = 0; // totals if (selectorGroup.getSelection().getActionCommand().equals("query")) { // we don't want the totals try { queryNo = Integer.parseInt(queryFld.getText()); } catch (NumberFormatException e) { DbgOutput.println(2, "setQuery() w/o a queryno!"); // can't be } } setQuery(queryNo);}///////////////////////////////////////////////////////////////////////////////// setQuery - updates display of query (incl. tree view)//// Description://// Exceptions: none/////////////////////////////////////////////////////////////////////////////////private voidsetQuery(int queryNo){ Libgist.getQueryStats(queryNo, queryStats); boolean minStats = baseGroup.getSelection().getActionCommand().equals("min"); // true if the user wants to see metrics w.r.t. theoretical minimum; // otherwise w.r.t. to the optimal clustering // load queryFld and queryArea if (queryNo != 0) { // otherwise it's the total queryFld.setText(Integer.toString(queryNo)); queryArea.setText(queryStats.qual.toString()); } else { queryArea.setText(""); } // load leaf-level panel itemsRetrFld.setText(Integer.toString(queryStats.resultSetSize)); leafUtilFld.setText(Float.toString(truncate(queryStats.avgUtil * 100, 3))); minIoFld.setText(Integer.toString(queryStats.minIos)); minOhFld.setText("N/A"); optClustIoFld.setText(Integer.toString(queryStats.optimalIos)); optClustOhFld.setText(Float.toString(truncate(queryStats.optimalOh, 3))); randClustIoFld.setText(Float.toString(truncate(queryStats.randomIos, 2)) + " (" + Float.toString(truncate(queryStats.randomStdDev, 2)) + ")"); if (minStats) { randClustOhFld.setText(Float.toString(truncate(queryStats.minRandomOh, 3))); } else { randClustOhFld.setText(Float.toString(truncate(queryStats.optRandomOh, 3))); } if (minStats) { leafClIoFld.setText(Float.toString(truncate(queryStats.minClusterLoss, 3))); } else { leafClIoFld.setText(Float.toString(truncate(queryStats.optClusterLoss, 3))); } if (minStats) { leafClOhFld.setText(Float.toString(truncate(queryStats.minClusterOh, 3))); } else { leafClOhFld.setText(Float.toString(truncate(queryStats.optClusterOh, 3))); } leafUlIoFld.setText(Float.toString(truncate(queryStats.leafUtilLoss, 3))); leafUlOhFld.setText(Float.toString(truncate(queryStats.utilOh, 3))); leafElIoFld.setText(Float.toString(truncate(queryStats.leafExcCovLoss, 3))); leafElOhFld.setText(Float.toString(truncate(queryStats.excCovOh, 3))); leafTotalIoFld.setText(Integer.toString(queryStats.totalLeafIos)); if (minStats) { leafTotalOhFld.setText(Float.toString(truncate( ((float) queryStats.totalLeafIos / (float) queryStats.minIos), 3))); } else { leafTotalOhFld.setText(Float.toString(truncate( ((float) queryStats.totalLeafIos / (float) queryStats.optimalIos), 3))); } // load internal/totals panel intClFld.setText("N/A"); totalClFld.setText(leafClIoFld.getText()); intUlFld.setText(Float.toString(queryStats.internalUtilLoss)); totalUlFld.setText(Float.toString(queryStats.internalUtilLoss + queryStats.leafUtilLoss)); intElFld.setText(Float.toString(queryStats.internalExcCovLoss)); totalElFld.setText(Float.toString(queryStats.internalExcCovLoss + queryStats.leafExcCovLoss)); intTotalFld.setText(Integer.toString(queryStats.totalInternalIos)); totalTotalFld.setText(Integer.toString(queryStats.totalLeafIos + queryStats.totalInternalIos)); // display stats in treeview Libgist.getWkldNodeStats(statsTypeBox.getSelectedIndex(), queryNo, minStats); treeView.showStats(Libgist.nodeCnt, Libgist.displayStats, (String) statsTypeBox.getSelectedItem());}// init dialog for user interaction:// set querySlider range to # of queriespublic voidinit(TreeView treeView){ this.treeView = treeView; // load workload data Libgist.getAnalysisInfo(analysisInfo); numQueriesFld.setText(Integer.toString(analysisInfo.numQueries)); float percCoverage = ((float) analysisInfo.numRetrieved) / ((float) analysisInfo.numItems); dataCovFld.setText(Integer.toString(analysisInfo.numRetrieved) + "/" + Integer.toString(analysisInfo.numItems) + " (" + Integer.toString((int) (percCoverage * 100.0)) + "%)"); runsFld.setText(Integer.toString(analysisInfo.randomRuns)); retrOnlyBtn.setSelected(true); allDataBtn.setSelected(false); utilFld.setText(Float.toString(analysisInfo.targetUtil)); setQuery(0);}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -