王刚韧 23:19:26
测试一段代码的运行时间
测试一段代码运行花了多久:
NSDate* tmpStartData = [NSDate date] ;
<#代码#>
double deltaTime = [[NSDate date] timeIntervalSinceDate:tmpStartData];
NSLog(@"------cost time = %f ms(毫秒)", deltaTime*1000);
时间: 2024-10-06 00:25:38
王刚韧 23:19:26
测试一段代码的运行时间
测试一段代码运行花了多久:
NSDate* tmpStartData = [NSDate date] ;
<#代码#>
double deltaTime = [[NSDate date] timeIntervalSinceDate:tmpStartData];
NSLog(@"------cost time = %f ms(毫秒)", deltaTime*1000);