Created
November 29, 2017 08:59
-
-
Save K-Kevin/22ff29b808141ab36e6b7dd89388f4c9 to your computer and use it in GitHub Desktop.
iOS 知识点
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##dispatch_benchmark-Monkey | |
GCD 之 dispatch_benchmark 测量指定代码块执行时间 | |
#import <Foundation/Foundation.h> | |
// 声明GCD中dispatch_benchmark函数原型 | |
extern uint64_t dispatch_benchmark(size_t count, void (^block)(void)); | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
// insert code here... | |
NSLog(@"Hello, World!"); | |
uint64_t n = dispatch_benchmark(100, ^{ | |
NSLog(@"hello"); | |
}); | |
NSLog(@"Block 耗时多少纳秒 : %llu",n); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment