diff --git a/mpistalls.c b/mpistalls.c index 9df9c4f1aca5de84abfacfa38558e4b681b24fe3..2506f515b69fbb85e5933c68f30446fa04f1d04a 100644 --- a/mpistalls.c +++ b/mpistalls.c @@ -153,7 +153,13 @@ static void *recv_thread(void *arg) { static int cmp_logs(const void *p1, const void *p2) { struct mpiuse_log_entry *l1 = *(struct mpiuse_log_entry **)p1; struct mpiuse_log_entry *l2 = *(struct mpiuse_log_entry **)p2; - return l1->tic - l2->tic; + + /* Large unsigned values, so take care. */ + if (l1->tic > l2->tic) + return 1; + if (l1->tic < l2->tic) + return -1; + return 0; } /* Pick out the relevant logging data for our rank, i.e. all activations of