Efficient logging algorithm for incremental replay of message-passing applications