Skip to content

Commit 8c1ea57

Browse files
committed
Simplifying timelines flow-id
1 parent 684270c commit 8c1ea57

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

src-inst/flow_storm/runtime/debuggers_api.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@
824824
(-> entry
825825
index-api/as-immutable
826826
(ensure-indexes i)
827-
(assoc :flow-id (index-protos/flow-id tl i)
827+
(assoc :flow-id (index-protos/flow-id tl)
828828
:thread-id (index-protos/thread-id tl i))
829829
reference-timeline-entry!)
830830
(recur (next-fn i))))))))

src-inst/flow_storm/runtime/indexes/api.cljc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@
723723
(if backward?
724724
(dec (count timeline))
725725
0))
726-
flow-id (index-protos/flow-id timeline curr-idx)
726+
flow-id (index-protos/flow-id timeline)
727727
thread-id (index-protos/thread-id timeline curr-idx)
728728
to-idx (if backward?
729729
(max (- curr-idx batch-size) 0)
@@ -1129,9 +1129,16 @@
11291129
[x]
11301130
(fn-return-trace/fn-end-trace? x))
11311131

1132+
(defn timeline-flow-id
1133+
"Given a timeline returns its flow-id"
1134+
[timeline]
1135+
(index-protos/flow-id timeline))
1136+
11321137
(defn timeline-thread-id
11331138
"Given a timeline and a idx, returns the thread-id associated to the entry.
11341139
On single thread timelines all index are going to return the same thread-id, which
11351140
is not the case for total order timelines."
11361141
[timeline idx]
11371142
(index-protos/thread-id timeline idx))
1143+
1144+

src-inst/flow_storm/runtime/indexes/protocols.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(reset-build-stack [_]))
1616

1717
(defprotocol TimelineP
18-
(flow-id [_ idx])
18+
(flow-id [_])
1919
(thread-id [_ idx]))
2020

2121
(defprotocol TimelineEntryP

src-inst/flow_storm/runtime/indexes/thread_registry.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
(register-thread-indexes [this flow-id thread-id thread-name form-id indexes]
5353
(when-not (index-protos/flow-exists? this flow-id)
54-
(swap! total-order-timelines assoc flow-id (total-order-timeline/make-total-order-timeline)))
54+
(swap! total-order-timelines assoc flow-id (total-order-timeline/make-total-order-timeline flow-id)))
5555

5656
(swap! registry update flow-id
5757
(fn [threads]

src-inst/flow_storm/runtime/indexes/timeline_index.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
(defn- print-it [timeline]
4848
(utils/format "#flow-storm/timeline [flow-id: %d thread-id: %d count: %d]"
49-
(index-protos/flow-id timeline 0)
49+
(index-protos/flow-id timeline)
5050
(index-protos/thread-id timeline 0)
5151
(count timeline)))
5252

@@ -78,7 +78,7 @@
7878
]
7979

8080
index-protos/TimelineP
81-
(flow-id [_ _] flow-id)
81+
(flow-id [_] flow-id)
8282
(thread-id [_ _] tid)
8383

8484
index-protos/ThreadTimelineRecorderP

src-inst/flow_storm/runtime/indexes/total_order_timeline.cljc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,12 @@
4242
(defmethod print-method TotalOrderTimelineEntry [tote ^java.io.Writer w]
4343
(.write w ^String (print-tote tote))))
4444

45-
(deftype TotalOrderTimeline [mt-timeline]
45+
(deftype TotalOrderTimeline [flow-id mt-timeline]
4646

4747
index-protos/TimelineP
4848

49-
(flow-id [this idx]
50-
(locking this
51-
(let [tote (ml-get mt-timeline idx)
52-
th-tl (index-protos/tote-thread-timeline tote)]
53-
(index-protos/flow-id th-tl 0))))
49+
(flow-id [_]
50+
flow-id)
5451

5552
(thread-id [this idx]
5653
(locking this
@@ -121,8 +118,8 @@
121118
(-nth [_ n] (ml-get mt-timeline n))
122119
(-nth [_ n not-found] (or (ml-get mt-timeline n) not-found))]))
123120

124-
(defn make-total-order-timeline []
125-
(TotalOrderTimeline. (make-mutable-list)))
121+
(defn make-total-order-timeline [flow-id]
122+
(TotalOrderTimeline. flow-id (make-mutable-list)))
126123

127124
(defn make-detailed-timeline-mapper [forms-registry]
128125
(let [threads-stacks (atom {})]

0 commit comments

Comments
 (0)