Commit 5c494830 authored by Jens Korinth's avatar Jens Korinth
Browse files

Closes #69 - Composer.Result should contain UtilizationReport

* fixed occurrences, renamed the member
parent a87b16be
...@@ -81,11 +81,11 @@ object Composer { ...@@ -81,11 +81,11 @@ object Composer {
/** Extended result with additional information as provided by the tool. **/ /** Extended result with additional information as provided by the tool. **/
final case class Result( final case class Result(
result: ComposeResult, result: ComposeResult,
bit: Option[String] = None, bit: Option[String] = None,
log: Option[ComposerLog] = None, log: Option[ComposerLog] = None,
synth: Option[SynthesisReport] = None, util: Option[UtilizationReport] = None,
timing: Option[TimingReport] = None, timing: Option[TimingReport] = None,
power: Option[PowerReport] = None power: Option[PowerReport] = None
) )
/** Result of the external process execution. **/ /** Result of the external process execution. **/
......
...@@ -74,19 +74,19 @@ class VivadoComposer()(implicit cfg: Configuration, maxThreads: Option[Int]) ext ...@@ -74,19 +74,19 @@ class VivadoComposer()(implicit cfg: Configuration, maxThreads: Option[Int]) ext
// check retcode // check retcode
if (r == InterruptibleProcess.TIMEOUT_RETCODE) { if (r == InterruptibleProcess.TIMEOUT_RETCODE) {
logger.error("Vivado timeout for %s in '%s'".format(files.runName, files.outdir)) logger.error("Vivado timeout for %s in '%s'".format(files.runName, files.outdir))
Composer.Result(Timeout, log = files.log, synth = None, timing = None, power = None) Composer.Result(Timeout, log = files.log, util = None, timing = None, power = None)
} else if (r != 0) { } else if (r != 0) {
logger.error("Vivado finished with non-zero exit code: %d for %s in '%s'" logger.error("Vivado finished with non-zero exit code: %d for %s in '%s'"
.format(r, files.runName, files.outdir)) .format(r, files.runName, files.outdir))
Composer.Result(files.log map (_.result) getOrElse OtherError, log = files.log, Composer.Result(files.log map (_.result) getOrElse OtherError, log = files.log,
synth = None, timing = None, power = None) util = None, timing = None, power = None)
} else { } else {
// check for timing failure // check for timing failure
if (files.tim.isEmpty) { if (files.tim.isEmpty) {
throw new Exception("could not parse timing report: '%s'".format(files.timFile.toString)) throw new Exception("could not parse timing report: '%s'".format(files.timFile.toString))
} else { } else {
Composer.Result(checkTimingFailure(files), Some(files.bitFile.toString), Composer.Result(checkTimingFailure(files), Some(files.bitFile.toString),
files.log, files.syn, files.tim, files.pwr) files.log, files.util, files.tim, files.pwr)
} }
} }
} }
...@@ -208,11 +208,11 @@ object VivadoComposer { ...@@ -208,11 +208,11 @@ object VivadoComposer {
lazy val runName: String = "%s with %s[F=%1.3f]".format(logformat(c), t, f) lazy val runName: String = "%s with %s[F=%1.3f]".format(logformat(c), t, f)
lazy val pwrFile: Path = logFile.resolveSibling("power.txt") lazy val pwrFile: Path = logFile.resolveSibling("power.txt")
lazy val timFile: Path = logFile.resolveSibling("timing.txt") lazy val timFile: Path = logFile.resolveSibling("timing.txt")
lazy val synFile: Path = logFile.resolveSibling("utilization.txt") lazy val utilFile: Path = logFile.resolveSibling("utilization.txt")
lazy val log = ComposerLog(logFile) lazy val log = ComposerLog(logFile)
lazy val pwr = PowerReport(pwrFile) lazy val pwr = PowerReport(pwrFile)
lazy val tim = TimingReport(timFile) lazy val tim = TimingReport(timFile)
lazy val syn = SynthesisReport(synFile) lazy val util = UtilizationReport(utilFile)
} }
/** custom ProcessIO: ignore everything. */ /** custom ProcessIO: ignore everything. */
......
...@@ -25,12 +25,12 @@ package object json { ...@@ -25,12 +25,12 @@ package object json {
def writes(r: ComposeResult): JsValue = JsString(r.toString) def writes(r: ComposeResult): JsValue = JsString(r.toString)
} }
private def mkComposerResult(r: ComposeResult, bit: Option[String], log: Option[String], synth: Option[String], private def mkComposerResult(r: ComposeResult, bit: Option[String], log: Option[String], util: Option[String],
timing: Option[String], power: Option[String]) = Composer.Result( timing: Option[String], power: Option[String]) = Composer.Result(
r, r,
bit, bit,
log flatMap (f => ComposerLog(Paths.get(f))), log flatMap (f => ComposerLog(Paths.get(f))),
synth flatMap (f => SynthesisReport(Paths.get(f))), util flatMap (f => UtilizationReport(Paths.get(f))),
timing flatMap (f => TimingReport(Paths.get(f))), timing flatMap (f => TimingReport(Paths.get(f))),
power flatMap (f => PowerReport(Paths.get(f))) power flatMap (f => PowerReport(Paths.get(f)))
) )
...@@ -39,7 +39,7 @@ package object json { ...@@ -39,7 +39,7 @@ package object json {
r.result, r.result,
r.bit, r.bit,
r.log map (_.file.toString), r.log map (_.file.toString),
r.synth map (_.file.toString), r.util map (_.file.toString),
r.timing map (_.file.toString), r.timing map (_.file.toString),
r.power map (_.file.toString) r.power map (_.file.toString)
) )
...@@ -48,7 +48,7 @@ package object json { ...@@ -48,7 +48,7 @@ package object json {
(JsPath \ "Result").format[ComposeResult] ~ (JsPath \ "Result").format[ComposeResult] ~
(JsPath \ "Bitstream").formatNullable[String] ~ (JsPath \ "Bitstream").formatNullable[String] ~
(JsPath \ "Log").formatNullable[String] ~ (JsPath \ "Log").formatNullable[String] ~
(JsPath \ "SynthesisReport").formatNullable[String] ~ (JsPath \ "UtilizationReport").formatNullable[String] ~
(JsPath \ "TimingReport").formatNullable[String] ~ (JsPath \ "TimingReport").formatNullable[String] ~
(JsPath \ "PowerReport").formatNullable[String] (JsPath \ "PowerReport").formatNullable[String]
) (mkComposerResult _, wrComposerResult _) ) (mkComposerResult _, wrComposerResult _)
......
...@@ -94,7 +94,7 @@ class ExplorationGraphController extends ViewController { ...@@ -94,7 +94,7 @@ class ExplorationGraphController extends ViewController {
egp.detailPanel.element = n egp.detailPanel.element = n
Graph.graph.result(n) foreach { cr => { Graph.graph.result(n) foreach { cr => {
_logger.trace("{} -> {}", n: Any, cr) _logger.trace("{} -> {}", n: Any, cr)
cr.synth foreach { Reports += _ } cr.util foreach { Reports += _ }
cr.timing foreach { Reports += _ } cr.timing foreach { Reports += _ }
cr.power foreach { Reports += _ } cr.power foreach { Reports += _ }
}} }}
......
...@@ -57,14 +57,14 @@ class ComposeTask(composition: Composition, ...@@ -57,14 +57,14 @@ class ComposeTask(composition: Composition,
_logger.trace("_composerResult = {}", _composerResult: Any) _logger.trace("_composerResult = {}", _composerResult: Any)
_logger.info(("compose run %s@%2.3f MHz for %s finished, result: %s, bitstream file: '%s', " + _logger.info(("compose run %s@%2.3f MHz for %s finished, result: %s, bitstream file: '%s', " +
"logfile: '%s', synthesis report: '%s', timing report: '%s', power report: '%s'").format( "logfile: '%s', utilization report: '%s', timing report: '%s', power report: '%s'").format(
composition: Any, composition: Any,
designFrequency, designFrequency,
target, target,
_composerResult map (_.result) getOrElse "", _composerResult map (_.result) getOrElse "",
_composerResult map (_.bit) getOrElse "", _composerResult map (_.bit) getOrElse "",
_composerResult flatMap (_.log map (_.file)) getOrElse "", _composerResult flatMap (_.log map (_.file)) getOrElse "",
_composerResult flatMap (_.synth map (_.file)) getOrElse "", _composerResult flatMap (_.util map (_.file)) getOrElse "",
_composerResult flatMap (_.timing map (_.file)) getOrElse "", _composerResult flatMap (_.timing map (_.file)) getOrElse "",
_composerResult flatMap (_.power map (_.file)) getOrElse "")) _composerResult flatMap (_.power map (_.file)) getOrElse ""))
...@@ -146,7 +146,7 @@ object ComposeTask { ...@@ -146,7 +146,7 @@ object ComposeTask {
private final val RE_LOG = """compose run .*result: \S+.*logfile: '([^']+)'""".r.unanchored private final val RE_LOG = """compose run .*result: \S+.*logfile: '([^']+)'""".r.unanchored
private final val RE_TIMING = """compose run .*result: \S+.*timing report: '([^']+)'""".r.unanchored private final val RE_TIMING = """compose run .*result: \S+.*timing report: '([^']+)'""".r.unanchored
private final val RE_POWER = """compose run .*result: \S+.*power report: '([^']+)'""".r.unanchored private final val RE_POWER = """compose run .*result: \S+.*power report: '([^']+)'""".r.unanchored
private final val RE_SYNTH = """compose run .*result: \S+.*synth report: '([^']+)'""".r.unanchored private final val RE_UTIL = """compose run .*result: \S+.*utilization report: '([^']+)'""".r.unanchored
private final val RE_RRANDOM = """(?i)(random|r(?:nd)?)""".r private final val RE_RRANDOM = """(?i)(random|r(?:nd)?)""".r
private final val RE_RPLACER = """(?i)(placer|p(?:lc)?)""".r private final val RE_RPLACER = """(?i)(placer|p(?:lc)?)""".r
private final val RE_RTIMING = """(?i)(timing|t(?:mg)?)""".r private final val RE_RTIMING = """(?i)(timing|t(?:mg)?)""".r
...@@ -169,16 +169,16 @@ object ComposeTask { ...@@ -169,16 +169,16 @@ object ComposeTask {
logger.trace("power path: {}", mkpath(m)) logger.trace("power path: {}", mkpath(m))
PowerReport(mkpath(m)) PowerReport(mkpath(m))
}) })
val synth = RE_SYNTH.findFirstMatchIn(lines) flatMap (m => { val util = RE_UTIL.findFirstMatchIn(lines) flatMap (m => {
logger.trace("synth path: {}", mkpath(m)) logger.trace("utilization path: {}", mkpath(m))
SynthesisReport(mkpath(m)) UtilizationReport(mkpath(m))
}) })
val timing = RE_TIMING.findFirstMatchIn(lines) flatMap (m => { val timing = RE_TIMING.findFirstMatchIn(lines) flatMap (m => {
logger.trace("timing path: {}", mkpath(m)) logger.trace("timing path: {}", mkpath(m))
TimingReport(mkpath(m)) TimingReport(mkpath(m))
}) })
logger.debug("result = {}, llog = {}, power = {}, synth = {}, timing = {}", result, llog, power, synth, timing) logger.debug("result = {}, llog = {}, power = {}, util = {}, timing = {}", result, llog, power, util, timing)
result map (r => Composer.Result(r, log = llog, power = power, synth = synth, timing = timing)) result map (r => Composer.Result(r, log = llog, power = power, util = util, timing = timing))
} }
// scalastyle:off magic.number // scalastyle:off magic.number
......
...@@ -80,13 +80,13 @@ private class DesignSpaceExplorationTask( ...@@ -80,13 +80,13 @@ private class DesignSpaceExplorationTask(
// log the result // log the result
_logger.info("DSE%s run %s for %s finished, result: %s;{}".format(dimensions, composition, target, result.nonEmpty), _logger.info("DSE%s run %s for %s finished, result: %s;{}".format(dimensions, composition, target, result.nonEmpty),
result map ( res => result map ( res =>
(" best result: %s @ %1.3f, bitstream file: '%s', logfile: '%s', synthesis report: '%s', " + (" best result: %s @ %1.3f, bitstream file: '%s', logfile: '%s', utilization report: '%s', " +
"timing report: '%s', power report: '%s'").format( "timing report: '%s', power report: '%s'").format(
res._1.composition, res._1.composition,
res._1.frequency, res._1.frequency,
res._2.bit getOrElse "", res._2.bit getOrElse "",
res._2.log map (_.file) getOrElse "", res._2.log map (_.file) getOrElse "",
res._2.synth map (_.file) getOrElse "", res._2.util map (_.file) getOrElse "",
res._2.timing map (_.file) getOrElse "", res._2.timing map (_.file) getOrElse "",
res._2.power map (_.file) getOrElse "")) getOrElse "") res._2.power map (_.file) getOrElse "")) getOrElse "")
// return success, if result is not empty // return success, if result is not empty
......
...@@ -37,10 +37,10 @@ object LogFormatter { ...@@ -37,10 +37,10 @@ object LogFormatter {
"%s[F=%3.3f] with (h = %3.5f)".format(logformat(de.composition), de.frequency, de.h) "%s[F=%3.3f] with (h = %3.5f)".format(logformat(de.composition), de.frequency, de.h)
def logformat(ce: Composer.Result): String = def logformat(ce: Composer.Result): String =
"%s, logfile: '%s', synthesis report: '%s', timing report: '%s', power report: '%s'" "%s, logfile: '%s', utilization report: '%s', timing report: '%s', power report: '%s'"
.format(ce.result, .format(ce.result,
ce.log map (_.file.toString) getOrElse "", ce.log map (_.file.toString) getOrElse "",
ce.synth map (_.file.toString) getOrElse "", ce.util map (_.file.toString) getOrElse "",
ce.timing map (_.file.toString) getOrElse "", ce.timing map (_.file.toString) getOrElse "",
ce.power map (_.file.toString) getOrElse "") ce.power map (_.file.toString) getOrElse "")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment