use of org.knime.core.node.workflow.NodeTimer in project knime-core by knime.
the class NodeMonitorView method updateTimerTable.
/*
* Put info from node timer into table.
*/
private void updateTimerTable(final NodeContainer nc) {
assert Display.getCurrent().getThread() == Thread.currentThread();
// Initialize table
m_table.removeAll();
for (TableColumn tc : m_table.getColumns()) {
tc.dispose();
}
String[] titles = { "Timer", "Value [ms]" };
for (int i = 0; i < titles.length; i++) {
TableColumn column = new TableColumn(m_table, SWT.NONE);
column.setText(titles[i]);
}
// retrieve time
NodeTimer nt = nc.getNodeTimer();
// update content
TableItem item = new TableItem(m_table, SWT.NONE);
item.setText(0, "Last Exec Time");
item.setText(1, nt.getLastExecutionDuration() < 0 ? "n/a" : "" + nt.getLastExecutionDuration());
if (nt.getLastExecutionDuration() < nt.getExecutionDurationSinceReset()) {
item = new TableItem(m_table, SWT.NONE);
item.setText(0, "Total Execution Time since Reset");
item.setText(1, "" + nt.getExecutionDurationSinceReset());
}
if (nt.getLastExecutionDuration() < nt.getExecutionDurationSinceStart()) {
item = new TableItem(m_table, SWT.NONE);
item.setText(0, "Total Execution Time");
item.setText(1, "" + nt.getExecutionDurationSinceStart());
}
if (nt.getNrExecsSinceReset() != 1) {
item = new TableItem(m_table, SWT.NONE);
item.setText(0, "#Executions since Reset");
item.setText(1, "" + nt.getNrExecsSinceReset());
}
item = new TableItem(m_table, SWT.NONE);
item.setText(0, "Total #Executions");
item.setText(1, "" + nt.getNrExecsSinceStart());
// finalize table
for (int i = 0; i < m_table.getColumnCount(); i++) {
m_table.getColumn(i).pack();
}
}
use of org.knime.core.node.workflow.NodeTimer in project knime-core by knime.
the class TimerinfoNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
BufferedDataContainer result = exec.createDataContainer(createSpec());
WorkflowManager wfm = NodeContext.getContext().getWorkflowManager();
for (NodeContainer nc : wfm.getNodeContainers()) {
NodeTimer nt = nc.getNodeTimer();
DataRow row = new DefaultRow(new RowKey("Node " + nc.getID().getIndex()), new StringCell(nc.getName()), nt.getLastExecutionDuration() >= 0 ? new LongCell(nt.getLastExecutionDuration()) : DataType.getMissingCell(), new LongCell(nt.getExecutionDurationSinceReset()), new LongCell(nt.getExecutionDurationSinceStart()), new IntCell(nt.getNrExecsSinceReset()), new IntCell(nt.getNrExecsSinceStart()), new StringCell(nc.getID().toString()), new StringCell(nc instanceof NativeNodeContainer ? ((NativeNodeContainer) nc).getNodeModel().getClass().getName() : "n/a"));
result.addRowToTable(row);
}
result.close();
return new PortObject[] { result.getTable() };
}
Aggregations