How do I detect a dual core CPU on iOS?

前端 未结 6 513
臣服心动
臣服心动 2020-12-08 14:48

My app uses an NSOperationQueue to cache thumbnail images in a background thread. On the iPad2 I can push the concurrent task count limit up to 5 or 6, but on s

6条回答
  •  粉色の甜心
    2020-12-08 15:17

    In Swift you can detect / print the number of active processors with the following code:

    let processInfo = ProcessInfo()
    print(processInfo.activeProcessorCount)
    

    This code does not need any extra header files or frameworks and works completely natively.

提交回复
热议问题