Objective c CPU使用AttributesFiteMatPath引发:错误:

Objective c CPU使用AttributesFiteMatPath引发:错误:,objective-c,macos,cocoa,nsfilemanager,sysenter,Objective C,Macos,Cocoa,Nsfilemanager,Sysenter,我正在使用[NSFileManager attributesOfItemAtPath:error:函数获取文件的属性。 但有时我的应用程序cpu会达到100%。我正在对100k(约)个文件使用此功能。 我的申请样本: 2128 -[NSFileManager attributesOfItemAtPath:error:] 2128 +[NSFileAttributes

我正在使用
[NSFileManager attributesOfItemAtPath:error:
函数获取文件的属性。 但有时我的应用程序cpu会达到100%。我正在对100k(约)个文件使用此功能。
我的申请样本:

                                2128 -[NSFileManager attributesOfItemAtPath:error:]
                                  2128 +[NSFileAttributes _attributesAtPath:partialReturn:filterResourceFork:error:]
                                    2123 _attributesAtPath
                                      2072 listxattr
                                      29 realloc
                                        18 realloc
                                        11 szone_size
                                      22 _attributesAtPath
                                    5 _sysenter_trap  
谁能帮帮我吗?

  • SYSENTER
    SYSEXIT
    的配套指令。陷阱是线程完整上下文的子集。因此,陷阱框架保留有关当前线程上下文的信息,以便可以使用SYSEXIT指令还原它
链接关于

看来您正在重载主线程。这就是为什么Cpu是100%

  • SYSENTER
    SYSEXIT
    的配套指令。陷阱是线程完整上下文的子集。因此,陷阱框架保留有关当前线程上下文的信息,以便可以使用SYSEXIT指令还原它
链接关于


看来您正在重载主线程。这就是为什么Cpu是100%

我使用的是
stat

#import <sys/stat.h>

struct stat stat1;
if( stat([inFilePath fileSystemRepresentation], &stat1) )
      // something is wrong 
long long size = stat1.st_size;
printf("Size: %lld\n", stat1.st_size);
#导入
结构stat stat1;
if(stat([inFilePath fileSystemRepresentation],&stat1))
//有点不对劲
长尺寸=stat1.st_尺寸;
printf(“大小:%lld\n”,stat1.st\u大小);

我正在使用
stat

#import <sys/stat.h>

struct stat stat1;
if( stat([inFilePath fileSystemRepresentation], &stat1) )
      // something is wrong 
long long size = stat1.st_size;
printf("Size: %lld\n", stat1.st_size);
#导入
结构stat stat1;
if(stat([inFilePath fileSystemRepresentation],&stat1))
//有点不对劲
长尺寸=stat1.st_尺寸;
printf(“大小:%lld\n”,stat1.st\u大小);

因此陷阱框架正在保存我的主线程状态。我应该在辅助线程上运行该函数吗?是。。这是您所能做的最好的(并尝试将包中的100k文件分开…如果发送了100个文件..再发送100个文件..这将减少设备资源的使用),因此trap frame正在保存我的主线程状态。我应该在辅助线程上运行该函数吗?是。。这是您所能做的最好的(并尝试将包中的100k文件分开…如果发送了100个文件..再发送100个文件..这将减少设备资源的使用)