Line-based finite state machine that turns a sequence of jstack output lines into a parsed dump map of the shape
{:prelude [<lines>] :threads [<thread> ...] :epilogue [<lines>]}
The parser knows nothing about colors, indexes, or reporting — it is purely lines in, data out. Downstream namespaces (model, analyze, render, report) layer enrichment, derivation, and presentation on top.
Line-based finite state machine that turns a sequence of
jstack output lines into a parsed dump map of the shape
{:prelude [<lines>]
:threads [<thread> ...]
:epilogue [<lines>]}
The parser knows nothing about colors, indexes, or reporting — it is
purely lines in, data out. Downstream namespaces (model, analyze,
render, report) layer enrichment, derivation, and presentation on top.Patterns that may appear inside a thread block. The parser walks this list top-to-bottom and takes the first match — so the most common patterns (stack-trace entries, blank line terminators) come first. Patterns are mutually exclusive, so order is a performance knob only.
Patterns that may appear inside a thread block. The parser walks this list top-to-bottom and takes the first match — so the most common patterns (stack-trace entries, blank line terminators) come first. Patterns are mutually exclusive, so order is a performance knob only.
(currently line)Extract the trailing state-summary phrase from the first line of a
thread block, e.g. in Object.wait() or runnable.
Extract the trailing state-summary phrase from the first line of a thread block, e.g. `in Object.wait()` or `runnable`.
(daemon? line)True when the first line of a thread block marks the thread daemon.
True when the first line of a thread block marks the thread daemon.
Maps a dashed-line state to the :type (and optional :wait-type)
recorded for the resulting trace element.
Maps a dashed-line state to the `:type` (and optional `:wait-type`) recorded for the resulting trace element.
(decorate-dump-date dump first-line)If the first line of the dump matches yyyy-MM-dd HH:mm:ss, parse
and stash it on the dump map under :date.
If the first line of the dump matches `yyyy-MM-dd HH:mm:ss`, parse and stash it on the dump map under :date.
Allowed state transitions keyed by current state. :start is a
virtual state with no matching line. :any matches any line and
:empty matches the empty string.
Allowed state transitions keyed by current state. `:start` is a virtual state with no matching line. `:any` matches any line and `:empty` matches the empty string.
(first-line-prop line name)Extract a name=value property value from the first line of a
thread block (e.g. prio=6, tid=0x00007f4e0c0e9800).
Extract a `name=value` property value from the first line of a thread block (e.g. `prio=6`, `tid=0x00007f4e0c0e9800`).
(id line)Extract the integer thread id (the #N token) from the first line
of a thread block, or nil when no id is present.
Extract the integer thread id (the `#N` token) from the first line of a thread block, or nil when no id is present.
(parse-block-first-line line)Parse the quoted-name + flags line that opens a thread block.
Example: "RMI TCP Connection(idle)" daemon prio=10 tid=... nid=... waiting on condition [0x00002b7b25bab000]
Parse the quoted-name + flags line that opens a thread block.
Example: `"RMI TCP Connection(idle)" daemon prio=10 tid=... nid=...
waiting on condition [0x00002b7b25bab000]`(parse-block-second-line rec line)Parse java.lang.Thread.State: WAITING (on object monitor).
Parse ` java.lang.Thread.State: WAITING (on object monitor)`.
(parse-dashed-line m state line)Parse one of the \t- ... annotation lines emitted by jstack, e.g.
Parse one of the `\t- ...` annotation lines emitted by jstack, e.g. - locked <0x00000007d39893e0> (a atg.nucleus.ConfigurationLock) - waiting to lock <0x00000006492773a0> (a java.lang.Object) - parking to wait for <0x0000000645e75218> - waiting on <0x000000066c425080> (a java.lang.ref.Reference$Lock) - waiting on <no object reference available> - waiting to lock <0x...> (a java.lang.Class for some.pkg.Klass)
(parse-jstack-lines lines)Walk a sequence of jstack lines and return the structural skeleton:
prelude, vector of threads with raw :trace, and epilogue. Use
jstack-report.model/dump for the fully enriched result.
The in-progress thread block is tracked as a local building and
only conj'd into the threads vector at block boundaries. For a
500k-line dump that saves hundreds of thousands of intermediate
outer-map allocations the previous update-in [:threads idx] ...
approach was paying.
Walk a sequence of jstack lines and return the structural skeleton: prelude, vector of threads with raw `:trace`, and epilogue. Use jstack-report.model/dump for the fully enriched result. The in-progress thread block is tracked as a local `building` and only conj'd into the threads vector at block boundaries. For a 500k-line dump that saves hundreds of thousands of intermediate outer-map allocations the previous `update-in [:threads idx] ...` approach was paying.
(parse-trace-element-line line)Parse one \tat fully.qualified.Class.method(File.java:42) line
into {:class :method :file :line-#}. Native methods, unknown source,
and <generated> files have no line number.
Parse one `\tat fully.qualified.Class.method(File.java:42)` line
into `{:class :method :file :line-#}`. Native methods, unknown source,
and `<generated>` files have no line number.(parse-trace-element-line-delayed rec line)Append a stack-trace element to the thread's :trace vector. Keeps
only the raw :line and an element :type so the parser stays
cheap; callers that need the parsed class/method/file/line can run
parse-trace-element-line on the :line themselves.
Append a stack-trace element to the thread's :trace vector. Keeps only the raw `:line` and an element `:type` so the parser stays cheap; callers that need the parsed class/method/file/line can run `parse-trace-element-line` on the `:line` themselves.
(thread-name line)Extract a thread name (the leading quoted segment) from the first line of a thread block.
Extract a thread name (the leading quoted segment) from the first line of a thread block.
JVM Thread.State name to keyword.
JVM Thread.State name to keyword.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |