mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 07:56:09 +00:00
Problem: zmq_proxy STATISTICS eligible for stable
Solution: do it
This commit is contained in:
parent
d61c47ef6f
commit
f1dd84c11f
3
NEWS
3
NEWS
@ -31,6 +31,9 @@
|
|||||||
See doc/zmq_socket_monitor.txt for more details and error codes.
|
See doc/zmq_socket_monitor.txt for more details and error codes.
|
||||||
- zmq_stopwatch_intermediate which returns the time elapsed without stopping
|
- zmq_stopwatch_intermediate which returns the time elapsed without stopping
|
||||||
the stopwatch.
|
the stopwatch.
|
||||||
|
- zmq_proxy_steerable command 'STATISTICS' to retrieve stats about the amount
|
||||||
|
of messages and bytes sent and received by the proxy.
|
||||||
|
See doc/zmq_proxy_steerable.txt for more information.
|
||||||
|
|
||||||
* The build-time configuration option to select the poller has been split, and
|
* The build-time configuration option to select the poller has been split, and
|
||||||
new API_POLLER (CMake) and --with-api-poller (autoconf) options will now
|
new API_POLLER (CMake) and --with-api-poller (autoconf) options will now
|
||||||
|
@ -425,20 +425,16 @@ int zmq::proxy (class socket_base_t *frontend_,
|
|||||||
&& memcmp (msg.data (), "TERMINATE", 9) == 0)
|
&& memcmp (msg.data (), "TERMINATE", 9) == 0)
|
||||||
state = terminated;
|
state = terminated;
|
||||||
else {
|
else {
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
if (msg.size () == 10
|
if (msg.size () == 10
|
||||||
&& memcmp (msg.data (), "STATISTICS", 10) == 0) {
|
&& memcmp (msg.data (), "STATISTICS", 10) == 0) {
|
||||||
rc = reply_stats (control_, &frontend_stats,
|
rc = reply_stats (control_, &frontend_stats,
|
||||||
&backend_stats);
|
&backend_stats);
|
||||||
CHECK_RC_EXIT_ON_FAILURE ();
|
CHECK_RC_EXIT_ON_FAILURE ();
|
||||||
} else {
|
} else {
|
||||||
#endif
|
|
||||||
// This is an API error, we assert
|
// This is an API error, we assert
|
||||||
puts ("E: invalid command sent to proxy");
|
puts ("E: invalid command sent to proxy");
|
||||||
zmq_assert (false);
|
zmq_assert (false);
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
control_in = false;
|
control_in = false;
|
||||||
@ -604,7 +600,6 @@ int zmq::proxy (class socket_base_t *frontend_,
|
|||||||
&& memcmp (msg.data (), "TERMINATE", 9) == 0)
|
&& memcmp (msg.data (), "TERMINATE", 9) == 0)
|
||||||
state = terminated;
|
state = terminated;
|
||||||
else {
|
else {
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
if (msg.size () == 10
|
if (msg.size () == 10
|
||||||
&& memcmp (msg.data (), "STATISTICS", 10) == 0) {
|
&& memcmp (msg.data (), "STATISTICS", 10) == 0) {
|
||||||
rc =
|
rc =
|
||||||
@ -612,13 +607,10 @@ int zmq::proxy (class socket_base_t *frontend_,
|
|||||||
if (unlikely (rc < 0))
|
if (unlikely (rc < 0))
|
||||||
return close_and_return (&msg, -1);
|
return close_and_return (&msg, -1);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
|
||||||
// This is an API error, we assert
|
// This is an API error, we assert
|
||||||
puts ("E: invalid command sent to proxy");
|
puts ("E: invalid command sent to proxy");
|
||||||
zmq_assert (false);
|
zmq_assert (false);
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Process a request
|
// Process a request
|
||||||
|
@ -472,11 +472,9 @@ int main (void)
|
|||||||
msleep (500); // Wait for all clients and workers to STOP
|
msleep (500); // Wait for all clients and workers to STOP
|
||||||
|
|
||||||
|
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
if (is_verbose)
|
if (is_verbose)
|
||||||
printf ("retrieving stats from the proxy\n");
|
printf ("retrieving stats from the proxy\n");
|
||||||
check_proxy_stats (control_proxy);
|
check_proxy_stats (control_proxy);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (is_verbose)
|
if (is_verbose)
|
||||||
printf ("shutting down all clients and server workers\n");
|
printf ("shutting down all clients and server workers\n");
|
||||||
|
@ -300,9 +300,7 @@ static void proxy_stats_asker_thread_main (void *pvoid)
|
|||||||
// Start!
|
// Start!
|
||||||
|
|
||||||
while (!zmq_atomic_counter_value (cfg->subscriber_received_all)) {
|
while (!zmq_atomic_counter_value (cfg->subscriber_received_all)) {
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
check_proxy_stats (control_req);
|
check_proxy_stats (control_req);
|
||||||
#endif
|
|
||||||
usleep (1000); // 1ms -> in best case we will get 1000updates/second
|
usleep (1000); // 1ms -> in best case we will get 1000updates/second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user