Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Asynchronous Logger #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Asynchronous Logger #263

wants to merge 1 commit into from

Conversation

anirudhsanthiar
Copy link
Contributor

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.

loggertest-barplot
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant