Merge "Issue #1584 - FFMP performance stats and performance logger Peer review comments Change-Id: I991b3fe21f1b458f45907bdc3b4716afc348992c" into development
Former-commit-id:4fb1cb27dc
[formerly a07a434ad71986aa4b474dd88e266035e347efa4] Former-commit-id:355e6d2c67
This commit is contained in:
commit
3c126b0ab1
28 changed files with 759 additions and 236 deletions
|
@ -118,6 +118,7 @@ export pid=$$
|
|||
curTime=`date +%Y%m%d_%H%M%S`
|
||||
LOGFILE=${LOGDIR}/cave_${curTime}_pid_${pid}_console.log
|
||||
export LOGFILE_CAVE=${LOGDIR}/cave_${curTime}_pid_${pid}_alertviz.log
|
||||
export LOGFILE_PERFORMANCE=${LOGDIR}/cave_${curTime}_pid_${pid}_perf.log
|
||||
|
||||
redirect="TRUE"
|
||||
for flag in $@; do
|
||||
|
|
|
@ -29,6 +29,16 @@
|
|||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="PerformanceLogAppender" class="com.raytheon.uf.viz.alertviz.EnvConfigurableRollingFileAppender">
|
||||
<param name="envLogVar" value="LOGFILE_PERFORMANCE" />
|
||||
<param name="maxFileSize" value="2GB"/>
|
||||
<param name="maxBackupIndex" value="5"/>
|
||||
<param name="Append" value="true"/>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p %d{dd MMM yyyy HH:mm:ss,SSS} %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="AsyncCaveLogAppender" class="org.apache.log4j.AsyncAppender">
|
||||
<param name="BufferSize" value="500"/>
|
||||
<appender-ref ref="CaveLogAppender"/>
|
||||
|
@ -37,6 +47,15 @@
|
|||
<level value="ALL"/>
|
||||
<appender-ref ref="AsyncCaveLogAppender"/>
|
||||
</logger>
|
||||
|
||||
<appender name="AsyncPerfLogAppender" class="org.apache.log4j.AsyncAppender">
|
||||
<param name="BufferSize" value="500"/>
|
||||
<appender-ref ref="PerformanceLogAppender"/>
|
||||
</appender>
|
||||
<logger name="PerformanceLogger" additivity="false">
|
||||
<level value="ALL"/>
|
||||
<appender-ref ref="AsyncPerfLogAppender"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon">
|
||||
<level value="INFO"/>
|
||||
|
|
|
@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
com.raytheon.uf.common.event;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
org.eclipse.ui;bundle-version="3.6.1"
|
||||
org.eclipse.ui;bundle-version="3.6.1",
|
||||
org.apache.log4j;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.event
|
||||
|
|
|
@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.common.cache;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.stats;bundle-version="1.0.0",
|
||||
com.raytheon.uf.viz.stats;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.event;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.event;bundle-version="1.0.0",
|
||||
org.apache.log4j;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.raytheon.uf.common.colormap,
|
||||
|
|
|
@ -42,6 +42,10 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.RGBColors;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.BasinTrendCommon.PlotItems;
|
||||
|
@ -65,6 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Initial creation
|
||||
* Dec 6, 2012 1353 rferrel Code clean up for non-blocking dialog.
|
||||
* Feb 10, 2013 1584 mpduff Add performance logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,6 +77,13 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class BasinTrendDlg extends CaveSWTDialog {
|
||||
/** Performance log message prefix */
|
||||
private final String prefix = "FFMP Basin Trend:";
|
||||
|
||||
/** Performance logger */
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler(prefix);
|
||||
|
||||
/**
|
||||
* Main composite.
|
||||
*/
|
||||
|
@ -141,12 +153,12 @@ public class BasinTrendDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* QPFSCAN radio button.
|
||||
*/
|
||||
private List<Button> qpfRdos = new ArrayList<Button>();
|
||||
private final List<Button> qpfRdos = new ArrayList<Button>();
|
||||
|
||||
/**
|
||||
* RFCFFG radio button.
|
||||
*/
|
||||
private List<Button> ffgRdos = new ArrayList<Button>();
|
||||
private final List<Button> ffgRdos = new ArrayList<Button>();
|
||||
|
||||
/**
|
||||
* Background color for controls and graph.
|
||||
|
@ -221,7 +233,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Date/Time format.
|
||||
*/
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("MMM dd yy HH:mm z");
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"MMM dd yy HH:mm z");
|
||||
|
||||
private boolean vgb = false;
|
||||
|
||||
|
@ -229,7 +242,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
|
|||
|
||||
private Date currentDate;
|
||||
|
||||
private FFMPResource resource;
|
||||
/** The FFMP Resource */
|
||||
private final FFMPResource resource;
|
||||
|
||||
private final List<ISourceUpdate> sourceListeners = new ArrayList<ISourceUpdate>();
|
||||
|
||||
|
@ -238,6 +252,14 @@ public class BasinTrendDlg extends CaveSWTDialog {
|
|||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
* @param resource
|
||||
* The Resource
|
||||
* @param date
|
||||
* The Date
|
||||
* @param pfaf
|
||||
* The pfaf
|
||||
* @param vgb
|
||||
* The VGB
|
||||
* @param graphData
|
||||
* Graph data.
|
||||
*/
|
||||
|
@ -1000,6 +1022,9 @@ public class BasinTrendDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private void updatePlotSelection(Button plotBtn,
|
||||
boolean updateLegendAndGraph) {
|
||||
ITimer timer = TimeUtil.getTimer();
|
||||
timer.start();
|
||||
|
||||
PlotItems plotItem = (PlotItems) plotBtn.getData();
|
||||
|
||||
if (plotItem == PlotItems.RATE) {
|
||||
|
@ -1056,6 +1081,9 @@ public class BasinTrendDlg extends CaveSWTDialog {
|
|||
updateColorLegend();
|
||||
updateGraph();
|
||||
}
|
||||
|
||||
timer.stop();
|
||||
perfLog.logDuration("Graph update", timer.getElapsedTime());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,9 +57,14 @@ import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
|||
import com.raytheon.uf.common.monitor.config.FFMPTemplateConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.xml.DomainXML;
|
||||
import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
|
||||
import com.raytheon.uf.common.stats.LoadEvent;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
||||
|
@ -85,6 +90,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResource;
|
|||
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataLoader;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
||||
import com.raytheon.uf.viz.stats.collector.StatsCollector;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
|
@ -105,6 +111,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Changes for non-blocking AttributesDlg.
|
||||
* Changes for non-blocking AttributeThresholdDlg.
|
||||
* Changes for non-blocking LoadSaveConfigDlg.
|
||||
* Feb 10, 2013 1584 mpduff Add performance logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -118,11 +125,21 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FfmpBasinTableDlg.class);
|
||||
|
||||
/** Performance message prefix */
|
||||
private final String prefix = "FFMP Basin Table:";
|
||||
|
||||
/** Performance logger */
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler(prefix);
|
||||
|
||||
private final String initialLoadKey = "FFMP Basin Table Initial Load";
|
||||
|
||||
private LoadSaveConfigDlg loadDlg;
|
||||
|
||||
private LoadSaveConfigDlg saveDlg;
|
||||
|
||||
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
|
||||
/** Retrieval queue */
|
||||
private final List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
|
||||
|
||||
private MenuItem linkToFrameMI;
|
||||
|
||||
|
@ -199,7 +216,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
|
||||
private final List<String> cwas = new ArrayList<String>();
|
||||
|
||||
private List<MenuItem> sourceMenuItems = new ArrayList<MenuItem>();
|
||||
/** Source menu item list */
|
||||
private final List<MenuItem> sourceMenuItems = new ArrayList<MenuItem>();
|
||||
|
||||
private Date date = null;
|
||||
|
||||
|
@ -236,6 +254,16 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
|
||||
private boolean groupLabelFlag = true;
|
||||
|
||||
/**
|
||||
* Statistics load event.
|
||||
*/
|
||||
private LoadEvent loadEvent;
|
||||
|
||||
/**
|
||||
* Previously selected HUC level
|
||||
*/
|
||||
private String previousHuc;
|
||||
|
||||
public FfmpBasinTableDlg(Shell parent, FFMPTableData tData,
|
||||
FFMPResource resource) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
|
||||
|
@ -298,6 +326,13 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
// Load time stat
|
||||
loadEvent = new LoadEvent();
|
||||
loadEvent.setType("FFMP Initial Load");
|
||||
loadEvent.setMessage("FFMP Basin Table Initial Load");
|
||||
StatsCollector.start(initialLoadKey, loadEvent);
|
||||
perfLog.log("Launched");
|
||||
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
@Override
|
||||
public void shellClosed(ShellEvent e) {
|
||||
|
@ -337,7 +372,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
refreshDisplay(true);
|
||||
}
|
||||
|
||||
public void createMenus() {
|
||||
/**
|
||||
* Create the menus.
|
||||
*/
|
||||
private void createMenus() {
|
||||
Menu menuBar = new Menu(shell, SWT.BAR);
|
||||
|
||||
createFileMenu(menuBar);
|
||||
|
@ -750,6 +788,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
cwaMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
MenuItem mi = (MenuItem) event.getSource();
|
||||
perfLog.log("CWA " + mi.getText()
|
||||
+ (mi.getSelection() ? " selected" : " unselected"));
|
||||
updateD2DRefresh();
|
||||
updateCWA(event);
|
||||
}
|
||||
|
@ -1278,6 +1319,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
public void attributeDisplayAction(boolean updateData,
|
||||
AttributesDlgData attrData) {
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
ITimer timer = TimeUtil.getTimer();
|
||||
timer.start();
|
||||
|
||||
this.attrData = attrData;
|
||||
|
||||
// Update the data in the FFMPConfig with the selections
|
||||
|
@ -1311,6 +1355,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
shell.pack();
|
||||
shell.redraw();
|
||||
resetCursor();
|
||||
timer.stop();
|
||||
perfLog.logDuration("Column Add/Remove time", timer.getElapsedTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1566,15 +1612,19 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
fireCWAChangedEvent(mi.getText(), mi.getSelection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the layer.
|
||||
*/
|
||||
private void updateLayer(SelectionEvent event) {
|
||||
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
|
||||
updateD2DRefresh();
|
||||
|
||||
MenuItem mi = (MenuItem) event.getSource();
|
||||
String huc = (String) mi.getData();
|
||||
String msg = previousHuc + " to " + mi.getText();
|
||||
perfLog.log("Update Layer Called, " + msg);
|
||||
|
||||
String huc = (String) mi.getData();
|
||||
previousHuc = mi.getText();
|
||||
ffmpConfig.getFFMPConfigData().setLayer(huc);
|
||||
fireHucChangedEvent(huc);
|
||||
}
|
||||
|
@ -1611,6 +1661,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
* Fire Table reload event
|
||||
*/
|
||||
private void fireTableRestoreEvent() {
|
||||
perfLog.log("Table Restore Called");
|
||||
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
groupLbl.setText("");
|
||||
|
@ -1635,6 +1686,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
this);
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FFMPMonitor.getInstance().configUpdate(me);
|
||||
}
|
||||
|
@ -1661,6 +1713,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
try {
|
||||
setGraphData(resource.getGraphData(pfaf), pfaf,
|
||||
differentPfaf, ffmpDate);
|
||||
perfLog.log("Graph Display Complete");
|
||||
} catch (VizException e) {
|
||||
shell.setCursor(null);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
|
@ -1680,27 +1733,32 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
public void resetData(FFMPTableData tData) {
|
||||
if (!ffmpTable.isDisposed()) {
|
||||
this.mainTableData = tData;
|
||||
// System.out.println("---" + tData.getTableRows().size());
|
||||
ffmpTable.clearTableSelection();
|
||||
// long time = System.currentTimeMillis();
|
||||
ffmpTable
|
||||
.setCenteredAggregationKey(resource.centeredAggregationKey);
|
||||
ffmpTable.setTableData(mainTableData);
|
||||
// long time1 = System.currentTimeMillis();
|
||||
|
||||
resetCursor();
|
||||
shell.pack();
|
||||
shell.redraw();
|
||||
|
||||
// System.out
|
||||
// .println("Time to load Data into table " + (time1 - time));
|
||||
if (loadEvent != null) {
|
||||
StatsCollector.stop(initialLoadKey);
|
||||
loadEvent = null;
|
||||
}
|
||||
perfLog.log("Table update complete");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void tableSelection(String pfaf, String name) {
|
||||
if (groupLbl.getText().length() > 0) {
|
||||
groupLabelFlag = false;
|
||||
} else {
|
||||
perfLog.log("Table Selection");
|
||||
}
|
||||
|
||||
if ((groupLbl.getText().length() == 0)
|
||||
|
@ -1712,10 +1770,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
fireScreenRecenterEvent(pfaf, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void displayBasinTrend(String pfaf) {
|
||||
if (pfaf != null) {
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
perfLog.log("Basin Trend Graph Launch");
|
||||
fireGraphDataEvent(pfaf, true, this.date);
|
||||
}
|
||||
}
|
||||
|
@ -1822,6 +1884,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
|
||||
if (menuDataType.compareTo(layer) == 0) {
|
||||
mi.setSelection(true);
|
||||
this.previousHuc = mi.getText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2059,9 +2122,11 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
resource.manageLoaders(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void notify(IMonitorEvent me) {
|
||||
|
||||
if (!this.isDisposed()) {
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
FFMPTableDataLoader tableLoader = new FFMPTableDataLoader(me,
|
||||
|
@ -2160,11 +2225,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
updateGapValueLabel(fupdateData.getGapValueLabel());
|
||||
|
||||
resetCursor();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* used to blank the group label when channging HUC while in an aggregate.
|
||||
* used to blank the group label when changing HUC while in an aggregate.
|
||||
*/
|
||||
public void blankGroupLabel() {
|
||||
if (groupLbl != null) {
|
||||
|
|
|
@ -77,10 +77,13 @@ import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
|||
import com.raytheon.uf.common.monitor.xml.DomainXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
import com.raytheon.uf.common.monitor.xml.SourceXML;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
|
@ -156,6 +159,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* 10 Jan 2013 1475 dhladky Some cleanup
|
||||
* 27 Jan 2013 1478 dhladky Changed gap collection to a generic list instead of Arraylist
|
||||
* 02/01/13 1569 D. Hladky Added constants
|
||||
* 10 Feb 2013 1584 mpduff Add performance logging.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -167,9 +171,17 @@ public class FFMPResource extends
|
|||
IResourceDataChanged, IFFMPResourceListener, FFMPListener,
|
||||
FFMPLoadListener {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
/** Status handler */
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPResource.class);
|
||||
|
||||
/** Performance log statement prefix */
|
||||
private final String prefix = "FFMP Resource:";
|
||||
|
||||
/** Performance logger */
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler(prefix);
|
||||
|
||||
/**
|
||||
* The zoom level for an aggregate view.
|
||||
*/
|
||||
|
@ -224,7 +236,7 @@ public class FFMPResource extends
|
|||
private IShadedShape streamShadedShape = null;
|
||||
|
||||
/** always the same vertexes, one for each CWA **/
|
||||
private FFMPShapeContainer shadedShapes = new FFMPShapeContainer();
|
||||
private final FFMPShapeContainer shadedShapes = new FFMPShapeContainer();
|
||||
|
||||
/** Basin shaded shape **/
|
||||
protected ConcurrentHashMap<DataTime, FFMPDrawable> drawables = new ConcurrentHashMap<DataTime, FFMPDrawable>();
|
||||
|
@ -257,6 +269,7 @@ public class FFMPResource extends
|
|||
public boolean handleMouseUp(int x, int y, int mouseButton) {
|
||||
if (mouseButton == 3) {
|
||||
if (isStreamFollow()) {
|
||||
perfLog.log("Basin Trace Draw Init");
|
||||
traceClick(getResourceContainer().translateClick(x, y));
|
||||
return true;
|
||||
}
|
||||
|
@ -414,9 +427,13 @@ public class FFMPResource extends
|
|||
dataTimes = new ArrayList<DataTime>();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
|
||||
ITimer timer = TimeUtil.getTimer();
|
||||
timer.start();
|
||||
if (type.equals(ChangeType.DATA_UPDATE)) {
|
||||
FFFGDataMgr.getUpdatedInstance();
|
||||
PluginDataObject[] pdos = (PluginDataObject[]) object;
|
||||
|
@ -494,6 +511,11 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
refresh();
|
||||
|
||||
if (type.equals(ChangeType.DATA_UPDATE)) {
|
||||
timer.stop();
|
||||
perfLog.logDuration("Load Time", timer.getElapsedTime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -522,6 +544,9 @@ public class FFMPResource extends
|
|||
issueRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void hucChanged() {
|
||||
|
||||
|
@ -533,6 +558,7 @@ public class FFMPResource extends
|
|||
dirty();
|
||||
issueRefresh();
|
||||
}
|
||||
perfLog.log("HUC Change complete");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1117,6 +1143,7 @@ public class FFMPResource extends
|
|||
// DR 14522: use Display.getDefault().asyncExec() for GUI thread.
|
||||
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (/* this. */font == null) {
|
||||
|
@ -1403,7 +1430,7 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
// draw stream trace?
|
||||
if (getShowStream() && isStreamFollow()) {
|
||||
if (isShowStream() && isStreamFollow()) {
|
||||
paintUpAndDownStream(aTarget, paintProps, isShaded);
|
||||
}
|
||||
|
||||
|
@ -1465,11 +1492,11 @@ public class FFMPResource extends
|
|||
.getColor();
|
||||
}
|
||||
|
||||
if (getShowStream() && (streamShadedShape != null)
|
||||
if (isShowStream() && (streamShadedShape != null)
|
||||
&& streamShadedShape.isDrawable() && isShaded) {
|
||||
target.drawShadedShape(streamShadedShape, paintProps.getAlpha());
|
||||
}
|
||||
if (getShowStream() && (streamOutlineShape != null)
|
||||
if (isShowStream() && (streamOutlineShape != null)
|
||||
&& streamOutlineShape.isDrawable()
|
||||
&& getCapability(OutlineCapability.class).isOutlineOn()) {
|
||||
target.drawWireframeShape(streamOutlineShape, basinTraceColor,
|
||||
|
@ -1808,7 +1835,6 @@ public class FFMPResource extends
|
|||
if (!stream.equals(FFMPRecord.CLICK_TYPE.TREND)) {
|
||||
nextStreamPfaf = newPfaf;
|
||||
dirty();
|
||||
|
||||
}
|
||||
} else {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
|
@ -1976,6 +2002,7 @@ public class FFMPResource extends
|
|||
/**
|
||||
* close our dialog(s)
|
||||
*/
|
||||
@Override
|
||||
public void closeDialog() {
|
||||
monitor.closeDialog(this);
|
||||
}
|
||||
|
@ -1989,6 +2016,7 @@ public class FFMPResource extends
|
|||
/**
|
||||
* set the query runner
|
||||
*/
|
||||
@Override
|
||||
public void setQuery(boolean isQuery) {
|
||||
this.isQuery = isQuery;
|
||||
}
|
||||
|
@ -1996,6 +2024,7 @@ public class FFMPResource extends
|
|||
/**
|
||||
* clear them
|
||||
*/
|
||||
@Override
|
||||
public void clear() {
|
||||
if (drawables != null) {
|
||||
for (Entry<DataTime, FFMPDrawable> entry : drawables.entrySet()) {
|
||||
|
@ -2009,6 +2038,7 @@ public class FFMPResource extends
|
|||
/**
|
||||
* Set them all for re-rendering
|
||||
*/
|
||||
@Override
|
||||
public void dirty() {
|
||||
if (drawables != null) {
|
||||
for (Entry<DataTime, FFMPDrawable> entry : drawables.entrySet()) {
|
||||
|
@ -2055,6 +2085,7 @@ public class FFMPResource extends
|
|||
*
|
||||
* @param paintTime
|
||||
*/
|
||||
@Override
|
||||
public void setPaintTime(DataTime paintTime) {
|
||||
this.paintTime = paintTime;
|
||||
}
|
||||
|
@ -2070,7 +2101,7 @@ public class FFMPResource extends
|
|||
private void drawSquare(PixelCoverage pc, IGraphicsTarget target)
|
||||
throws VizException {
|
||||
|
||||
//target.drawLine(lines)
|
||||
// target.drawLine(lines)
|
||||
target.drawLine(pc.getLl().x, pc.getLl().y, 0.0, pc.getUl().x, pc
|
||||
.getUl().y, 0.0, getCapability(ColorableCapability.class)
|
||||
.getColor(), getCapability(OutlineCapability.class)
|
||||
|
@ -2283,6 +2314,7 @@ public class FFMPResource extends
|
|||
/**
|
||||
* Clear the worst case hash
|
||||
*/
|
||||
@Override
|
||||
public void clearWorstCase() {
|
||||
for (Entry<DataTime, FFMPDrawable> entry : drawables.entrySet()) {
|
||||
entry.getValue().worstCaseHash.clear();
|
||||
|
@ -2370,10 +2402,10 @@ public class FFMPResource extends
|
|||
private class FFMPDataRetrievalJob extends Job {
|
||||
private static final int QUEUE_LIMIT = 1;
|
||||
|
||||
private HucLevelGeometriesFactory hucGeomFactory = HucLevelGeometriesFactory
|
||||
private final HucLevelGeometriesFactory hucGeomFactory = HucLevelGeometriesFactory
|
||||
.getInstance();
|
||||
|
||||
private ArrayBlockingQueue<Request> requestQueue = new ArrayBlockingQueue<Request>(
|
||||
private final ArrayBlockingQueue<Request> requestQueue = new ArrayBlockingQueue<Request>(
|
||||
QUEUE_LIMIT);
|
||||
|
||||
public FFMPDataRetrievalJob() {
|
||||
|
@ -2955,7 +2987,7 @@ public class FFMPResource extends
|
|||
|
||||
streamOutlineShape = localWireframeShape;
|
||||
streamShadedShape = localShadedShape;
|
||||
|
||||
perfLog.log("Basin Trace Shapes Complete");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3034,7 +3066,8 @@ public class FFMPResource extends
|
|||
|
||||
@Override
|
||||
public void hucChanged(FFMPHUCChangeEvent fhce) {
|
||||
|
||||
ITimer timer = TimeUtil.getTimer();
|
||||
timer.start();
|
||||
setHuc((String) fhce.getSource());
|
||||
centeredAggregationKey = null;
|
||||
centeredAggregatePfafList = null;
|
||||
|
@ -3050,6 +3083,8 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
updateDialog();
|
||||
timer.stop();
|
||||
perfLog.logDuration("HUC Update complete", timer.getElapsedTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3201,8 +3236,13 @@ public class FFMPResource extends
|
|||
this.isLinkToFrame = isLinkToFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public FFMPGraphData getGraphData(String pfafString) throws VizException {
|
||||
ITimer timer = TimeUtil.getTimer();
|
||||
timer.start();
|
||||
FfmpTableConfig tableConfig = FfmpTableConfig.getInstance();
|
||||
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey())
|
||||
.getFfgGraphType();
|
||||
|
@ -3468,14 +3508,23 @@ public class FFMPResource extends
|
|||
}
|
||||
}
|
||||
}
|
||||
timer.stop();
|
||||
perfLog.logDuration("Graph Data processing", timer.getElapsedTime());
|
||||
|
||||
return fgd;
|
||||
}
|
||||
|
||||
public boolean getShowStream() {
|
||||
/**
|
||||
* @return showStream
|
||||
*/
|
||||
public boolean isShowStream() {
|
||||
return showStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setBasinToggle(boolean val) {
|
||||
showBasin = val;
|
||||
refresh();
|
||||
|
@ -3501,6 +3550,10 @@ public class FFMPResource extends
|
|||
refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setStreamToggle(boolean val) {
|
||||
showStream = val;
|
||||
refresh();
|
||||
|
@ -3547,8 +3600,8 @@ public class FFMPResource extends
|
|||
|
||||
synchronized (tableTime) {
|
||||
Date recentTime = getMostRecentTime();
|
||||
long time = new Double(recentTime.getTime() - (TimeUtil.MILLIS_PER_HOUR)
|
||||
* getTime()).longValue();
|
||||
long time = new Double(recentTime.getTime()
|
||||
- (TimeUtil.MILLIS_PER_HOUR) * getTime()).longValue();
|
||||
Date date = new Date();
|
||||
date.setTime(time);
|
||||
this.tableTime = date;
|
||||
|
@ -3779,6 +3832,7 @@ public class FFMPResource extends
|
|||
/**
|
||||
* update the data in the dialog
|
||||
*/
|
||||
@Override
|
||||
public void updateDialog() {
|
||||
if (basinTableDlg != null) {
|
||||
monitor.fireMonitorEvent(basinTableDlg.getClass().getName());
|
||||
|
@ -3879,6 +3933,10 @@ public class FFMPResource extends
|
|||
return isWorstCase;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoRefresh() {
|
||||
return isAutoRefresh;
|
||||
}
|
||||
|
@ -4007,7 +4065,8 @@ public class FFMPResource extends
|
|||
|
||||
this.qpeSourceExpiration = monitor.getSourceConfig()
|
||||
.getSource(resourceData.getPrimarySource())
|
||||
.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
|
||||
.getExpirationMinutes(getSiteKey())
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
}
|
||||
return qpeSourceExpiration;
|
||||
}
|
||||
|
@ -4030,7 +4089,8 @@ public class FFMPResource extends
|
|||
source = FFMPSourceConfigurationManager.getInstance()
|
||||
.getSource(getResourceData().sourceName);
|
||||
}
|
||||
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
|
||||
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey())
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
}
|
||||
return qpfSourceExpiration;
|
||||
}
|
||||
|
@ -4053,12 +4113,14 @@ public class FFMPResource extends
|
|||
SourceXML source = getProduct().getGuidanceSourcesByType(
|
||||
guidSrc).get(0);
|
||||
guidSourceExpiration = source
|
||||
.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
|
||||
.getExpirationMinutes(getSiteKey())
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
|
||||
} else {
|
||||
guidSourceExpiration = monitor.getSourceConfig()
|
||||
.getSource(resourceData.getPrimarySource())
|
||||
.getExpirationMinutes(getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
|
||||
.getExpirationMinutes(getSiteKey())
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ import com.raytheon.uf.common.monitor.xml.DomainXML;
|
|||
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
import com.raytheon.uf.common.monitor.xml.SourceXML;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
@ -73,6 +75,7 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 29 June, 2009 2521 dhladky Initial creation
|
||||
* 02/01/13 1569 D. Hladky Added constants
|
||||
* Feb 10, 2013 1584 mpduff Add performance logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -85,6 +88,13 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPResourceData.class);
|
||||
|
||||
/** Performance log entry prefix */
|
||||
private final String prefix = "FFMP ResourceData:";
|
||||
|
||||
/** Performance logger */
|
||||
private final IPerformanceStatusHandler perfLog = PerformanceStatus
|
||||
.getHandler(prefix);
|
||||
|
||||
public boolean tableLoad = false;
|
||||
|
||||
@XmlAttribute
|
||||
|
@ -158,11 +168,13 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected AbstractVizResource<?, ?> constructResource(
|
||||
LoadProperties loadProperties, PluginDataObject[] objects)
|
||||
throws VizException {
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
||||
|
@ -171,8 +183,8 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
monitor.setWfo(wfo);
|
||||
this.field = monitor.getField(sourceName);
|
||||
|
||||
System.out.println("Loading FFMP: source: " + sourceName + " site: "
|
||||
+ siteKey + " data: " + dataKey + " WFO: " + wfo + " HUC: "
|
||||
perfLog.log("Loading FFMP: source: " + sourceName + ", site: "
|
||||
+ siteKey + ", data: " + dataKey + ", WFO: " + wfo + ", HUC: "
|
||||
+ huc);
|
||||
|
||||
DataTime[] availableTimes = this.getAvailableTimes();
|
||||
|
@ -233,7 +245,8 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
this.timeBack = new Date(
|
||||
(long) (mostRecentTime.getRefTime().getTime() - (cfgBasinXML
|
||||
.getTimeFrame() * TimeUtil.MILLIS_PER_HOUR)));
|
||||
ArrayList<String> hucsToLoad = monitor.getTemplates(siteKey).getTemplateMgr().getHucLevels();
|
||||
ArrayList<String> hucsToLoad = monitor.getTemplates(siteKey)
|
||||
.getTemplateMgr().getHucLevels();
|
||||
// goes back X hours and pre populates the Data Hashes
|
||||
FFMPDataLoader loader = new FFMPDataLoader(this, timeBack,
|
||||
mostRecentTime.getRefTime(), LOADER_TYPE.INITIAL,
|
||||
|
@ -277,23 +290,25 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
Date standAloneTime = null;
|
||||
|
||||
if (source != null) {
|
||||
// Special Loading for guidance sources, as mentioned in the comment
|
||||
if (source.getDataType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
// Special Loading for guidance sources, as mentioned in the
|
||||
// comment
|
||||
if (source.getDataType().equals(
|
||||
SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
long oldestTime = availableTimes[0].getRefTime()
|
||||
.getTime();
|
||||
.getTime();
|
||||
long expirationTime = source
|
||||
.getExpirationMinutes(siteKey) * TimeUtil.MILLIS_PER_MINUTE;
|
||||
standAloneTime = new Date(oldestTime
|
||||
- expirationTime);
|
||||
.getExpirationMinutes(siteKey)
|
||||
* TimeUtil.MILLIS_PER_MINUTE;
|
||||
standAloneTime = new Date(oldestTime - expirationTime);
|
||||
} else {
|
||||
// Only load current frames time
|
||||
// Only load current frames time
|
||||
standAloneTime = availableTimes[availableTimes.length - 1]
|
||||
.getRefTime();
|
||||
.getRefTime();
|
||||
}
|
||||
|
||||
NavigableMap<Date, List<String>> sourceURIs = getMonitor()
|
||||
.getAvailableUris(siteKey, dataKey, sourceName,
|
||||
standAloneTime);
|
||||
.getAvailableUris(siteKey, dataKey, sourceName,
|
||||
standAloneTime);
|
||||
getMonitor().processUris(sourceURIs, false, siteKey,
|
||||
sourceName, standAloneTime, FFMPRecord.ALL);
|
||||
}
|
||||
|
|
|
@ -13,9 +13,12 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||
com.google.guava;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.units;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.units;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.event;bundle-version="1.0.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.stats,
|
||||
com.raytheon.uf.viz.stats.collector,
|
||||
com.raytheon.uf.viz.stats.ui,
|
||||
com.raytheon.uf.viz.stats.utils
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.stats.collector;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.raytheon.uf.common.event.EventBus;
|
||||
import com.raytheon.uf.common.stats.StatisticsEvent;
|
||||
|
||||
/**
|
||||
* Statistics Collector used to collect stats from different locations.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 8, 2013 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class StatsCollector {
|
||||
private static final StatsCollector instance = new StatsCollector();
|
||||
|
||||
/**
|
||||
* Concurrent map of events -> start time in ms.
|
||||
*/
|
||||
private final ConcurrentMap<String, StatisticsEvent> statsDataMap = new ConcurrentHashMap<String, StatisticsEvent>();
|
||||
|
||||
private StatsCollector() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance.
|
||||
*
|
||||
* @return The instance
|
||||
*/
|
||||
public static final StatsCollector getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a start point for this event.
|
||||
*
|
||||
* @param key
|
||||
* The Statistics key
|
||||
*
|
||||
* @param event
|
||||
* The event to track
|
||||
*/
|
||||
public static void start(String key, StatisticsEvent event) {
|
||||
getInstance().setStart(key, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a stop point for this event.
|
||||
*
|
||||
* @param key
|
||||
* StatisticsEvent
|
||||
*/
|
||||
public static void stop(String key) {
|
||||
getInstance().setStop(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a start point for this event.
|
||||
*
|
||||
* @param key
|
||||
* The Statistics key
|
||||
* @param event
|
||||
* The event to track
|
||||
*/
|
||||
public void setStart(String key, StatisticsEvent event) {
|
||||
statsDataMap.put(key, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a stop point for this id.
|
||||
*
|
||||
* @param key
|
||||
* The Statistics key
|
||||
*/
|
||||
public void setStop(String key) {
|
||||
StatisticsEvent event = statsDataMap.remove(key);
|
||||
event.finalizeEvent();
|
||||
|
||||
EventBus.publish(event);
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ import java.net.InetAddress;
|
|||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Constants for CAVE statistics.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -54,12 +54,10 @@ public class StatsConstants {
|
|||
private static final String release = defineRelease();
|
||||
|
||||
/**
|
||||
* @return Hostname of the workstation running CAVE
|
||||
* Return the host name.
|
||||
*
|
||||
* @return the host name
|
||||
*/
|
||||
public static String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
private static String defineHostName() {
|
||||
String hn = null;
|
||||
InetAddress addr;
|
||||
|
@ -73,6 +71,11 @@ public class StatsConstants {
|
|||
return hn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the release that is currently running.
|
||||
*
|
||||
* @return The release
|
||||
*/
|
||||
private static String defineRelease() {
|
||||
String release = null;
|
||||
BufferedReader in = null;
|
||||
|
@ -107,4 +110,11 @@ public class StatsConstants {
|
|||
public static String getRelease() {
|
||||
return release;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Hostname of the workstation running CAVE
|
||||
*/
|
||||
public static String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,21 +41,20 @@ import org.apache.commons.logging.LogFactory;
|
|||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
//import com.raytheon.edex.transform.shef.MetarToShefTransformer;
|
||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
|
||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter;
|
||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
||||
|
||||
/**
|
||||
* Use information in metarToShefFilter.xml, MetarToShefFilter filters out
|
||||
* the metar messages before send the message to MetarToShefTransformer to
|
||||
* encode to a SHEF message.
|
||||
* Use information in metarToShefFilter.xml, MetarToShefFilter filters out the
|
||||
* metar messages before send the message to MetarToShefTransformer to encode to
|
||||
* a SHEF message.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -63,6 +62,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
|||
* Date Ticket# Engineer Description
|
||||
* ---------- ------- -------- --------------------------
|
||||
* 1/10/2013 15497 wkwock Initial creation
|
||||
* 2/13/2013 1584 mpduff Fix creation of "dummy" config.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,7 +72,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
|||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class MetarToShefFilter {
|
||||
public class MetarToShefFilter {
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected List<MetarToShefRun> metarToShefRun = new ArrayList<MetarToShefRun>();
|
||||
|
@ -82,12 +82,13 @@ public class MetarToShefFilter {
|
|||
private static final String ERROR_2_FMT = "File %s does not exist";
|
||||
|
||||
private static final String METAR_CFG = "metar.cfg";
|
||||
|
||||
public static final String FILTERS_DIR = "plugin-filters";
|
||||
|
||||
private String metarToShefOptions = AppsDefaults.getInstance().getToken("metar2shef_options");
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
public static final String FILTERS_DIR = "plugin-filters";
|
||||
|
||||
private final String metarToShefOptions = AppsDefaults.getInstance()
|
||||
.getToken("metar2shef_options");
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private String filterConfigFile = null;
|
||||
|
||||
|
@ -99,9 +100,10 @@ public class MetarToShefFilter {
|
|||
try {
|
||||
File filterDir = null;
|
||||
IPathManager manager = PathManagerFactory.getPathManager();
|
||||
if(manager != null) {
|
||||
LocalizationContext context = manager.getContext(EDEX_STATIC, LocalizationLevel.valueOf(localContext));
|
||||
if(context != null) {
|
||||
if (manager != null) {
|
||||
LocalizationContext context = manager.getContext(EDEX_STATIC,
|
||||
LocalizationLevel.valueOf(localContext));
|
||||
if (context != null) {
|
||||
filterDir = manager.getFile(context, FILTERS_DIR);
|
||||
if (filterDir.exists()) {
|
||||
File srcFile = new File(filterDir, filterConfigFile);
|
||||
|
@ -113,73 +115,84 @@ public class MetarToShefFilter {
|
|||
stream.read(data);
|
||||
stream.close();
|
||||
Object obj = SerializationUtil
|
||||
.unmarshalFromXml(new String(data));
|
||||
if (obj instanceof PluginDataObjectFilter){
|
||||
logger.info("Found "+filterConfigFile+" is PluginDataObjectFilter");
|
||||
PluginDataObjectFilter pdof=(PluginDataObjectFilter) obj;
|
||||
MetarToShefRun mtsr= new MetarToShefRun();
|
||||
.unmarshalFromXml(new String(data));
|
||||
if (obj instanceof PluginDataObjectFilter) {
|
||||
logger.info("Found " + filterConfigFile
|
||||
+ " is PluginDataObjectFilter");
|
||||
PluginDataObjectFilter pdof = (PluginDataObjectFilter) obj;
|
||||
MetarToShefRun mtsr = new MetarToShefRun();
|
||||
mtsr.setConfigFileName(METAR_CFG);
|
||||
mtsr.setMetarToShefOptions(metarToShefOptions);
|
||||
mtsr.setFilterElements(pdof.getFilterElements());
|
||||
mtsr.setFilterName(pdof.getFilterName());
|
||||
this.metarToShefRun.add(mtsr);
|
||||
}else if (obj instanceof MetarToShefFilter) {
|
||||
MetarToShefFilter filter = (MetarToShefFilter) obj;
|
||||
this.metarToShefRun=filter.metarToShefRun;
|
||||
logger.info("Found "+filterConfigFile+" is MetarToShefFilter");
|
||||
}else {
|
||||
logger.error("Found "+filterConfigFile+" is "+obj.getClass().getCanonicalName());
|
||||
createDummyFilter();
|
||||
}
|
||||
} else if (obj instanceof MetarToShefFilter) {
|
||||
MetarToShefFilter filter = (MetarToShefFilter) obj;
|
||||
this.metarToShefRun = filter.metarToShefRun;
|
||||
logger.info("Found " + filterConfigFile
|
||||
+ " is MetarToShefFilter");
|
||||
} else {
|
||||
logger.error("Found " + filterConfigFile
|
||||
+ " is "
|
||||
+ obj.getClass().getCanonicalName());
|
||||
createDummyFilter();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("Unable to read filter config", e);
|
||||
} catch (JAXBException e) {
|
||||
logger.error("Unable to unmarshall filter config", e);
|
||||
logger.error("Unable to unmarshall filter config",
|
||||
e);
|
||||
}
|
||||
} else {
|
||||
logger.error(String.format(ERROR_2_FMT,filterDir.getPath()));
|
||||
logger.error(String.format(ERROR_2_FMT,
|
||||
filterDir.getPath()));
|
||||
createDummyFilter();
|
||||
}
|
||||
} else {
|
||||
logger.error(String.format(ERROR_1_FMT, localContext,configFile));
|
||||
logger.error(String.format(ERROR_1_FMT, localContext,
|
||||
configFile));
|
||||
createDummyFilter();
|
||||
}
|
||||
} else {
|
||||
// Could not create PathManager
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(
|
||||
"Error creating filter.", e);
|
||||
logger.error("Error creating filter.", e);
|
||||
createDummyFilter();
|
||||
}
|
||||
|
||||
for (MetarToShefRun mtsr: metarToShefRun){
|
||||
logger.info("Filter name = " + mtsr.getFilterName()+" with config file: "+mtsr.getConfigFileName());
|
||||
for (MetarToShefRun mtsr : metarToShefRun) {
|
||||
logger.info("Filter name = " + mtsr.getFilterName()
|
||||
+ " with config file: " + mtsr.getConfigFileName());
|
||||
}
|
||||
}
|
||||
|
||||
private PluginDataObject[] filterARun(PluginDataObject[] reports, List<AbstractFilterElement> filterElements) {
|
||||
private PluginDataObject[] filterARun(PluginDataObject[] reports,
|
||||
List<AbstractFilterElement> filterElements) {
|
||||
int reportCount = 0;
|
||||
if (reports != null) {
|
||||
|
||||
|
||||
for (int i = 0; i < reports.length; i++) {
|
||||
PluginDataObject r = null;
|
||||
boolean keep = true;
|
||||
for (AbstractFilterElement element : filterElements) {
|
||||
r = element.filter(reports[i]);
|
||||
|
||||
// Only allow keep to be set to true. Once true it stays that way.
|
||||
if(AbstractObsFilter.INCLUDE_TYPE.equals(element.getFilterType())) {
|
||||
|
||||
// Only allow keep to be set to true. Once true it stays
|
||||
// that way.
|
||||
if (AbstractObsFilter.INCLUDE_TYPE.equals(element
|
||||
.getFilterType())) {
|
||||
// Did the filter pass?
|
||||
if(r == null) {
|
||||
// If we fail an element, exit now.
|
||||
if (r == null) {
|
||||
// If we fail an element, exit now.
|
||||
keep = false;
|
||||
break;
|
||||
}
|
||||
} else if(AbstractObsFilter.EXCLUDE_TYPE.equals(element.getFilterType())) {
|
||||
if(r != null) {
|
||||
// There was a match, so we want to remove this item.
|
||||
} else if (AbstractObsFilter.EXCLUDE_TYPE.equals(element
|
||||
.getFilterType())) {
|
||||
if (r != null) {
|
||||
// There was a match, so we want to remove this
|
||||
// item.
|
||||
keep = false;
|
||||
// And there's no reason for further checks.
|
||||
break;
|
||||
|
@ -208,29 +221,30 @@ public class MetarToShefFilter {
|
|||
}
|
||||
return reports;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the list of filters against given input data.
|
||||
*
|
||||
*/
|
||||
// @Override
|
||||
// @Override
|
||||
public PluginDataObject[] filter(PluginDataObject[] reports) {
|
||||
PluginDataObject[] resultRpt=null;
|
||||
for (MetarToShefRun mtsr : metarToShefRun) {
|
||||
PluginDataObject[] tmpRprts = reports.clone();
|
||||
resultRpt=filterARun(tmpRprts,mtsr.getFilterElements());
|
||||
if (resultRpt!=null && resultRpt.length>=1) {
|
||||
logger.info("Report matchs in filter "+mtsr.getFilterName());
|
||||
MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),mtsr.getMetarToShefOptions());
|
||||
break ;
|
||||
}
|
||||
}
|
||||
PluginDataObject[] resultRpt = null;
|
||||
for (MetarToShefRun mtsr : metarToShefRun) {
|
||||
PluginDataObject[] tmpRprts = reports.clone();
|
||||
resultRpt = filterARun(tmpRprts, mtsr.getFilterElements());
|
||||
if (resultRpt != null && resultRpt.length >= 1) {
|
||||
logger.info("Report matchs in filter " + mtsr.getFilterName());
|
||||
MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),
|
||||
mtsr.getMetarToShefOptions());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return resultRpt;
|
||||
}
|
||||
|
||||
private void createDummyFilter() {
|
||||
MetarToShefRun mtsr= new MetarToShefRun();
|
||||
MetarToShefRun mtsr = new MetarToShefRun();
|
||||
mtsr.setConfigFileName(METAR_CFG);
|
||||
mtsr.setMetarToShefOptions(metarToShefOptions);
|
||||
|
||||
|
@ -242,7 +256,7 @@ public class MetarToShefFilter {
|
|||
}
|
||||
};
|
||||
dummy.setFilterType(AbstractObsFilter.INCLUDE_TYPE);
|
||||
mtsr.getFilterElements().set(0, dummy);
|
||||
mtsr.getFilterElements().add(dummy);
|
||||
mtsr.setFilterName("Created Pass-All filter");
|
||||
this.metarToShefRun.add(mtsr);
|
||||
}
|
||||
|
@ -262,9 +276,9 @@ public class MetarToShefFilter {
|
|||
}
|
||||
return fis;
|
||||
}
|
||||
|
||||
|
||||
public void addMetarToShefRun(MetarToShefRun element) {
|
||||
metarToShefRun.add(element);
|
||||
metarToShefRun.add(element);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,13 +288,13 @@ public class MetarToShefFilter {
|
|||
public List<MetarToShefRun> getMetarToShefRun() {
|
||||
return metarToShefRun;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param elements
|
||||
*/
|
||||
public void setMetarToShefRun(List<MetarToShefRun> elements) {
|
||||
metarToShefRun = elements;
|
||||
metarToShefRun = elements;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,4 +142,10 @@ public class DataRetrievalEvent extends RetrievalEvent {
|
|||
return "DataRetrievalEvent " + super.toString() + " provider: "
|
||||
+ provider + " numRecord: " + numRecords + " bytes: " + bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeEvent() {
|
||||
// Not implemented
|
||||
|
||||
}
|
||||
}
|
|
@ -177,4 +177,9 @@ public class SubscriptionRetrievalEvent extends RetrievalEvent implements
|
|||
}
|
||||
return rval.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeEvent() {
|
||||
// Not implemented
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<statisticsConfig>
|
||||
<!-- Event Type should be fully qualified name of stat event -->
|
||||
<statisticsEvent type="com.raytheon.uf.common.stats.LoadEvent"
|
||||
displayName="Load Time" category="FFMP Load Times">
|
||||
<statisticsGroup name="type" displayName="Type" />
|
||||
<!-- Processing time available display units:
|
||||
ms, Seconds, Minutes, Hours -->
|
||||
<statisticsAggregate field="loadTime"
|
||||
displayName="Loading Time" displayUnit="ms" />
|
||||
</statisticsEvent>
|
||||
</statisticsConfig>
|
|
@ -136,4 +136,8 @@ public class RegistryStatisticsEvent extends StatisticsEvent {
|
|||
return registryObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeEvent() {
|
||||
// not implemented
|
||||
}
|
||||
}
|
|
@ -19,4 +19,5 @@ Require-Bundle: com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
|||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.units;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.units;bundle-version="1.0.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0"
|
||||
|
|
|
@ -23,8 +23,12 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
|
||||
/**
|
||||
* Load event to track dialog/table/data load times.
|
||||
|
@ -53,30 +57,12 @@ public class LoadEvent extends StatisticsEvent {
|
|||
FIELD_UNIT_MAP = Collections.unmodifiableMap(m);
|
||||
}
|
||||
|
||||
/**
|
||||
* The plugin name
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
private String pluginName;
|
||||
|
||||
/**
|
||||
* The workstation id
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
private String workstation;
|
||||
|
||||
/**
|
||||
* The type of object that is having its load time tracked
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* The version of CAVE
|
||||
*/
|
||||
@DynamicSerializeElement
|
||||
private String caveVersion;
|
||||
|
||||
/**
|
||||
* The load time in ms
|
||||
*/
|
||||
|
@ -89,41 +75,23 @@ public class LoadEvent extends StatisticsEvent {
|
|||
@DynamicSerializeElement
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Start time in ms.
|
||||
*/
|
||||
private long start;
|
||||
|
||||
/**
|
||||
* Constructor. Sets the start time to current time.
|
||||
*/
|
||||
public LoadEvent() {
|
||||
start = TimeUtil.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getFieldUnitMap() {
|
||||
return FIELD_UNIT_MAP;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pluginName
|
||||
*/
|
||||
public String getPluginName() {
|
||||
return pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pluginName
|
||||
* the pluginName to set
|
||||
*/
|
||||
public void setPluginName(String pluginName) {
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the workstation
|
||||
*/
|
||||
public String getWorkstation() {
|
||||
return workstation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param workstation
|
||||
* the workstation to set
|
||||
*/
|
||||
public void setWorkstation(String workstation) {
|
||||
this.workstation = workstation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
|
@ -170,18 +138,18 @@ public class LoadEvent extends StatisticsEvent {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the caveVersion
|
||||
* @return the start
|
||||
*/
|
||||
public String getCaveVersion() {
|
||||
return caveVersion;
|
||||
public long getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caveVersion
|
||||
* the caveVersion to set
|
||||
* @param start
|
||||
* the start to set
|
||||
*/
|
||||
public void setCaveVersion(String caveVersion) {
|
||||
this.caveVersion = caveVersion;
|
||||
public void setStart(long start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,4 +159,45 @@ public class LoadEvent extends StatisticsEvent {
|
|||
public String toString() {
|
||||
return super.toString() + " : " + getMessage();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 37).appendSuper(super.hashCode())
|
||||
.append(date).append(message).append(type).toHashCode();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != getClass()) {
|
||||
return false;
|
||||
}
|
||||
LoadEvent other = (LoadEvent) obj;
|
||||
return new EqualsBuilder().appendSuper(super.equals(obj))
|
||||
.append(this.date, other.date).append(this.id, other.id)
|
||||
.append(this.message, other.message)
|
||||
.append(this.type, other.type).isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeEvent() {
|
||||
long now = TimeUtil.currentTimeMillis();
|
||||
this.loadTime = now - start;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -165,4 +165,9 @@ public class ProcessEvent extends StatisticsEvent {
|
|||
return super.toString() + " : " + getMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeEvent() {
|
||||
// not implemented
|
||||
}
|
||||
|
||||
}
|
|
@ -23,6 +23,9 @@ package com.raytheon.uf.common.stats;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
import com.raytheon.uf.common.event.Event;
|
||||
|
||||
/**
|
||||
|
@ -35,6 +38,7 @@ import com.raytheon.uf.common.event.Event;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 25, 2012 #1340 dhladky Initial creation
|
||||
* Feb 10, 2013 #1584 mpduff Add equals and hashCode.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,7 +56,43 @@ public abstract class StatisticsEvent extends Event {
|
|||
|
||||
protected abstract Map<String, String> getFieldUnitMap();
|
||||
|
||||
public abstract void finalizeEvent();
|
||||
|
||||
public String getStorageUnit(String field) {
|
||||
return getFieldUnitMap().get(field);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
HashCodeBuilder hcBuilder = new HashCodeBuilder();
|
||||
hcBuilder.append(this.date);
|
||||
hcBuilder.append(this.id);
|
||||
|
||||
return hcBuilder.toHashCode();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof StatisticsEvent) {
|
||||
StatisticsEvent other = (StatisticsEvent) obj;
|
||||
EqualsBuilder builder = new EqualsBuilder();
|
||||
builder.append(this.date, other.date);
|
||||
builder.append(this.id, this.id);
|
||||
|
||||
return builder.isEquals();
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,3 +7,4 @@ Bundle-Vendor: RAYTHEON
|
|||
Eclipse-BuddyPolicy: ext, registered, global
|
||||
Export-Package: com.raytheon.uf.common.status
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.apache.log4j;bundle-version="1.0.0"
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.status;
|
||||
|
||||
/**
|
||||
* Performance status handler interface.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 14, 2013 1584 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IPerformanceStatusHandler {
|
||||
|
||||
/**
|
||||
* Performance message. Use {@link #logDuration(String, long)} if the
|
||||
* duration is known.
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
void log(String message);
|
||||
|
||||
/**
|
||||
* Performance message with time duration.
|
||||
*
|
||||
* @param message
|
||||
* @param timeMs
|
||||
*/
|
||||
void logDuration(String message, long timeMs);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.raytheon.uf.common.status;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Log4j Performance status handler.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 14, 2013 1584 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class Log4JPerformanceStatusHandler implements IPerformanceStatusHandler {
|
||||
/** Logger */
|
||||
private final Logger perfLog = Logger.getLogger("PerformanceLogger");
|
||||
|
||||
/** Prefix to append to all log messages */
|
||||
private final String prefix;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param prefix
|
||||
* Message prefix
|
||||
*/
|
||||
public Log4JPerformanceStatusHandler(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void log(String message) {
|
||||
perfLog.info(prefix + " " + message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void logDuration(String message, long timeMs) {
|
||||
perfLog.info(prefix + " " + message + " took " + timeMs + " ms");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.status;
|
||||
|
||||
/**
|
||||
* Performance Status class to handle logging of performance stats.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2013 1584 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PerformanceStatus {
|
||||
/**
|
||||
* Get a handler for performance logging.
|
||||
*
|
||||
* @param prefix
|
||||
* A prefix to each log statement
|
||||
* @return The handler
|
||||
*/
|
||||
public static IPerformanceStatusHandler getHandler(String prefix) {
|
||||
return new Log4JPerformanceStatusHandler(prefix);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<statisticsConfig>
|
||||
<!-- Event Type should be fully qualified name of stat event -->
|
||||
<statisticsEvent type="com.raytheon.uf.common.datadelivery.event.retrieval.SubscriptionRetrievalEvent"
|
||||
displayName="Subscription Retrieval" category="Data Delivery">
|
||||
<statisticsGroup name="plugin" displayName="Data Type" />
|
||||
<statisticsGroup name="provider" displayName="Data Provider" />
|
||||
<statisticsGroup name="owner" displayName="Owner" />
|
||||
<statisticsGroup name="network" displayName="Network Route" />
|
||||
<statisticsGroup name="subscriptionType" displayName="Subscription Type" />
|
||||
<statisticsAggregate field="numFailed"
|
||||
displayName="Number of Failed Subscriptions" displayUnit="Count" />
|
||||
<statisticsAggregate field="numComplete"
|
||||
displayName="Number of Completed Subscriptions" displayUnit="Count" />
|
||||
</statisticsEvent>
|
||||
<statisticsEvent type="com.raytheon.uf.common.datadelivery.event.retrieval.DataRetrievalEvent"
|
||||
displayName="Data Retrieval" category="Data Delivery">
|
||||
<statisticsGroup name="plugin" displayName="Data Type" />
|
||||
<statisticsGroup name="provider" displayName="Data Provider" />
|
||||
<statisticsGroup name="owner" displayName="Owner" />
|
||||
<statisticsGroup name="network" displayName="Network Route" />
|
||||
<!--
|
||||
Display unit options are bytes, KB, MB, GB
|
||||
-->
|
||||
<statisticsAggregate field="bytes"
|
||||
displayName="Amount of Data Downloaded" displayUnit="MB" />
|
||||
<statisticsAggregate field="numRecords"
|
||||
displayName="Number of Records Downloaded" displayUnit="Count" />
|
||||
</statisticsEvent>
|
||||
</statisticsConfig>
|
|
@ -1,14 +0,0 @@
|
|||
<statisticsConfig>
|
||||
<!-- Event Type should be fully qualified name of stat event -->
|
||||
<statisticsEvent type="com.raytheon.uf.common.registry.event.RegistryStatisticsEvent"
|
||||
displayName="Registry Statistics" category="Registry">
|
||||
<statisticsGroup name="owner" displayName="Transaction Owner" />
|
||||
<statisticsGroup name="status" displayName="Transaction Status" />
|
||||
<statisticsGroup name="type" displayName="Transaction Type" />
|
||||
<!--
|
||||
Display unit options are ms, Seconds, Minutes, Hours
|
||||
-->
|
||||
<statisticsAggregate field="duration"
|
||||
displayName="Total Registry Duration" displayUnit="Minutes" />
|
||||
</statisticsEvent>
|
||||
</statisticsConfig>
|
|
@ -1,13 +0,0 @@
|
|||
<statisticsConfig>
|
||||
<!-- Event Type should be fully qualified name of stat event -->
|
||||
<statisticsEvent type="com.raytheon.uf.common.stats.ProcessEvent"
|
||||
displayName="Processing Events" category="Data Ingest Events">
|
||||
<statisticsGroup name="dataType" displayName="Data Type" />
|
||||
<!-- Processing time available display units:
|
||||
ms, Seconds, Minutes, Hours -->
|
||||
<statisticsAggregate field="processingTime"
|
||||
displayName="Processing Time" displayUnit="ms" />
|
||||
<statisticsAggregate field="processingLatency"
|
||||
displayName="Processing Latency" displayUnit="ms" />
|
||||
</statisticsEvent>
|
||||
</statisticsConfig>
|
|
@ -166,4 +166,9 @@ public class MockEvent extends StatisticsEvent {
|
|||
return super.toString() + " : " + getMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeEvent() {
|
||||
// not implemented
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue