From c6c311ef6d131443e7797b44be0e0ac4a597b36b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Wed, 29 Oct 2025 16:56:34 +0100 Subject: [PATCH] Use processes and threads in the pftrace --- preciceprofiling/common.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/preciceprofiling/common.py b/preciceprofiling/common.py index 6996826..f81bd65 100644 --- a/preciceprofiling/common.py +++ b/preciceprofiling/common.py @@ -122,7 +122,7 @@ def participants(self): def ranks(self): return self._cur.execute( - "SELECT DISTINCT participant, rank FROM full_events" + "SELECT DISTINCT participant, rank FROM full_events ORDER BY participant ASC, rank ASC" ).fetchall() def events(self): @@ -195,31 +195,29 @@ def groupFor(name): builder = TraceProtoBuilder() - participants = { - p: uuid.uuid4().int & ((1 << 63) - 1) for p in self.participants() - } + participants = {name: pid for pid, name in enumerate(self.participants())} - for p, u in participants.items(): + for name, pid in participants.items(): pkt = builder.add_packet() - pkt.track_descriptor.uuid = u - pkt.track_descriptor.name = p - pkt.track_descriptor.child_ordering = TrackDescriptor.EXPLICIT + pkt.track_descriptor.uuid = uuid.uuid4().int & ((1 << 63) - 1) + pkt.track_descriptor.process.pid = pid + pkt.track_descriptor.process.process_name = name pkt.trusted_packet_sequence_id = TPS_ID ranks = [ (p, r, i) for i, (p, r) in enumerate( self.ranks(), - start=10, + start=10, # 0 is reserved ) ] for p, r, u in ranks: pkt = builder.add_packet() pkt.track_descriptor.uuid = u - pkt.track_descriptor.name = f"Rank {r}" - pkt.track_descriptor.parent_uuid = participants[p] - pkt.track_descriptor.sibling_order_rank = r + pkt.track_descriptor.thread.thread_name = f"Rank {r}" + pkt.track_descriptor.thread.pid = participants[p] + pkt.track_descriptor.thread.tid = u pkt.trusted_packet_sequence_id = TPS_ID pkt.sequence_flags = TracePacket.SEQ_INCREMENTAL_STATE_CLEARED