diff --git a/src/projections/Tools/Extrema/ExtremaWindow.java b/src/projections/Tools/Extrema/ExtremaWindow.java index 4316ecb..056adf4 100644 --- a/src/projections/Tools/Extrema/ExtremaWindow.java +++ b/src/projections/Tools/Extrema/ExtremaWindow.java @@ -123,6 +123,11 @@ public class ExtremaWindow extends GenericGraphWindow private double[][] graphData; private LinkedList outlierPEs; + // The time range the loaded data covers, for the chart header; the x axis + // shows PEs, so nothing else on the chart says what interval was analyzed. + private long loadedStartTime; + private long loadedEndTime; + public ExtremaWindow(MainWindow mainWindow) { super("Projections Extrema Analysis Tool - " + @@ -290,6 +295,8 @@ public Paint[] getColorMap() { private GenericGraphColorer colorer; private void constructToolData(final long startTime, final long endTime ) { + loadedStartTime = startTime; + loadedEndTime = endTime; // construct the necessary meta-data given the selected activity // type. double[][] tempData; @@ -795,7 +802,9 @@ public void done() { // outlier analysis which will then determine which processor's // log data to read. private void readOutlierStats(final long startTime, final long endTime) { - numActivities = MainWindow.runObject[myRun].getNumActivity(selectedActivity); + loadedStartTime = startTime; + loadedEndTime = endTime; + numActivities = MainWindow.runObject[myRun].getNumActivity(selectedActivity); colorer = new OnlineDataColorer(numActivities); @@ -943,11 +952,18 @@ private void readOnlineOutlierProcessor(int pe, int index, final long startTime, protected void setGraphSpecificData() { setXAxis("Notable PEs (Cluster Representatives and Extrema)", outlierList); - setYAxis(attributes[1][selectedAttribute], + setYAxis(attributes[1][selectedAttribute], attributes[2][selectedAttribute]); setDataSource("Extrema: " + attributes[0][selectedAttribute] + - " (" + threshold + + " (" + threshold + " Extrema PEs)", graphData, colorer, this); + // Flank the chart title with the analyzed time range and PE selection; + // neither is visible anywhere else on this chart. + SortedSet selectedPEs = + (dialog != null) ? new TreeSet(dialog.getSelectedProcessors()) : null; + graphCanvas.setTitleAnnotations( + "Time " + U.humanReadableRange(loadedStartTime, loadedEndTime), + Util.processorSelectionString(selectedPEs)); refreshGraph(); } diff --git a/src/projections/gui/ProfileWindow.java b/src/projections/gui/ProfileWindow.java index 3515ea0..4465ee0 100644 --- a/src/projections/gui/ProfileWindow.java +++ b/src/projections/gui/ProfileWindow.java @@ -511,8 +511,11 @@ private void setDisplayProfileData(){ String[] gTitles = new String[2]; - gTitles[0] = "Profile of Usage for Processors "+Util.listToString(data.plist); - gTitles[1] = "(Time "+data.begintime/(float)1000+" ~ "+data.endtime/(float)1000+" ms)"; + // Strided form ("0-115:5"), not the expanded list: at large PE counts + // the expanded list is wider than the canvas, pushing everything that + // identifies the chart (including the time range below) out of sight. + gTitles[0] = "Profile of Usage for "+Util.processorSelectionString(data.plist); + gTitles[1] = "(Time "+U.humanReadableRange(data.begintime, data.endtime)+")"; displayCanvas.setGraphTiltes(gTitles); String[] xNames = new String[data.plist.size()+1]; diff --git a/src/projections/gui/U.java b/src/projections/gui/U.java index dea7ff4..9587234 100644 --- a/src/projections/gui/U.java +++ b/src/projections/gui/U.java @@ -94,4 +94,23 @@ public static String humanReadableString(long us, int places) return (int)(us/1000000)+printDecimals(us*0.000001,places)+"s"; } + /* + A time range for a chart header: "start - end" with at most 3 decimal + places, adding digits only when the range is so narrow that the two + endpoints would otherwise print alike. Six decimals of a seconds value + is exact microseconds, so distinct endpoints always separate. + */ + public static String humanReadableRange(long startUs, long endUs) + { + int places = 3; + String start = humanReadableString(startUs, places); + String end = humanReadableString(endUs, places); + while (start.equals(end) && startUs != endUs && places < 6) { + places++; + start = humanReadableString(startUs, places); + end = humanReadableString(endUs, places); + } + return start + " - " + end; + } + }