This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a logger that clients of PSharp can use, called AsyncLogger. The logger places the messages it receives in a queue, and asynchronously dequeues and writes these messages to the underlying TextWriter.
For comparison, the PR also includes a synchronous logger (SyncWriterLogger) that uses locks and immediately writes to the underlying TextWriter once a lock has been acquired.
A performance test shows that AsyncLogger is twice as fast as SyncWriterLogger writing to a file at verbosity level 2.
The figure shows the performance of the loggers on a system with machines that don't communicate with each other. Default Clients indicates the number of machines created. "Null" suffixed to the benchmark name indicates that the logger writes to TextWriter.Null.
AsyncLogger switches to synchronous mode to flush pending messages in the queue on disposing it.
I would greatly appreciate feedback on better ways to do this without dropping any message.