[erlang-questions] Measuring the overhead of various port driver approaches
Fri Dec 14 03:13:51 CET 2007
Have a look at this thread for someone who's done that:
That said ...
In the case of a communication's channel driver you could have
a queue of messages within the driver. The driver could have
marked the port busy with the erl_driver set_busy_port() function
which will cause the calling process to suspend. In either case
you need an out of band method to communicate with the driver directly.
The response time to a port_command/2 depends on the current message
load. It has to get through to the driver (possibly suspending the
process until the driver signals as not busy) and through the driver
queue. The response will be sent through the port and added to the
calling process mailbox. The size of the driver queue and the process
mailbox will be factors in the turn around time.
The port_control/3 and port_call/3 bifs make immediate calls to
the driver. The emulator executes the driver's callback function
and returns the result to the process.
On Fri, Dec 14, 2007 at 01:05:57AM +0000, Joel Reymont wrote:
} I would like to measure the overhead of receiving data in the output
} callback vs. outputv as well as the overhead of various ways of
} returning data.
} Would it suffice to send now/0 down to the driver, have the driver
} send back the timestamp returned by driver_get_now and then grab now/0
} once again?
More information about the erlang-questions