-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
213 additions
and
8 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
49 changes: 49 additions & 0 deletions
49
dev/cosbench-core/src/com/intel/cosbench/exporter/AbstractWorkerExporter.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,49 @@ | ||
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.Metrics; | ||
import com.intel.cosbench.bench.Report; | ||
import com.intel.cosbench.bench.TaskReport; | ||
import com.intel.cosbench.model.DriverInfo; | ||
import com.intel.cosbench.model.StageInfo; | ||
import com.intel.cosbench.model.TaskInfo; | ||
import com.intel.cosbench.model.WorkloadInfo; | ||
|
||
public abstract class AbstractWorkerExporter implements WorkerExporter { | ||
|
||
private StageInfo stageInfo; | ||
|
||
public StageInfo getStageInfo() { | ||
return stageInfo; | ||
} | ||
|
||
public void setStageInfo(StageInfo stageInfo) { | ||
this.stageInfo = stageInfo; | ||
} | ||
|
||
@Override | ||
public void export(Writer writer) throws IOException { | ||
writeReport(writer); | ||
} | ||
|
||
private void writeReport(Writer writer) throws IOException { | ||
writeHeader(writer); | ||
writer.flush(); | ||
for(TaskInfo taskInfo : stageInfo.getTaskInfos()){ | ||
for(Metrics metrics: taskInfo.getWrReport()){ | ||
writeMetrics(writer,metrics); | ||
} | ||
} | ||
writer.flush(); | ||
} | ||
|
||
protected abstract void writeHeader(Writer writer) throws IOException; | ||
|
||
protected abstract void writeMetrics(Writer writer, Metrics metrics) | ||
throws IOException; | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
dev/cosbench-core/src/com/intel/cosbench/exporter/CSVWorkerExporter.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,72 @@ | ||
package com.intel.cosbench.exporter; | ||
|
||
import static com.intel.cosbench.exporter.Formats.NUM; | ||
import static com.intel.cosbench.exporter.Formats.RATIO; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
|
||
import com.intel.cosbench.bench.Metrics; | ||
import com.intel.cosbench.bench.Report; | ||
import com.intel.cosbench.bench.TaskReport; | ||
|
||
public class CSVWorkerExporter extends AbstractWorkerExporter{ | ||
|
||
@Override | ||
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()); | ||
} | ||
|
||
@Override | ||
protected void writeMetrics(Writer writer,Metrics metrics)throws IOException { | ||
StringBuilder buffer = new StringBuilder(); | ||
/*Operation Type*/ | ||
buffer.append(metrics.getOpType()).append(','); | ||
/*sample Type*/ | ||
buffer.append(metrics.getSampleType()).append(','); | ||
/* Operation Count */ | ||
buffer.append(metrics.getSampleCount()).append(','); | ||
/* Byte Count */ | ||
buffer.append(metrics.getByteCount()).append(','); | ||
/* Response Time */ | ||
double r = metrics.getAvgResTime(); | ||
if (r > 0) | ||
buffer.append(NUM.format(r)); | ||
else | ||
buffer.append("N/A"); | ||
buffer.append(','); | ||
|
||
/* Transfer Time */ | ||
double pt = metrics.getAvgResTime() - metrics.getAvgXferTime(); | ||
if (pt > 0) | ||
buffer.append(NUM.format(pt)); | ||
else | ||
buffer.append("N/A"); | ||
buffer.append(','); | ||
|
||
/* Throughput */ | ||
buffer.append(NUM.format(metrics.getThroughput())).append(','); | ||
/* Bandwidth */ | ||
buffer.append(NUM.format(metrics.getBandwidth())).append(','); | ||
/* Success Ratio */ | ||
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/WorkerExporter.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 WorkerExporter { | ||
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
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