Skip to content

Commit c6c311e

Browse files
committed
Use processes and threads in the pftrace
1 parent c642e94 commit c6c311e

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

preciceprofiling/common.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def participants(self):
122122

123123
def ranks(self):
124124
return self._cur.execute(
125-
"SELECT DISTINCT participant, rank FROM full_events"
125+
"SELECT DISTINCT participant, rank FROM full_events ORDER BY participant ASC, rank ASC"
126126
).fetchall()
127127

128128
def events(self):
@@ -195,31 +195,29 @@ def groupFor(name):
195195

196196
builder = TraceProtoBuilder()
197197

198-
participants = {
199-
p: uuid.uuid4().int & ((1 << 63) - 1) for p in self.participants()
200-
}
198+
participants = {name: pid for pid, name in enumerate(self.participants())}
201199

202-
for p, u in participants.items():
200+
for name, pid in participants.items():
203201
pkt = builder.add_packet()
204-
pkt.track_descriptor.uuid = u
205-
pkt.track_descriptor.name = p
206-
pkt.track_descriptor.child_ordering = TrackDescriptor.EXPLICIT
202+
pkt.track_descriptor.uuid = uuid.uuid4().int & ((1 << 63) - 1)
203+
pkt.track_descriptor.process.pid = pid
204+
pkt.track_descriptor.process.process_name = name
207205
pkt.trusted_packet_sequence_id = TPS_ID
208206

209207
ranks = [
210208
(p, r, i)
211209
for i, (p, r) in enumerate(
212210
self.ranks(),
213-
start=10,
211+
start=10, # 0 is reserved
214212
)
215213
]
216214

217215
for p, r, u in ranks:
218216
pkt = builder.add_packet()
219217
pkt.track_descriptor.uuid = u
220-
pkt.track_descriptor.name = f"Rank {r}"
221-
pkt.track_descriptor.parent_uuid = participants[p]
222-
pkt.track_descriptor.sibling_order_rank = r
218+
pkt.track_descriptor.thread.thread_name = f"Rank {r}"
219+
pkt.track_descriptor.thread.pid = participants[p]
220+
pkt.track_descriptor.thread.tid = u
223221
pkt.trusted_packet_sequence_id = TPS_ID
224222
pkt.sequence_flags = TracePacket.SEQ_INCREMENTAL_STATE_CLEARED
225223

0 commit comments

Comments
 (0)