Skip to content

Commit 724a310

Browse files
dhruvr4dhruvr4rbuch
authored
Allow SumDetail logs to be used in overview (#133)
Co-authored-by: dhruvr4 <[email protected]> Co-authored-by: Ronak Buch <[email protected]>
1 parent 56ac170 commit 724a310

File tree

6 files changed

+118
-73
lines changed

6 files changed

+118
-73
lines changed

src/projections/Tools/Overview/OverviewPanel.java

Lines changed: 65 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class OverviewPanel extends ScalePanel.Child
4141

4242
// idleData & mergedData (for supporting - utilization for now -
4343
// the other two data formats)
44-
private int[][] idleDataNormalized; // [processor idx][interval]
44+
private byte[][] idleDataNormalized; // [processor idx][interval]
4545
private int[][] utilizationDataNormalized; // [processor idx][interval]
4646

4747
private int[][] colors; //The color per processor per interval
@@ -89,15 +89,16 @@ public String getPointInfo(double time,double procs)
8989
int interval = (int)(t/intervalSize);
9090

9191
long timedisplay = t+startTime;
92-
if (interval >= entryData[p].length) {
93-
return "some bug has occurred"; // strange bug.
94-
}
92+
9593
if (mode == OverviewWindow.MODE_UTILIZATION) {
9694
return "Processor " + pe +
9795
": Usage = " + utilizationDataNormalized[p][interval]+"%" +
9896
" IDLE = " + idleDataNormalized[p][interval]+"%" +
9997
" at "+U.humanReadableString(timedisplay)+" ("+timedisplay+" us). ";
10098
} else if(mode == OverviewWindow.MODE_EP) {
99+
if (interval >= entryData[p].length) {
100+
return "some bug has occurred"; // strange bug.
101+
}
101102
if (entryData[p][interval] > 0) {
102103
return "Processor "+pe+": Usage = "+
103104
utilizationDataNormalized[p][interval]+"%"+
@@ -329,6 +330,9 @@ protected void setRanges(SortedSet<Integer> selectedPEs, long startTime, long en
329330

330331

331332
intervalSize = (int )trialintervalSize;
333+
if (MainWindow.runObject[myRun].hasSumDetailData()) {
334+
intervalSize = (int) MainWindow.runObject[myRun].getSumDetailIntervalSize();
335+
}
332336
startInterval = (int)(startTime/intervalSize);
333337
endInterval = (int)(endTime/intervalSize);
334338

@@ -342,55 +346,67 @@ protected void setRanges(SortedSet<Integer> selectedPEs, long startTime, long en
342346
* for each interval */
343347

344348
protected void loadData(boolean saveImage) {
345-
if (!MainWindow.runObject[myRun].hasLogData()) {
346-
System.err.println("No log files are available.");
347-
JOptionPane.showMessageDialog(null, "No log files are available.");
348-
return;
349-
}
350-
351349
this.saveImage = saveImage;
352-
mode = OverviewWindow.MODE_EP;
353-
354-
// Create a list of worker threads
355-
LinkedList<Runnable> readyReaders = new LinkedList<Runnable>();
356-
357-
selectedPEs.size();
350+
if (MainWindow.runObject[myRun].hasLogData()) {
351+
int numIntervals = endInterval - startInterval;
352+
mode = OverviewWindow.MODE_EP;
353+
354+
// Create a list of worker threads
355+
LinkedList<Runnable> readyReaders = new LinkedList<Runnable>();
356+
357+
entryData = new int[selectedPEs.size()][numIntervals];
358+
int pIdx = 0;
359+
float[][] idleData = new float[selectedPEs.size()][numIntervals];
360+
float[][] utilizationData = new float[selectedPEs.size()][numIntervals];
361+
for (Integer pe : selectedPEs) {
362+
readyReaders.add(new ThreadedFileReader(pe, intervalSize, myRun,
363+
startInterval, endInterval, entryData[pIdx], utilizationData[pIdx], idleData[pIdx]));
364+
pIdx++;
365+
}
358366

359-
int numIntervals = endInterval - startInterval;
360-
361-
entryData = new int[selectedPEs.size()][numIntervals];
362-
float[][] idleData = new float[selectedPEs.size()][numIntervals];
363-
float[][] utilizationData = new float[selectedPEs.size()][numIntervals];
364-
365-
int pIdx=0;
366-
367-
for(Integer pe : selectedPEs){
368-
readyReaders.add( new ThreadedFileReader(pe, intervalSize, myRun,
369-
startInterval, endInterval, entryData[pIdx], utilizationData[pIdx], idleData[pIdx]) );
370-
pIdx++;
371-
}
372-
373-
// Pass this list of threads to a class that manages/runs the threads nicely
374-
TimedProgressThreadExecutor threadManager = new TimedProgressThreadExecutor("Loading Overview in Parallel", readyReaders, this, true);
375-
threadManager.runAll();
376-
377-
// For historical reasons, we use a utilization range of 0 to 100
378-
utilizationDataNormalized = new int[utilizationData.length][utilizationData[0].length];
379-
idleDataNormalized = new int[idleData.length][idleData[0].length];
380-
381-
for (int i=0; i<utilizationData.length; i++) {
382-
for (int j=0; j<utilizationData[i].length; j++) {
383-
utilizationDataNormalized[i][j] = (int) (100.0f * utilizationData[i][j]);
384-
idleDataNormalized[i][j] = (int) (100.0f * idleData[i][j]);
367+
// Pass this list of threads to a class that manages/runs the threads nicely
368+
TimedProgressThreadExecutor threadManager = new TimedProgressThreadExecutor("Loading Overview in Parallel", readyReaders, this, true);
369+
threadManager.runAll();
370+
371+
// For historical reasons, we use a utilization range of 0 to 100
372+
utilizationDataNormalized = new int[utilizationData.length][utilizationData[0].length];
373+
idleDataNormalized = new byte[idleData.length][idleData[0].length];
374+
for (int i = 0; i < utilizationData.length; i++) {
375+
for (int j = 0; j < utilizationData[i].length; j++) {
376+
utilizationDataNormalized[i][j] = (int) (100.0f * utilizationData[i][j]);
377+
idleDataNormalized[i][j] = (byte) (100.0f * idleData[i][j]);
378+
}
379+
}
380+
// We default to coloring by entry method for log files
381+
colorByEntry();
382+
} else if (MainWindow.runObject[myRun].hasSumDetailData()) {
383+
int intervalSize = (int) MainWindow.runObject[myRun].getSumDetailIntervalSize();
384+
startInterval = (int) startTime / intervalSize;
385+
endInterval = (int) Math.ceil(((double) endTime) / intervalSize) - 1;
386+
int numIntervals = endInterval - startInterval + 1;
387+
388+
utilizationDataNormalized = new int[selectedPEs.size()][numIntervals];
389+
idleDataNormalized = new byte[selectedPEs.size()][numIntervals];
390+
391+
MainWindow.runObject[myRun].LoadGraphData(intervalSize, startInterval, endInterval, false, selectedPEs);
392+
393+
utilizationDataNormalized = MainWindow.runObject[myRun].getSumDetailData_PE_interval();
394+
idleDataNormalized = MainWindow.runObject[myRun].sumAnalyzer.getIdlePercentage();
395+
double scale = 100.0 / intervalSize;
396+
397+
// idleDataNormalized is already in terms of percentage, so don't convert it
398+
for (int i = 0; i < utilizationDataNormalized.length; i++) {
399+
for (int j = 0; j < utilizationDataNormalized[i].length - 1; j++) {
400+
utilizationDataNormalized[i][j] = (int) (scale * utilizationDataNormalized[i][j]);
401+
}
385402
}
403+
// Color by utilization for sumdetail
404+
colorByUtil();
405+
} else {
406+
System.err.println("Does not work for sum files");
407+
JOptionPane.showMessageDialog(null, "Does not work for sum files");
408+
return;
386409
}
387-
388-
// dispose of unneeded utilizationData
389-
utilizationData = null;
390-
391-
// We default to coloring by entry method
392-
colorByEntry();
393-
394410
}
395411

396412
protected void colorByEntry() {

src/projections/Tools/Overview/OverviewWindow.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,29 @@ private void createLayout()
119119
scalePanel.setStatusDisplay(this);
120120

121121

122-
colorByEntryMethod = new JRadioButton("Entry Method");
123-
colorByUtil = new JRadioButton("Utilization");
124-
colorByEntryMethod.setSelected(true);
125-
//Group the radio buttons.
126-
ButtonGroup group = new ButtonGroup();
127-
group.add(colorByEntryMethod);
128-
group.add(colorByUtil);
129-
colorByEntryMethod.addActionListener(this);
130-
colorByUtil.addActionListener(this);
131-
JPanel radioPanel = new JPanel();
132-
radioPanel.setLayout(new GridBagLayout());
133122
mChooseColors = new JButton("Choose Entry Method Colors");
134123
mChooseColors.addActionListener(this);
135-
136-
Util.gblAdd(radioPanel, new JLabel("Color By:"), gbc, 0,0, 1,1, 1,1);
137-
Util.gblAdd(radioPanel, colorByEntryMethod, gbc, 1,0, 1,1, 1,1);
138-
Util.gblAdd(radioPanel, colorByUtil, gbc, 2,0, 1,1, 1,1);
124+
ButtonGroup group = new ButtonGroup();
125+
JPanel radioPanel = new JPanel();
126+
radioPanel.setLayout(new GridBagLayout());
127+
Util.gblAdd(radioPanel, new JLabel("Color By:"), gbc, 0,0, 1,1, 1,1);
128+
129+
if(MainWindow.runObject[myRun].hasLogFiles()){
130+
colorByEntryMethod = new JRadioButton("Entry Method");
131+
colorByEntryMethod.setSelected(true);
132+
group.add(colorByEntryMethod);
133+
colorByEntryMethod.addActionListener(this);
134+
Util.gblAdd(radioPanel, colorByEntryMethod, gbc, 1,0, 1,1, 1,1);
135+
}
139136

137+
colorByUtil = new JRadioButton("Utilization");
138+
group.add(colorByUtil);
139+
colorByUtil.addActionListener(this);
140+
if(MainWindow.runObject[myRun].hasSumDetailFiles()){
141+
colorByUtil.setSelected(true);
142+
}
140143

144+
Util.gblAdd(radioPanel, colorByUtil, gbc, 2,0, 1,1, 1,1);
141145
gbc.fill = GridBagConstraints.HORIZONTAL;
142146
Util.gblAdd(windowPane, radioPanel, gbc, 0,3, 1,1, 0,0, 1,1,1,1);
143147
Util.gblAdd(windowPane, mChooseColors, gbc, 1,3, 1,1, 0,0, 1,1,1,1);

src/projections/Tools/TimeProfile/TimeProfileWindow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ else if( MainWindow.runObject[myRun].hasSumDetailFiles()) //Bilge
360360
MainWindow.runObject[myRun].LoadGraphData(intervalSize, startInterval, endInterval, false,
361361
processorList);
362362

363-
int[][] sumDetailData = MainWindow.runObject[myRun].getSumDetailData();
363+
int[][] sumDetailData = MainWindow.runObject[myRun].getSumDetailData_interval_EP();
364364

365365
for(int i=0;i<numIntervals;i++){
366366
//for(int j=0;j<numEPs+special;j++){

src/projections/analysis/Analysis.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.awt.Paint;
77
import java.io.File;
88
import java.io.IOException;
9-
import java.util.Arrays;
109
import java.util.Iterator;
1110
import java.util.SortedSet;
1211
import java.util.TreeSet;
@@ -359,9 +358,16 @@ public double getSumDetailNumIntervals(){
359358
return intervalData.getNumIntervals();
360359
}
361360

362-
public int[][] getSumDetailData() {
363-
return intervalData.sumDetailData();
361+
public int[][] getSumDetailData_interval_EP() {
362+
return intervalData.getSumDetailData_interval_EP();
364363
}
364+
public int[][] getSumDetailData_PE_EP() {
365+
return intervalData.getSumDetailData_PE_EP();
366+
}
367+
public int[][] getSumDetailData_PE_interval() {
368+
return intervalData.getSumDetailData_PE_interval();
369+
}
370+
365371
public Color getEntryColor(int entryIdx) {
366372
if (entryIdx == IDLE_ENTRY_POINT) {
367373
Paint p = getIdleColor();
@@ -444,7 +450,7 @@ else if (hasSumDetailFiles()) {
444450
intervalStart,
445451
intervalEnd, false, peSet);
446452

447-
int sumDetailData[][] = intervalData.sumDetailData();
453+
int sumDetailData[][] = intervalData.getSumDetailData_interval_EP();
448454
data = new long[numUserEntries];
449455
for (int interval = 0; interval < numIntervals; interval++) {
450456
for (int entry = 0; entry < numUserEntries; entry++) {

src/projections/analysis/IntervalData.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public class IntervalData
5757
private int numIntervals = 0;
5858
private double intervalSize = 0;
5959

60-
private int sumDetailData[][] = null;
60+
private int sumDetailData_interval_EP[][] = null;
61+
private int sumDetailData_PE_EP[][] = null;
62+
private int sumDetailData_PE_interval[][] = null;
6163

6264
/**
6365
* The constructor
@@ -110,14 +112,18 @@ public void loadSumDetailIntervalData(long intervalSize, int intervalStart,
110112
SortedSet<Integer> processorList){
111113
int numIntervals = intervalEnd - intervalStart + 1;
112114

113-
sumDetailData = new int[numIntervals][numEPs];
115+
sumDetailData_interval_EP = new int[numIntervals][numEPs];
116+
sumDetailData_PE_EP = new int[numPEs][numEPs];
117+
sumDetailData_PE_interval = new int[numPEs][numIntervals];
114118
double[][] tempData;
115119
for(Integer curPe : processorList) {
116120
int ii = intervalStart;
117121
tempData = getData(curPe, TYPE_TIME);
118122
for(int i=0; i<numIntervals; i++){
119123
for(int e=0; e<numEPs; e++){
120-
sumDetailData[i][e] += tempData[e][ii];
124+
sumDetailData_interval_EP[i][e] += (int)tempData[e][ii];
125+
sumDetailData_PE_EP[curPe][e] += (int)tempData[e][ii];
126+
sumDetailData_PE_interval[curPe][i] += (int)tempData[e][ii];
121127
}
122128
ii++;
123129
}
@@ -179,7 +185,17 @@ public void loadIntervalData(long intervalSize, int intervalStart,
179185
}
180186
}
181187

182-
public int[][] sumDetailData() {return sumDetailData; };
188+
public int[][] getSumDetailData_interval_EP() {
189+
return sumDetailData_interval_EP;
190+
}
191+
192+
public int[][] getSumDetailData_PE_EP() {
193+
return sumDetailData_PE_EP;
194+
}
195+
196+
public int[][] getSumDetailData_PE_interval() {
197+
return sumDetailData_PE_interval;
198+
}
183199

184200
public int[][][] getSystemUsageData() {
185201
return systemUsageData;

src/projections/analysis/SumAnalyzer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,7 @@ public int[] getTotalIdlePercentage(){
635635
}
636636
return totalIdlePercentage;
637637
}
638+
public byte[][] getIdlePercentage(){
639+
return IdlePercentage;
640+
}
638641
}

0 commit comments

Comments
 (0)