String jobNo = request.getParameter("id");
DuccWorkJob job = getJob(jobNo);
if(job != null) {
try {
String userId = duccWebSessionManager.getUserId(request);
WorkItemStateManager workItemStateManager = new WorkItemStateManager(job.getLogDirectory()+jobNo);
workItemStateManager.importData(userId);
PerformanceSummary performanceSummary = new PerformanceSummary(job.getLogDirectory()+jobNo);
PerformanceMetricsSummaryMap performanceMetricsSummaryMap = performanceSummary.readSummary(userId);
if( (performanceMetricsSummaryMap == null) || (performanceMetricsSummaryMap.size() == 0) ) {
sb.append("no data (map empty?)");
}
else {
int casCount = performanceMetricsSummaryMap.casCount();
/*
sb.append("<table>");
sb.append("<tr>");
sb.append("<th align=\"right\">");
sb.append("Job Id:");
sb.append("<th align=\"left\">");
sb.append(jobNo);
sb.append("<th>");
sb.append(" ");
sb.append("<th align=\"right\">");
sb.append("Workitems:");
sb.append("<th align=\"left\">");
sb.append(casCount);
sb.append("</table>");
sb.append("<br>");
*/
sb.append("<table>");
sb.append("<tr class=\"ducc-head\">");
sb.append("<th>");
sb.append("Name");
sb.append("</th>");
sb.append("<th>");
sb.append("Total<br><small>ddd:hh:mm:ss</small>");
sb.append("</th>");
sb.append("<th>");
sb.append("% of<br>Total");
sb.append("</th>");
sb.append("<th>");
sb.append("Avg<br><small>hh:mm:ss/workitem</small>");
sb.append("</th>");
sb.append("<th>");
sb.append("Min<br><small>hh:mm:ss/workitem</small>");
sb.append("</th>");
sb.append("<th>");
sb.append("Max<br><small>hh:mm:ss/workitem</small>");
sb.append("</th>");
sb.append("</tr>");
ArrayList <UimaStatistic> uimaStats = new ArrayList<UimaStatistic>();
uimaStats.clear();
//long analysisTime = 0;
for (Entry<String, PerformanceMetricsSummaryItem> entry : performanceMetricsSummaryMap.entrySet()) {
PerformanceMetricsSummaryItem item = entry.getValue();
String shortname = item.getDisplayName();
long anTime = item.getAnalysisTime();
long anMinTime = item.getAnalysisTimeMin();
long anMaxTime = item.getAnalysisTimeMax();
//analysisTime += anTime;
UimaStatistic stat = new UimaStatistic(shortname, entry.getKey(), anTime, anMinTime, anMaxTime);
uimaStats.add(stat);
}
Collections.sort(uimaStats);
int numstats = uimaStats.size();
DecimalFormat formatter = new DecimalFormat("##0.0");
// pass 1
double time_total = 0;
for (int i = 0; i < numstats; ++i) {
time_total += (uimaStats.get(i).getAnalysisTime());
}
int counter = 0;
sb.append(trGet(counter++));
// Totals
sb.append("<td>");
sb.append("<i><b>Summary</b></i>");
long ltime = 0;
// Total
sb.append("<td align=\"right\">");
ltime = (long)time_total;
sb.append(FormatHelper.duration(ltime));
// % of Total
sb.append("<td align=\"right\">");
sb.append(formatter.format(100));
// Avg
sb.append("<td align=\"right\">");
sb.append("<span class=\"health_purple\" title=\"average processing time per completed work item\">");
ltime = (long)workItemStateManager.getAvg();
sb.append(FormatHelper.duration(ltime));
sb.append("</span>");
// Min
sb.append("<td align=\"right\">");
sb.append("<span class=\"health_purple\" title=\"minimum processing time for any completed work item\">");
ltime = (long)workItemStateManager.getMin();
sb.append(FormatHelper.duration(ltime));
sb.append("</span>");
// Max
sb.append("<td align=\"right\">");
sb.append("<span class=\"health_purple\" title=\"maximum processing time for any completed work item\">");
ltime = (long)workItemStateManager.getMax();
sb.append(FormatHelper.duration(ltime));
sb.append("</span>");
// pass 2
for (int i = 0; i < numstats; ++i) {
sb.append(trGet(counter++));