Skip to content

Commit

Permalink
Add a thread timeline index column to the multi-thread timeline
Browse files Browse the repository at this point in the history
Fix #123
  • Loading branch information
jpmonettas committed Jan 23, 2024
1 parent 39c2fdf commit 381ef7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

### New Features

- Add a index column to the bookmarks table
- Add a timeline index column to the bookmarks table
- Add a thread timeline index column to the multi-thread timeline

### Changes

Expand Down
15 changes: 8 additions & 7 deletions src-dbg/flow_storm/debugger/ui/timeline/screen.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

(defn main-pane []
(let [{:keys [table-view-pane table-view add-all] :as table-data}
(table-view {:columns ["Thread Id" "Thread Name" "Function" "Expression" "Value" "Value type"]
(table-view {:columns ["Thread Id" "Thread Name" "Thread Idx" "Function" "Expression" "Value" "Value type"]
:resize-policy :constrained
:cell-factory-fn (fn [_ cell-val]
(doto (label (str cell-val))
Expand All @@ -39,7 +39,7 @@
(flows-screen/goto-location {:flow-id flow-id
:thread-id thread-id
:idx thread-timeline-idx})))))))
:search-predicate (fn [[_ thread-id function expression expr-val expr-type] search-str]
:search-predicate (fn [[_ thread-id _ function expression expr-val expr-type] search-str]
(boolean
(or (str/includes? (str thread-id) search-str)
(str/includes? function search-str)
Expand All @@ -59,13 +59,14 @@
(into #{}))
thread-color (zipmap thread-ids thread-colors)]
(->> timeline
(mapv (fn [{:keys [type thread-id fn-ns fn-name expr-str expr-type expr-val-str] :as tl-entry}]
(let [{:keys [thread/name]} (dbg-state/get-thread-info thread-id)]
(mapv (fn [{:keys [thread-timeline-idx type thread-id fn-ns fn-name expr-str expr-type expr-val-str] :as tl-entry}]
(let [{:keys [thread/name]} (dbg-state/get-thread-info thread-id)
idx (inc thread-timeline-idx)]
(with-meta
(case type
:fn-call [thread-id name (format "%s/%s" fn-ns fn-name) "" "" ""]
:fn-return [thread-id name "RETURN" "" expr-val-str expr-type]
:expr-exec [thread-id name "" expr-str expr-val-str expr-type])
:fn-call [thread-id name idx (format "%s/%s" fn-ns fn-name) "" "" ""]
:fn-return [thread-id name idx "RETURN" "" expr-val-str expr-type]
:expr-exec [thread-id name idx "" expr-str expr-val-str expr-type])
(assoc tl-entry :color (thread-color thread-id))))))
add-all)))
:tooltip "Refresh the content of the timeline")
Expand Down

0 comments on commit 381ef7a

Please sign in to comment.