config.hpp 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
  3. This file is part of libzmq, the ZeroMQ core engine in C++.
  4. libzmq is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU Lesser General Public License (LGPL) as published
  6. by the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. As a special exception, the Contributors give you permission to link
  9. this library with independent modules to produce an executable,
  10. regardless of the license terms of these independent modules, and to
  11. copy and distribute the resulting executable under terms of your choice,
  12. provided that you also meet, for each linked independent module, the
  13. terms and conditions of the license of that module. An independent
  14. module is a module which is not derived from or based on this library.
  15. If you modify this library, you must extend this exception to your
  16. version of the library.
  17. libzmq is distributed in the hope that it will be useful, but WITHOUT
  18. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  19. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  20. License for more details.
  21. You should have received a copy of the GNU Lesser General Public License
  22. along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. */
  24. #ifndef __ZMQ_CONFIG_HPP_INCLUDED__
  25. #define __ZMQ_CONFIG_HPP_INCLUDED__
  26. namespace zmq
  27. {
  28. // Compile-time settings.
  29. enum
  30. {
  31. // Number of new messages in message pipe needed to trigger new memory
  32. // allocation. Setting this parameter to 256 decreases the impact of
  33. // memory allocation by approximately 99.6%
  34. message_pipe_granularity = 256,
  35. // Commands in pipe per allocation event.
  36. command_pipe_granularity = 16,
  37. // Determines how often does socket poll for new commands when it
  38. // still has unprocessed messages to handle. Thus, if it is set to 100,
  39. // socket will process 100 inbound messages before doing the poll.
  40. // If there are no unprocessed messages available, poll is done
  41. // immediately. Decreasing the value trades overall latency for more
  42. // real-time behaviour (less latency peaks).
  43. inbound_poll_rate = 100,
  44. // Maximal delta between high and low watermark.
  45. max_wm_delta = 1024,
  46. // Maximum number of events the I/O thread can process in one go.
  47. max_io_events = 256,
  48. // Maximal batch size of packets forwarded by a ZMQ proxy.
  49. // Increasing this value improves throughput at the expense of
  50. // latency and fairness.
  51. proxy_burst_size = 1000,
  52. // Maximal delay to process command in API thread (in CPU ticks).
  53. // 3,000,000 ticks equals to 1 - 2 milliseconds on current CPUs.
  54. // Note that delay is only applied when there is continuous stream of
  55. // messages to process. If not so, commands are processed immediately.
  56. max_command_delay = 3000000,
  57. // Low-precision clock precision in CPU ticks. 1ms. Value of 1000000
  58. // should be OK for CPU frequencies above 1GHz. If should work
  59. // reasonably well for CPU frequencies above 500MHz. For lower CPU
  60. // frequencies you may consider lowering this value to get best
  61. // possible latencies.
  62. clock_precision = 1000000,
  63. // On some OSes the signaler has to be emulated using a TCP
  64. // connection. In such cases following port is used.
  65. // If 0, it lets the OS choose a free port without requiring use of a
  66. // global mutex. The original implementation of a Windows signaler
  67. // socket used port 5905 instead of letting the OS choose a free port.
  68. // https://github.com/zeromq/libzmq/issues/1542
  69. signaler_port = 0
  70. };
  71. }
  72. #endif