forked from intel-cloud/cosbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dumping of Per driver results intel-cloud#221
- Loading branch information
Showing
12 changed files
with
263 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
dev/cosbench-core/src/com/intel/cosbench/bench/TaskReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.intel.cosbench.bench; | ||
/** | ||
* The class is the data structure of task info | ||
* | ||
* @author liyuan | ||
* | ||
*/ | ||
public class TaskReport { | ||
private String driverName; | ||
private String driverUrl; | ||
private Report report; | ||
public String getDriverName() { | ||
return driverName; | ||
} | ||
public void setDriverName(String driverName) { | ||
this.driverName = driverName; | ||
} | ||
public String getDriverUrl() { | ||
return driverUrl; | ||
} | ||
public void setDriverUrl(String driverUrl) { | ||
this.driverUrl = driverUrl; | ||
} | ||
public Report getReport() { | ||
return report; | ||
} | ||
public void setReport(Report report) { | ||
this.report = report; | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
dev/cosbench-core/src/com/intel/cosbench/exporter/AbstractTaskExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.intel.cosbench.exporter; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.intel.cosbench.bench.Snapshot; | ||
import com.intel.cosbench.bench.TaskReport; | ||
import com.intel.cosbench.model.DriverInfo; | ||
import com.intel.cosbench.model.StageInfo; | ||
import com.intel.cosbench.model.WorkloadInfo; | ||
|
||
public abstract class AbstractTaskExporter implements TaskExporter { | ||
|
||
protected WorkloadInfo workloadInfo; | ||
protected DriverInfo driverInfo; | ||
protected List<TaskReport> driverTasks = new ArrayList<TaskReport>(); | ||
|
||
public WorkloadInfo getWorkloadInfo() { | ||
return workloadInfo; | ||
} | ||
|
||
public void setWorkloadInfo(WorkloadInfo workloadInfo) { | ||
this.workloadInfo = workloadInfo; | ||
} | ||
|
||
public DriverInfo getDriverInfo() { | ||
return driverInfo; | ||
} | ||
|
||
public void setDriverInfo(DriverInfo driverInfo) { | ||
this.driverInfo = driverInfo; | ||
} | ||
|
||
|
||
@Override | ||
public void export(Writer writer) throws IOException { | ||
//check every stage every task | ||
for(StageInfo sInfo:workloadInfo.getStageInfos()){ | ||
for(TaskReport tReport:sInfo.getTaskReports()){ | ||
if(tReport.getDriverUrl().equals(driverInfo.getUrl())){ | ||
driverTasks.add(tReport); | ||
} | ||
} | ||
} | ||
writeReport(writer); | ||
} | ||
|
||
private void writeReport(Writer writer) throws IOException { | ||
writeHeader(writer); | ||
writer.flush(); | ||
for (TaskReport tReport : driverTasks) | ||
writeMetrics(writer, tReport); | ||
writer.flush(); | ||
} | ||
|
||
protected abstract void writeHeader(Writer writer) throws IOException; | ||
|
||
protected abstract void writeMetrics(Writer writer, TaskReport tReport) | ||
throws IOException; | ||
} |
88 changes: 88 additions & 0 deletions
88
dev/cosbench-core/src/com/intel/cosbench/exporter/CSVTaskExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.intel.cosbench.exporter; | ||
|
||
import static com.intel.cosbench.exporter.Formats.NUM; | ||
import static com.intel.cosbench.exporter.Formats.RATIO; | ||
import static com.intel.cosbench.exporter.Formats.TIME; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
import java.util.Arrays; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
|
||
import com.intel.cosbench.bench.Metrics; | ||
import com.intel.cosbench.bench.Report; | ||
import com.intel.cosbench.bench.Snapshot; | ||
import com.intel.cosbench.bench.TaskReport; | ||
|
||
public class CSVTaskExporter extends AbstractTaskExporter{ | ||
|
||
public CSVTaskExporter() { | ||
/* empty */ | ||
} | ||
protected void writeHeader(Writer writer) throws IOException { | ||
StringBuilder buffer = new StringBuilder(); | ||
char[] cs = new char[8]; | ||
buffer.append("Op-Type").append(','); | ||
buffer.append("Sample-Type").append(','); | ||
buffer.append("Op-Count").append(','); | ||
buffer.append("Byte-Count").append(','); | ||
buffer.append("Avg-ResTime").append(','); | ||
buffer.append("Avg-ProcTime").append(','); | ||
buffer.append("Throughput").append(','); | ||
buffer.append("Bandwidth").append(','); | ||
buffer.append("Succ-Ratio").append('\n'); | ||
writer.write(buffer.toString()); | ||
} | ||
|
||
protected void writeMetrics(Writer writer,TaskReport tReport)throws IOException { | ||
StringBuilder buffer = new StringBuilder(); | ||
Report report = tReport.getReport(); | ||
/*Operation Type*/ | ||
for(Metrics metrics:report) | ||
buffer.append(metrics.getOpType()).append(','); | ||
/*sample Type*/ | ||
for(Metrics metrics:report) | ||
buffer.append(metrics.getSampleType()).append(','); | ||
/* Operation Count */ | ||
for (Metrics metrics :report) | ||
buffer.append(metrics.getSampleCount()).append(','); | ||
/* Byte Count */ | ||
for (Metrics metrics : report) | ||
buffer.append(metrics.getByteCount()).append(','); | ||
/* Response Time */ | ||
for (Metrics metrics : report) { | ||
double r = metrics.getAvgResTime(); | ||
if (r > 0) | ||
buffer.append(NUM.format(r)); | ||
else | ||
buffer.append("N/A"); | ||
buffer.append(','); | ||
} | ||
/* Transfer Time */ | ||
for (Metrics metrics : report) { | ||
double pt = metrics.getAvgResTime() - metrics.getAvgXferTime(); | ||
if (pt > 0) | ||
buffer.append(NUM.format(pt)); | ||
else | ||
buffer.append("N/A"); | ||
buffer.append(','); | ||
} | ||
/* Throughput */ | ||
for (Metrics metrics : report) | ||
buffer.append(NUM.format(metrics.getThroughput())).append(','); | ||
/* Bandwidth */ | ||
for (Metrics metrics : report) | ||
buffer.append(NUM.format(metrics.getBandwidth())).append(','); | ||
/* Success Ratio */ | ||
for (Metrics metrics : report) { | ||
double t = (double) metrics.getRatio(); | ||
if (t > 0) | ||
buffer.append(RATIO.format(metrics.getRatio())); | ||
else | ||
buffer.append("N/A"); | ||
buffer.append('\n'); | ||
} | ||
writer.write(buffer.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
dev/cosbench-core/src/com/intel/cosbench/exporter/TaskExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.intel.cosbench.exporter; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
|
||
public interface TaskExporter { | ||
public void export(Writer writer) throws IOException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters