The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/worker: Use U_TRACE_SET_THREAD_NAME

+18 -6
+11 -1
src/xrt/auxiliary/util/u_worker.c
··· 40 40 41 41 // Native thread. 42 42 struct os_thread thread; 43 + 44 + //! Thread name. 45 + char name[64]; 43 46 }; 44 47 45 48 struct pool ··· 78 81 79 82 //! Is the pool up and running? 80 83 bool running; 84 + 85 + //! Prefix to use for thread names. 86 + char prefix[32]; 81 87 }; 82 88 83 89 struct group ··· 335 341 struct thread *t = (struct thread *)ptr; 336 342 struct pool *p = t->p; 337 343 344 + snprintf(t->name, sizeof(t->name), "%s: Worker", p->prefix); 345 + U_TRACE_SET_THREAD_NAME(t->name); 346 + 338 347 os_mutex_lock(&p->mutex); 339 348 340 349 while (p->running) { ··· 387 396 */ 388 397 389 398 struct u_worker_thread_pool * 390 - u_worker_thread_pool_create(uint32_t starting_worker_count, uint32_t thread_count) 399 + u_worker_thread_pool_create(uint32_t starting_worker_count, uint32_t thread_count, const char *prefix) 391 400 { 392 401 XRT_TRACE_MARKER(); 393 402 int ret; ··· 408 417 p->worker_limit = starting_worker_count; 409 418 p->thread_count = thread_count; 410 419 p->running = true; 420 + snprintf(p->prefix, sizeof(p->prefix), "%s", prefix); 411 421 412 422 ret = os_mutex_init(&p->mutex); 413 423 if (ret != 0) {
+3 -1
src/xrt/auxiliary/util/u_worker.h
··· 42 42 * @param thread_count The number of threads to be created in total, 43 43 * this is the maximum threads that can be in 44 44 * flight at the same time. 45 + * @param prefix Prefix to used when naming threads, used for 46 + * tracing and debugging. 45 47 * 46 48 * @ingroup aux_util 47 49 */ 48 50 struct u_worker_thread_pool * 49 - u_worker_thread_pool_create(uint32_t starting_worker_count, uint32_t thread_count); 51 + u_worker_thread_pool_create(uint32_t starting_worker_count, uint32_t thread_count, const char *prefix); 50 52 51 53 /*! 52 54 * Internal function, only called by reference.
+2 -2
src/xrt/auxiliary/util/u_worker.hpp
··· 51 51 /*! 52 52 * @copydoc u_worker_thread_pool_create 53 53 */ 54 - SharedThreadPool(uint32_t starting_worker_count, uint32_t thread_count) 54 + SharedThreadPool(uint32_t starting_worker_count, uint32_t thread_count, const char *prefix) 55 55 { 56 - mPool = u_worker_thread_pool_create(starting_worker_count, thread_count); 56 + mPool = u_worker_thread_pool_create(starting_worker_count, thread_count, prefix); 57 57 } 58 58 59 59 ~SharedThreadPool()
+1 -1
src/xrt/tracking/hand/mercury/hg_sync.cpp
··· 1047 1047 hgt->views[1].view = 1; 1048 1048 1049 1049 int num_threads = 4; 1050 - hgt->pool = u_worker_thread_pool_create(num_threads - 1, num_threads); 1050 + hgt->pool = u_worker_thread_pool_create(num_threads - 1, num_threads, "Hand Tracking"); 1051 1051 hgt->group = u_worker_group_create(hgt->pool); 1052 1052 1053 1053 lm::optimizer_create(hgt->left_in_right, false, hgt->log_level, &hgt->kinematic_hands[0]);
+1 -1
tests/tests_worker.cpp
··· 20 20 21 21 TEST_CASE("TaskCollection") 22 22 { 23 - SharedThreadPool pool{2, 3}; 23 + SharedThreadPool pool{2, 3, "Test"}; 24 24 bool calledA[] = { 25 25 false, 26 26 false,