Skip to content

Commit

Permalink
Merge pull request #116 from jialinsun/0.3.3.0
Browse files Browse the repository at this point in the history
Fix issue #30
  • Loading branch information
ywang19 committed Sep 6, 2013
2 parents d2d5f87 + 4a901a3 commit c034146
Show file tree
Hide file tree
Showing 18 changed files with 191 additions and 89 deletions.
48 changes: 42 additions & 6 deletions dev/cosbench-controller-web/WEB-INF/freemarker/index.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}
function findChecked(name) {
var a = document.getElementsByName(name);
var value = "";
var value = '';
for ( var i = 0; i < a.length; i++) {
if (a[i].checked) {
value += a[i].value;
Expand All @@ -63,7 +63,12 @@
}
}
function resubmitWorkloads() {
var ids = findChecked('HistoryWorkload');
var hids = findChecked('HistoryWorkload');
var aids = findChecked('ArchivedWorkload');
var ids = '';
if(hids.length > 0)
ids = hids + '_';
ids += aids;
document.getElementById('resubmitIds').value = ids;
document.getElementById('resubmitForm').submit();
}
Expand Down Expand Up @@ -151,9 +156,10 @@
</form>
<p><a href="submit.html">submit new workloads</a></p>
<p><a href="config.html">config workloads</a></p>
<h3>Historical Workloads</h3>

<div>
<p><a href="matrix.html?ops=read&ops=write&ops=delete&metrics=rt&rthisto=_95rt&metrics=t&metrics=succ">view performance matrix</a></p>
<h3>Historical Workloads</h3>
<p><a href="matrix.html?type=histo&ops=read&ops=write&ops=delete&metrics=rt&rthisto=_95rt&metrics=t&metrics=succ">view performance matrix</a></p>
<table class="info-table">
<tr>
<th style="width:5%;"><input type="checkbox" id="AllHistory" onclick="checkAll(event,'HistoryWorkload')"></th>
Expand All @@ -180,8 +186,38 @@
</tr>
</#list>
</table>
<#if (hInfos?size < 10) >
<p class="warn">There are ${hInfos?size} Historical workloads.</p>

<h3>Archived Workloads</h3>
<p><a href="matrix.html?type=arch&ops=read&ops=write&ops=delete&metrics=rt&rthisto=_95rt&metrics=t&metrics=succ">view performance matrix</a></p>
<table class="info-table">
<tr>
<th style="width:5%;"><input type="checkbox" id="AllArchived" onclick="checkAll(event,'ArchivedWorkload')"></th>
<th class="id" style="width:5%;">ID</th>
<th>Name</th>
<th>Duration</th>
<th>Op-Info</th>
<th>State</th>
<th style="width:15%;">Link</th>
</tr>
<#list archInfos as aInfo >
<tr>
<td><input type="checkbox" id="checkbox-${aInfo.id}" name="ArchivedWorkload" onclick="checkItem(event,'AllArchived')" value="${aInfo.id}"></td>
<td onclick="checkMe('${aInfo.id}','AllArchived');");">${aInfo.id}</td>
<td onclick="checkMe('${aInfo.id}','AllArchived');");">${aInfo.workload.name}</td>
<td onclick="checkMe('${aInfo.id}','AllArchived');");"><#if aInfo.startDate?? >${aInfo.startDate?datetime}<#else>N/A</#if> - ${aInfo.stopDate?time}</td>
<td onclick="checkMe('${aInfo.id}','AllArchived');");">
<#list aInfo.allOperations as op >
${op}<#if op_has_next>,</#if>
</#list>
</td>
<td onclick="checkMe('${aInfo.id}','AllArchived');"><span class="workload-state-${aInfo.state?lower_case} state">${aInfo.state?lower_case}</span></td>
<td><a href="workload.html?id=${aInfo.id}">view details</a></td>
</tr>
</#list>
</table>

<#if (hInfos?size + archInfos?size < 10) >
<p class="warn">There are ${hInfos?size + archInfos?size} Historical and Archived workloads.</p>
</#if>
<form id="resubmitForm" method="POST" action="index.html">
<input id="resubmitIds" type="hidden" name="resubmitIds" value="">
Expand Down
11 changes: 6 additions & 5 deletions dev/cosbench-controller-web/WEB-INF/freemarker/matrix.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<h2>Performance Matrix</h2>
<h3>Filters</h3>
<div class="form">
<form name="perf-matrix" action="matrix.html" method="GET" onreset="window.location.href='matrix.html?ops=read&ops=write&ops=delete&metrics=rt&rthisto=_95rt&metrics=t&metrics=succ'">
<form name="perf-matrix" action="matrix.html" method="GET" onreset="window.location.href='matrix.html?type=${type}&ops=read&ops=write&ops=delete&metrics=rt&rthisto=_95rt&metrics=t&metrics=succ'">
<input name="type" type="hidden" value="${type}">
<span class="label">Operations:</span>
<span class="checkbox"><input name="ops" type="checkbox" value="read"
<#if allOps!false || read!false >checked="true"</#if> /></span> Read
Expand Down Expand Up @@ -251,7 +252,7 @@
<#if mInfo.totalSampleCount == 0 >
N/A
<#else>
<#assign sRatio = mInfo.sampleCount / mInfo.totalSampleCount >
<#assign sRatio = mInfo.ratio >
${sRatio?string("0.##%")}
</#if>
</td>
Expand Down Expand Up @@ -279,9 +280,9 @@
</#list>
</table>
<p>
<a href="matrix.html?ops=read&ops=write&ops=delete&metrics=rt&rthisto=_95rt&others=cfg">show RT only</a>
<a href="matrix.html?ops=read&ops=write&ops=delete&metrics=t&others=cfg">show T only</a>
<a href="matrix.html?ops=read&ops=write&ops=delete&metrics=bw&others=cfg">show BW only</a>
<a href="matrix.html?type=${type}&ops=read&ops=write&ops=delete&metrics=rt&rthisto=_95rt&others=cfg">show RT only</a>
<a href="matrix.html?type=${type}&ops=read&ops=write&ops=delete&metrics=t&others=cfg">show T only</a>
<a href="matrix.html?type=${type}&ops=read&ops=write&ops=delete&metrics=bw&others=cfg">show BW only</a>
</p>
<p><a href="index.html">go back to index</a></p>
</div> <#-- end of content -->
Expand Down
2 changes: 1 addition & 1 deletion dev/cosbench-controller-web/WEB-INF/freemarker/metrics.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
</#if>
</td>
<td>
<#if mInfo.ratio == 0.0 >
<#if mInfo.totalSampleCount == 0 >
N/A
<#else>
<#assign sRatio = mInfo.ratio >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
<tr>
<#assign allMetrics = ssInfo.report.allMetrics >
<#list allMetrics as mInfo >
<td>${mInfo.sampleType}</td>
<td>${mInfo.opName}</td>
</#list>
<#list allMetrics as mInfo >
<td>${mInfo.sampleType}</td>
<td>${mInfo.opName}</td>
</#list>
<#list allMetrics as mInfo >
<td>${mInfo.sampleType}</td>
<td>${mInfo.opName}</td>
</#list>
<#list allMetrics as mInfo >
<td>${mInfo.sampleType}</td>
<td>${mInfo.opName}</td>
</#list>
<#list allMetrics as mInfo >
<td>${mInfo.sampleType}</td>
<td>${mInfo.opName}</td>
</#list>
<#list allMetrics as mInfo >
<td>${mInfo.sampleType}</td>
<td>${mInfo.opName}</td>
</#list>
</tr>
<#break>
Expand Down Expand Up @@ -127,7 +127,7 @@
</#list>
<#list allMetrics as mInfo >
<td>
<#if mInfo.ratio == 0.0 >
<#if mInfo.totalSampleCount == 0 >
N/A
<#else>
<#assign sRatio = mInfo.ratio >
Expand Down
8 changes: 7 additions & 1 deletion dev/cosbench-controller-web/resources/cosbench.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ a:visited {
}

.content {
width: 1000px;
width: 1100px;
margin-left: auto;
margin-right: auto;
}
Expand Down Expand Up @@ -177,10 +177,16 @@ a:visited {
background: #F4F4F4;
}

.info-table tr.nohover:hover td{
background-color: #FFFFFF;
}

.info-table tr:hover td {
background-color: #CCD9E9;
}



/* ---------------------------------------
* Text Styles
* --------------------------------------- */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ protected ModelAndView process(HttpServletRequest req,
result.addObject("cInfo", controller.getControllerInfo());
result.addObject("aInfos", controller.getActiveWorkloads());
result.addObject("hInfos", controller.getHistoryWorkloads());
result.addObject("archInfos", controller.getArchivedWorkloads());
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@

package com.intel.cosbench.controller.web;

import java.io.IOException;

import javax.servlet.http.*;

import org.springframework.web.servlet.ModelAndView;

import com.intel.cosbench.model.WorkloadInfo;
import com.intel.cosbench.service.ControllerService;
import com.intel.cosbench.web.AbstractController;

Expand Down Expand Up @@ -56,7 +59,21 @@ protected ModelAndView process(HttpServletRequest req,
if (others != null && others.length > 0)
for (String other : others)
result.addObject(other, true);
result.addObject("hInfos", controller.getHistoryWorkloads());
if(req.getParameter("type").equals("histo"))
result.addObject("hInfos", controller.getHistoryWorkloads());
else if (req.getParameter("type").equals("arch")) {
for (WorkloadInfo info : controller.getArchivedWorkloads()) {
if (info.getReport().getAllMetrics().length==0) {
try {
controller.getWorkloadLoader().loadWorkloadPageInfo(info);
} catch (IOException e) {
e.printStackTrace();
}
}
}
result.addObject("hInfos", controller.getArchivedWorkloads());
}
result.addObject("type", req.getParameter("type"));
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,25 @@ private List<Metrics> loadMetrics(String[] columns) {
metric.setAvgResTime(getDoubleValue(columns[i + opNum * 2 + 1]));
metric.setThroughput(getDoubleValue(columns[i + opNum * 3 + 1]));
metric.setBandwidth(getDoubleValue(columns[i + opNum * 4 + 1]));
metric.setRatio(columns[i + opNum * 5 + 1].equalsIgnoreCase("N/A") ? 0D
: Double.valueOf(columns[i + opNum * 5 + 1].substring(0,
columns[i + opNum * 5 + 1].length() - 1)) / 100.0);
// metric.setRatio(columns[i + opNum * 5 + 1].equalsIgnoreCase("N/A") ? 0D
// : Double.valueOf(columns[i + opNum * 5 + 1].substring(0,
// columns[i + opNum * 5 + 1].length() - 1)) / 100.0);
setRatio(columns[i + opNum * 5 + 1], metric);
metrics.add(metric);
}
return metrics;
}

private void setRatio(String column, Metrics metrics) {
if (!column.equalsIgnoreCase("N/A")) {
metrics.setRatio(Double.valueOf(column.substring(0,
column.length() - 1)) / 100.0);
metrics.setTotalSampleCount(metrics.getSampleCount()
/ metrics.getRatio() > Integer.MAX_VALUE ? Integer.MAX_VALUE
: (int) (metrics.getSampleCount() / metrics.getRatio()));
} else {
metrics.setRatio(0D);
metrics.setTotalSampleCount(0);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected void readWorkload() throws IOException {
stageId = "s" + index++;
sameStage = false;
}
if (columns[14].equalsIgnoreCase("completed")) {
if (columns[15].equalsIgnoreCase("completed")) {
Metrics metrics = loadMetrics(columns);
if (!sameStage) {
Report report = new Report();
Expand All @@ -68,13 +68,13 @@ protected void readWorkload() throws IOException {
workloadContext.getReport().addMetrics(metrics);
}
for (StageState state : StageState.values()) {
if (columns[14]
if (columns[15]
.equalsIgnoreCase(state.toString().toLowerCase())) {
workloadContext.getStageInfo(stageId).setState(state, true);
break;
}
}
int pos = 14;
int pos = 15;
while (!sameStage && ++pos <= columns.length - 1) {
String str[] = columns[pos].split("@");
String stateName = str[0].trim();
Expand All @@ -89,56 +89,68 @@ protected void readWorkload() throws IOException {
}
}
}

private Metrics loadMetrics(String[] columns) {
Metrics metrics = new Metrics();
int n = columns[1].lastIndexOf("-");
metrics.setName(columns[1]);
if (n > 0) {
metrics.setOpName(columns[1].substring(0, n));
metrics.setSampleType(columns[1].substring(n + 1));
}else{
} else {
metrics.setOpName(columns[1]);
metrics.setSampleType(columns[1]);
}
metrics.setSampleCount(Integer.valueOf(columns[2]));
metrics.setByteCount(Integer.valueOf(columns[3]));
metrics.setAvgResTime(columns[4].equalsIgnoreCase("N/A") ? 0
: Double.valueOf(columns[4]));
metrics.setOpType(columns[2]);
metrics.setSampleCount(Integer.valueOf(columns[3]));
metrics.setByteCount(Integer.valueOf(columns[4]));
metrics.setAvgResTime(columns[5].equalsIgnoreCase("N/A") ? 0 : Double
.valueOf(columns[5]));
metrics.setLatency(loadHistogram(columns));
metrics.setThroughput(Double.valueOf(columns[11]));
metrics.setBandwidth(Double.valueOf(columns[12]));
metrics.setRatio((columns[13].equalsIgnoreCase("N/A") ? 0
: Double.valueOf(columns[13].substring(0,
columns[13].length() - 1)) / 100.0));
metrics.setThroughput(Double.valueOf(columns[12]));
metrics.setBandwidth(Double.valueOf(columns[13]));
setRatio(columns[14], metrics);
return metrics;
}


private void setRatio(String column, Metrics metrics) {
if (!column.equalsIgnoreCase("N/A")) {
metrics.setRatio(Double.valueOf(column.substring(0,
column.length() - 1)) / 100.0);
metrics.setTotalSampleCount(metrics.getSampleCount()
/ metrics.getRatio() > Integer.MAX_VALUE ? Integer.MAX_VALUE
: (int) (metrics.getSampleCount() / metrics.getRatio()));
} else {
metrics.setRatio(0D);
metrics.setTotalSampleCount(0);
}
}

private Histogram loadHistogram(String[] columns) {
Histogram histogram = new Histogram();
long[] l_60 = new long[2];
l_60[1] = columns[5].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[5]);
l_60[1] = columns[6].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[6]);
histogram.set_60(l_60);
long[] l_80 = new long[2];
l_80[1] = columns[6].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[6]);
l_80[1] = columns[7].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[7]);
histogram.set_80(l_80);
long[] l_90 = new long[2];
l_90[1] = columns[7].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[7]);
l_90[1] = columns[8].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[8]);
histogram.set_90(l_90);
long[] l_95 = new long[2];
l_95[1] = columns[8].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[8]);
l_95[1] = columns[9].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[9]);
histogram.set_95(l_95);
long[] l_99 = new long[2];
l_99[1] = columns[9].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[9]);
l_99[1] = columns[10].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[10]);
histogram.set_99(l_99);
long[] l_100 = new long[2];
l_100[1] = columns[10].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[10]);
l_100[1] = columns[11].equalsIgnoreCase("N/A") ? 0L : Long
.valueOf(columns[11]);
histogram.set_100(l_100);
return histogram;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,5 @@ public static SnapshotLoader newSnapshotLoader(BufferedReader reader,
stageId);
return loader;
}
//
// public static LatencyLoader newLatencyExporter(WorkloadInfo workload) {
// AbstractLatencyExporter exporter = new CSVLatencyExporter();
// exporter.setWorkload(workload);
// return exporter;
// }
//
// public static LogLoader newLogExporter(WorkloadInfo workload) {
// SimpleLogExporter exporter = new SimpleLogExporter();
// exporter.setWorkload(workload);
// return exporter;
// }
//
// public static MatrixLoader newMatrixExporter(WorkloadInfo workload) {
// AbstractMatrixExporter exporter = new CSVMatrixExporter();
// exporter.setWorkload(workload);
// return exporter;
// }

}
Loading

0 comments on commit c034146

Please sign in to comment.