@@ -305,38 +305,62 @@ private void constructToolData(final long startTime, final long endTime ) {
305305 int numPEs = selectedPEs .size ();
306306 tempData = new double [numPEs ][];
307307
308- // Create a list of worker threads
309- LinkedList <Runnable > readyReaders = new LinkedList <Runnable >();
308+ if (MainWindow .runObject [myRun ].hasLogData ()) {
309+ // Create a list of worker threads
310+ LinkedList <Runnable > readyReaders = new LinkedList <Runnable >();
310311
311- int pIdx =0 ;
312-
313- for (Integer pe : selectedPEs ){
314- readyReaders .add ( new ThreadedFileReader (pe , startTime , endTime ,
315- numActivities , numActivityPlusSpecial , selectedActivity , selectedAttribute ) );
316- pIdx ++;
317- }
318-
319-
320- // Determine a component to show the progress bar with
321- Component guiRootForProgressBar = null ;
322- if (thisWindow !=null && thisWindow .isVisible ()) {
323- guiRootForProgressBar = thisWindow ;
324- } else if (MainWindow .runObject [myRun ].guiRoot !=null && MainWindow .runObject [myRun ].guiRoot .isVisible ()){
325- guiRootForProgressBar = MainWindow .runObject [myRun ].guiRoot ;
326- }
312+ for (Integer pe : selectedPEs ) {
313+ readyReaders .add (new ThreadedFileReader (pe , startTime , endTime ,
314+ numActivities , numActivityPlusSpecial , selectedActivity , selectedAttribute ));
315+ }
327316
328- // Pass this list of threads to a class that manages/runs the threads nicely
329- TimedProgressThreadExecutor threadManager = new TimedProgressThreadExecutor ("Loading Extrema in Parallel" , readyReaders , guiRootForProgressBar , true );
330- threadManager .runAll ();
317+ // Determine a component to show the progress bar with
318+ Component guiRootForProgressBar = null ;
319+ if (thisWindow != null && thisWindow .isVisible ()) {
320+ guiRootForProgressBar = thisWindow ;
321+ } else if (MainWindow .runObject [myRun ].guiRoot != null && MainWindow .runObject [myRun ].guiRoot .isVisible ()) {
322+ guiRootForProgressBar = MainWindow .runObject [myRun ].guiRoot ;
323+ }
331324
325+ // Pass this list of threads to a class that manages/runs the threads nicely
326+ TimedProgressThreadExecutor threadManager = new TimedProgressThreadExecutor ("Loading Extrema in Parallel" , readyReaders , guiRootForProgressBar , true );
327+ threadManager .runAll ();
328+
329+ // Retrieve results from each thread, storing them into tempData
330+ int pIdx = 0 ;
331+ Iterator <Runnable > iter = readyReaders .iterator ();
332+ while (iter .hasNext ()) {
333+ ThreadedFileReader r = (ThreadedFileReader ) iter .next ();
334+ tempData [pIdx ] = r .myData ;
335+ pIdx ++;
336+ }
337+ } else if (MainWindow .runObject [myRun ].hasSumDetailData ()) {
338+ int intervalSize = (int ) MainWindow .runObject [myRun ].getSumDetailIntervalSize ();
339+ int startInterval = (int ) ((float ) startTime / intervalSize );
340+ int endInterval = (int ) Math .ceil ((float ) endTime / intervalSize ) - 1 ;
341+
342+ MainWindow .runObject [myRun ].LoadGraphData (intervalSize , startInterval , endInterval , false , selectedPEs );
343+
344+ int [][] sumDetailData_PE_EP = MainWindow .runObject [myRun ].getSumDetailData_PE_EP ();
345+
346+ double scale = 100.0 / (endTime - startTime );
347+ // Use sum files to get the idle data, sumDetail files do not contain idle data
348+ double [] idleTemp = MainWindow .runObject [myRun ].sumAnalyzer .getTotalIdlePercentagePerPE (startInterval , endInterval );
349+
350+ // Assume that each PE has the same number of EPs
351+ final int numEPs = sumDetailData_PE_EP [0 ].length ;
352+ for (int pe = 0 ; pe < sumDetailData_PE_EP .length ; pe ++) {
353+ double lis [] = new double [numEPs + 2 ];
354+ double sum = 0.0 ;
355+ for (int ep = 0 ; ep < numEPs ; ep ++) {
356+ lis [ep ] = sumDetailData_PE_EP [pe ][ep ] * scale ;
357+ sum += lis [ep ];
358+ }
332359
333- // Retrieve results from each thread, storing them into tempData
334- int pIdx2 =0 ;
335- Iterator <Runnable > iter = readyReaders .iterator ();
336- while (iter .hasNext ()) {
337- ThreadedFileReader r = (ThreadedFileReader ) iter .next ();
338- tempData [pIdx2 ] = r .myData ;
339- pIdx2 ++;
360+ lis [numEPs ] = idleTemp [pe ];
361+ lis [numEPs + 1 ] = 100.0 - sum - lis [numEPs ];
362+ tempData [pe ] = lis ;
363+ }
340364 }
341365
342366 // Compute Extrema elements depending on attribute type.
0 commit comments