Как металл создает рабочие нити? - PullRequest
0 голосов
/ 08 января 2020

Когда я использую Metal API для рендеринга в моей программе, я вижу несколько рабочих потоков в Time Profiler:

8.00 ms   15.0% 0 s      _dispatch_worker_thread2  0xcf325
8.00 ms   15.0% 0 s       start_wqthread
8.00 ms   15.0% 0 s        _pthread_wqthread
7.00 ms   13.2% 0 s         _dispatch_workloop_worker_thread
6.00 ms   11.3% 0 s          _dispatch_lane_invoke
6.00 ms   11.3% 0 s           _dispatch_lane_serial_drain
6.00 ms   11.3% 0 s            _dispatch_source_invoke
6.00 ms   11.3% 0 s             _dispatch_continuation_pop
6.00 ms   11.3% 0 s              _dispatch_client_callout
5.00 ms    9.4% 0 s               -[_MTLCommandQueue _submitAvailableCommandBuffers]
1.00 ms    1.8% 0 s               dispatch_mig_server
1.00 ms    1.8% 0 s          _dispatch_event_loop_merge
1.00 ms    1.8% 0 s         _dispatch_kevent_worker_thread
6.00 ms   11.3% 0 s      _dispatch_workloop_worker_thread  0xcf31d
6.00 ms   11.3% 0 s       start_wqthread
6.00 ms   11.3% 0 s        _pthread_wqthread
6.00 ms   11.3% 1.00 ms         _dispatch_workloop_worker_thread
5.00 ms    9.4% 0 s          _dispatch_lane_invoke
5.00 ms    9.4% 0 s           _dispatch_lane_serial_drain
5.00 ms    9.4% 0 s            _dispatch_source_invoke
5.00 ms    9.4% 0 s             _dispatch_continuation_pop
5.00 ms    9.4% 0 s              _dispatch_client_callout
4.00 ms    7.5% 0 s               -[_MTLCommandQueue _submitAvailableCommandBuffers]
1.00 ms    1.8% 0 s               invocation function for block in CA::Context::client_port()
6.00 ms   11.3% 0 s      _dispatch_workloop_worker_thread  0xcf31c
6.00 ms   11.3% 0 s       start_wqthread
6.00 ms   11.3% 0 s        _pthread_wqthread
6.00 ms   11.3% 1.00 ms         _dispatch_workloop_worker_thread
5.00 ms    9.4% 0 s          _dispatch_lane_invoke
5.00 ms    9.4% 0 s           _dispatch_lane_serial_drain
5.00 ms    9.4% 0 s            _dispatch_source_invoke
5.00 ms    9.4% 0 s             _dispatch_continuation_pop
5.00 ms    9.4% 0 s              _dispatch_client_callout
3.00 ms    5.6% 0 s               -[_MTLCommandQueue _submitAvailableCommandBuffers]
2.00 ms    3.7% 0 s               dispatch_mig_server

Можно ли узнать, почему Metal создает несколько рабочих потоков?

...