Tests: add consumer testpoint to pause data consumption
[lttng-tools.git] / src / common / consumer / consumer.c
index 3b857dec3779bc82ce7e587c75448f5b4ac4c07f..d07e5b4925317f026fbe8b9483b54eae19c7ae77 100644 (file)
@@ -67,6 +67,9 @@ struct consumer_channel_msg {
        uint64_t key;                           /* del */
 };
 
+/* Flag used to temporarily pause data consumption from testpoints. */
+int data_consumption_paused;
+
 /*
  * Flag to inform the polling thread to quit when all fd hung up. Updated by
  * the consumer_thread_receive_fds when it notices that all fds has hung up.
@@ -2530,6 +2533,9 @@ void *consumer_thread_data_poll(void *data)
                /* poll on the array of fds */
        restart:
                DBG("polling on %d fd", nb_fd + 2);
+               if (testpoint(consumerd_thread_data_poll)) {
+                       goto end;
+               }
                health_poll_entry();
                num_rdy = poll(pollfd, nb_fd + 2, -1);
                health_poll_exit();
@@ -2549,6 +2555,12 @@ void *consumer_thread_data_poll(void *data)
                        goto end;
                }
 
+               if (caa_unlikely(data_consumption_paused)) {
+                       DBG("Data consumption paused, sleeping...");
+                       sleep(1);
+                       goto restart;
+               }
+
                /*
                 * If the consumer_data_pipe triggered poll go directly to the
                 * beginning of the loop to update the array. We want to prioritize
This page took 0.023779 seconds and 4 git commands to generate.