コード例 #1
0
ファイル: gdbfe.py プロジェクト: thaolt/PGDB
 def out_handler(self, msg):
     """Handle an out message by adding the arec to the temporary list."""
     if self.arec_list:
         self.arec_list = combine_aggregated_records(self.arec_list +
                                                     msg.record)
     else:
         self.arec_list = msg.record
コード例 #2
0
    def main(self):
        """Main send/receive loop.

        This receives data on MRNet (non-blocking), processes the messages,
        and then sends any data that was read from GDB. This then sleeps for a
        short while to avoid heavy CPU use.

        """
        while True:
            if self.quit:
                break

            if self.sbd:
                # Check for data from the GDB process for LOAD_FILE.
                self.sbd.sbd_check()

            msg = self.comm.recv(blocking=False)
            if msg is not None:
                # Received data.
                if msg.msg_type in self.msg_handlers:
                    self.msg_handlers[msg.msg_type](msg)
                else:
                    print("Got a message {0} with no handler.".format(
                        msg.msg_type))

            records = []
            ranks = []
            for record in self.gdb.read():
                self.record_handler.handle(record)
                if not self.is_filterable(record):
                    records.append(record)
                    if (record.token is not None
                            and record.token in self.token_rank_map):
                        ranks.append(self.token_rank_map[record.token])
                    elif (hasattr(record, "thread_id")
                          and record.thread_id in self.thread_rank_map):
                        ranks.append(self.thread_rank_map[record.thread_id])
                    else:
                        ranks.append(self.comm.get_mpiranks())
            if records:
                arecs = combine_records(records, ranks)
                if self.doing_startup:
                    self.startup_arecs = combine_aggregated_records(
                        self.startup_arecs + arecs)
                else:
                    if not self.doing_startup and self.startup_arecs:
                        arecs = combine_aggregated_records(self.startup_arecs +
                                                           arecs)
                        self.comm.send(GDBMessage(OUT_MSG, record=arecs),
                                       self.comm.frontend)
                        self.startup_arecs = None
                    else:
                        self.comm.send(GDBMessage(OUT_MSG, record=arecs),
                                       self.comm.frontend)

            # Sleep a bit to reduce banging on the CPU.
            time.sleep(0.01)
        # Wait for GDB to exit.
        exited = False
        while not exited:
            exited = not self.gdb.is_running()
        # Shut everything else down.
        self.shutdown()
コード例 #3
0
ファイル: gdbbe.py プロジェクト: ndryden/PGDB
    def main(self):
        """Main send/receive loop.

        This receives data on MRNet (non-blocking), processes the messages,
        and then sends any data that was read from GDB. This then sleeps for a
        short while to avoid heavy CPU use.

        """
        while True:
            if self.quit:
                break

            if self.sbd:
                # Check for data from the GDB process for LOAD_FILE.
                self.sbd.sbd_check()

            msg = self.comm.recv(blocking=False)
            if msg is not None:
                # Received data.
                if msg.msg_type in self.msg_handlers:
                    self.msg_handlers[msg.msg_type](msg)
                else:
                    print("Got a message {0} with no handler.".format(
                        msg.msg_type))

            records = []
            ranks = []
            for record in self.gdb.read():
                self.record_handler.handle(record)
                if not self.is_filterable(record):
                    records.append(record)
                    if (record.token is not None and
                        record.token in self.token_rank_map):
                        ranks.append(self.token_rank_map[record.token])
                    elif (hasattr(record, "thread_id") and
                          record.thread_id in self.thread_rank_map):
                        ranks.append(self.thread_rank_map[record.thread_id])
                    else:
                        ranks.append(self.comm.get_mpiranks())
            if records:
                arecs = combine_records(records, ranks)
                if self.doing_startup:
                    self.startup_arecs = combine_aggregated_records(
                        self.startup_arecs + arecs)
                else:
                    if not self.doing_startup and self.startup_arecs:
                        arecs = combine_aggregated_records(
                            self.startup_arecs + arecs)
                        self.comm.send(GDBMessage(OUT_MSG, record=arecs),
                                       self.comm.frontend)
                        self.startup_arecs = None
                    else:
                        self.comm.send(GDBMessage(OUT_MSG, record=arecs),
                                       self.comm.frontend)

            # Sleep a bit to reduce banging on the CPU.
            time.sleep(0.01)
        # Wait for GDB to exit.
        exited = False
        while not exited:
            exited = not self.gdb.is_running()
        # Shut everything else down.
        self.shutdown()
コード例 #4
0
ファイル: gdbfe.py プロジェクト: ctanis/PGDB
 def out_handler(self, msg):
     """Handle an out message by adding the arec to the temporary list."""
     if self.arec_list:
         self.arec_list = combine_aggregated_records(self.arec_list + msg.record)
     else:
         self.arec_list = msg.record