11/*
2- * Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3- * (C) 2024 Vladimir Sadovnikov <[email protected] > 2+ * Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3+ * (C) 2025 Vladimir Sadovnikov <[email protected] > 44 *
55 * This file is part of lsp-runtime-lib
66 * Created on: 27 янв. 2016 г.
@@ -26,6 +26,8 @@ namespace lsp
2626{
2727 namespace ipc
2828 {
29+ static constexpr size_t POLL_INTERVAL = 20 ;
30+
2931 NativeExecutor::NativeExecutor ():
3032 hThread (execute, this )
3133 {
@@ -88,7 +90,7 @@ namespace lsp
8890 atomic_unlock (nLock);
8991 }
9092
91- ipc::Thread::sleep (100 );
93+ ipc::Thread::sleep (POLL_INTERVAL );
9294 }
9395
9496 // Now there are no pending tasks, terminate thread
@@ -105,7 +107,7 @@ namespace lsp
105107 // Sleep until critical section is acquired
106108 while (!atomic_trylock (nLock))
107109 {
108- if (ipc::Thread::sleep (100 ) == STATUS_CANCELLED)
110+ if (ipc::Thread::sleep (POLL_INTERVAL ) == STATUS_CANCELLED)
109111 return ;
110112 }
111113
@@ -117,7 +119,7 @@ namespace lsp
117119 atomic_unlock (nLock);
118120
119121 // Wait for a while
120- if (ipc::Thread::sleep (100 ) == STATUS_CANCELLED)
122+ if (ipc::Thread::sleep (POLL_INTERVAL ) == STATUS_CANCELLED)
121123 return ;
122124 }
123125 else
@@ -132,8 +134,13 @@ namespace lsp
132134
133135 // Execute task
134136 lsp_trace (" executing task %p" , task);
137+ const system::time_millis_t start = system::get_time_millis ();
138+
135139 run_task (task);
136- lsp_trace (" executed task %p with code %d" , task, int (task->code ()));
140+
141+ const system::time_millis_t end = system::get_time_millis ();
142+ lsp_trace (" executed task %p with code %d, time=%d ms" ,
143+ task, int (task->code ()), int (end - start));
137144 }
138145 }
139146 }
0 commit comments