Skip to content

Instantly share code, notes, and snippets.

@drewhk
Created December 17, 2015 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewhk/7c2c14c87cdb7c691751 to your computer and use it in GitHub Desktop.
Save drewhk/7c2c14c87cdb7c691751 to your computer and use it in GitHub Desktop.
Deadlock dumper
def dumpwaits(): Unit = {
println("digraph waits {")
for (i ← assembly.stages.indices) {
println(s"""N$i [label="${assembly.stages(i)}"]""")
}
for (i ← portStates.indices) {
portStates(i) match {
case InReady ⇒
println(s""" N${assembly.inOwners(i)} -> N${assembly.outOwners(i)} [label="shouldPull"]; """)
case OutReady ⇒
println(s""" N${assembly.outOwners(i)} -> N${assembly.inOwners(i)} [label="shouldPush"]; """)
case _ ⇒
println(s""" N${assembly.inOwners(i)} -> N${assembly.outOwners(i)} [style=dotted; label="closed" dir=both]; """)
}
}
println("}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment