Ios 如何读取Xcode 6.1 Instruments.trace文件?
我一直在尝试读取一个Ios 如何读取Xcode 6.1 Instruments.trace文件?,ios,objective-c,xcode,swift,instruments,Ios,Objective C,Xcode,Swift,Instruments,我一直在尝试读取一个.trace文件,该文件是我使用自定义工具模板(工具:Automator、Allocations、Leaks)生成的 这是我找到的最好的帮助。基本上,创建了一个定制的Objective-C程序(),用于读取特定类型的苹果.trace文件(仪器:OpenGL ES驱动程序)。他的答案是针对XCode 4.6的 这段代码仍然适用于XCode 6.1,但跟踪文件似乎有轻微的变化。您必须在.trace包中找到*.run.zip文件并将其解压缩。在提取的文件夹中,您现在必须找到*。运行
.trace
文件,该文件是我使用自定义工具模板(工具:Automator、Allocations、Leaks)生成的
这是我找到的最好的帮助。基本上,创建了一个定制的Objective-C程序(),用于读取特定类型的苹果.trace
文件(仪器:OpenGL ES驱动程序)。他的答案是针对XCode 4.6的
这段代码仍然适用于XCode 6.1,但跟踪文件似乎有轻微的变化。您必须在.trace
包中找到*.run.zip
文件并将其解压缩。在提取的文件夹中,您现在必须找到*。运行文件。.trace
包中有几个*.run.zip
文件;每个使用过的仪器一个
只需运行该程序,我就得到了一个未捕获的异常“nsarchiverarchiveinconconsistency”,原因:“***类错误为'XRObjectAllocRun'
-错误
这个错误最初很容易理解。我所要做的就是实现缺少的类XRObjectAllocRun
;与中的示例XRRun
或XRVideoCardRun
类并行
这是我走了多远和被困的地方:
#import "XRObjectAllocRun.h"
@implementation XRObjectAllocRun
- (id)initWithCoder:(NSCoder *)decoder
{
if((self = [super init]))
{
NSObject *a = [decoder decodeObject];
NSObject *b = [decoder decodeObject];
NSObject *c = [decoder decodeObject];
NSObject *d = [decoder decodeObject];
NSObject *e = [decoder decodeObject];
NSObject *f = [decoder decodeObject];
NSObject *g = [decoder decodeObject];
NSObject *h = [decoder decodeObject];
NSObject *i = [decoder decodeObject];
// NSObject *j = [decoder decodeObject];
// NSObject *k = [decoder decodeObject];
NSLog(@"test");
}
return self;
}
@end
基本上,我被困在XRObjectAllocRun
类的逆向工程中。但无论我解码多少个或很少的对象,我总是会收到以下异常:uncaught异常'nsarchiverarchiveinconconsistency',原因:'***nsunachiver:object 0x100112750的写入和读取数据不一致'
如果取消对最后两个decode
语句的注释,程序将因以下异常而崩溃:uncaught异常“NSArchiverArchiveInconsistency”,原因:“***文件不一致:读取“i”,应为“@”
有人知道苹果XRObjectAllocRun类的签名吗?此类用于分配工具
任何帮助都会很好
更新
我使用了Swift并翻译了整个*。trace
-reader-它失败时出现了完全相同的错误:
这是XRObjectAllocRun
类的签名
#import "XRRun.h"
#import "SymbolAwareRun.h"
#import "XRCallTreeDataSource.h"
#import "XRSourceQuery.h"
@class NSMutableArray, NSMutableDictionary, NSString, XRHeapGeneration, XROAEventSummary, XRObjectAllocRunSharedData;
@interface XRObjectAllocRun : XRRun <SymbolAwareRun, XRSourceQuery, XRCallTreeDataSource>
{
XRObjectAllocRunSharedData *_sharedData;
NSMutableArray *_allStats;
NSMutableDictionary *_statsForCategory;
NSMutableDictionary *_categoryIDForName;
XROAEventSummary *_scaleStats;
NSMutableArray *_generations;
struct XRTimeRange _filterTimeRange;
unsigned int _filterMinEventID;
unsigned int _filterMaxEventID;
unsigned long long _nextGenNumber;
NSMutableDictionary *_samplesByCategoryNumber;
unsigned long long _catNumIndex;
struct XRTimeRange _currentStatsFilterRange;
int _lifecycleFilter;
int _allocationTypeFilter;
unsigned int *_quickEventCacheIds;
id *_quickEventCache;
XRHeapGeneration *_activeGeneration;
}
+ (void)initialize;
- (id)operation:(id)arg1 commentsForSymbol:(id)arg2 inSourceManager:(id)arg3 callTreeInformation:(id)arg4;
- (id)provideCategories;
- (id)backtracesForCategory:(id)arg1 timeRange:(struct XRTimeRange)arg2 savedIndex:(unsigned long long *)arg3;
- (void)_configureCallTreeForAllocationType:(int)arg1;
- (id)symbolsForEvent:(id)arg1 reverseOrder:(BOOL)arg2;
- (id)backtraceRepository;
- (BOOL)eventIsLiveInCurrentTimeRange:(id)arg1;
- (unsigned int)uncategorizedCount;
- (unsigned int)countOfObjectEventsForCategory:(unsigned int)arg1;
- (void)enumerateObjectEventsForCategory:(unsigned int)arg1 skipToIndex:(unsigned int)arg2 withBlock:(CDUnknownBlockType)arg3;
- (BOOL)_applyLifecycleFilterToEvent:(id)arg1;
- (id)zombieEvent;
- (id)eventForIdentifier:(unsigned int)arg1;
- (BOOL)loadDTPerformanceSessionDataFromPaths:(id)arg1 error:(id *)arg2;
- (void)updateGenerations;
- (void)deleteGeneration:(id)arg1;
- (void)moveGeneration:(id)arg1 toTime:(unsigned long long)arg2;
- (void)setActiveGeneration:(id)arg1;
- (id)generationAtTime:(unsigned long long)arg1;
- (id)generations;
- (id)nextGenerationIdentifier;
- (void)createGenerationAtTime:(unsigned long long)arg1;
- (void)removeFlag:(id)arg1;
- (struct XRTimeRange)_displayTimeFilter;
- (BOOL)_isTimeScoped;
- (BOOL)useTypeFilteringRules:(id)arg1;
- (void)setAllocationTypeFilter:(int)arg1;
- (void)setLifecycleFilter:(int)arg1;
- (struct XRTimeRange)selectedTimeRange;
- (void)setSelectedTimeRange:(struct XRTimeRange)arg1;
- (id)categoryNameForIdentifier:(unsigned int)arg1;
- (id)globalStats;
- (id)scalingStats;
- (void)_clearStats;
- (void)allowEventReuse;
- (void)refreshStatsForActiveTimeFilter;
- (void)_updateStatsWithEventIdentifier:(unsigned int)arg1 category:(unsigned int)arg2 type:(unsigned int)arg3 size:(int)arg4 pastEvent:(unsigned int)arg5 summaryMap:(id *)arg6 maxCat:(unsigned int)arg7;
- (id)_statsObjectForCategoryID:(unsigned int)arg1;
- (void)_changeStatsByTimestampRange:(struct XRTimeRange)arg1 overallRange:(struct XRTimeRange)arg2 startID:(unsigned int)arg3 endID:(unsigned int)arg4;
- (id *)_createCategorySummaryMapWithMaximum:(unsigned int)arg1;
- (void)_validateGlobalStatsForTimeRange:(struct XRTimeRange)arg1;
- (void)_recomputeGlobalStats;
- (BOOL)discardsLifeCycleComplete;
- (unsigned long long)lastTimestamp;
- (id)sharedData;
- (void)setRecordMode:(int)arg1;
- (void)setDiscardsLifeCycleComplete:(BOOL)arg1;
- (void)setTargetDevice:(id)arg1 pid:(int)arg2 repository:(id)arg3;
- (id)initWithCoder:(id)arg1;
- (void)encodeWithCoder:(id)arg1;
- (void)dealloc;
- (id)init;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
#导入“XRRun.h”
#导入“symbolawarun.h”
#导入“XRCallTreeDataSource.h”
#导入“XRSourceQuery.h”
@类NSMutableArray、NSMutableDictionary、NSString、XRHeapGeneration、XROAEventSummary、XRObjectAllocRunSharedData;
@接口XRObjectAllocRun:XRRun
{
XRObjectAllocRunSharedData*_sharedData;
NSMUTABLEARRY*_allStats;
NSMutableDictionary*_statsForCategory;
NSMutableDictionary*_categoryIDForName;
XROAEventSummary*_scaleStats;
NSMutableArray*\u代;
结构XRTimeRange _filterTimeRange;
无符号整数filterMinEventID;
无符号整数filterMaxEventID;
无符号长-长-下一个数字;
NSMutableDictionary*_samplesByCategoryNumber;
未签名的long long_catNumIndex;
结构XRTimeRange\u currentStatsFilterRange;
int_生命周期过滤器;
int_分配类型过滤器;
无符号int*\u QuickEventCacheId;
id*\u quickEventCache;
XRHeapGeneration*\u activeGeneration;
}
+(作废)初始化;
-(id)操作:(id)arg1 commentsForSymbol:(id)arg2 inSourceManager:(id)arg3 callTreeInformation:(id)arg4;
-(id)供应分类;
-(id)backtracesForCategory:(id)arg1 timeRange:(struct XRTimeRange)arg2 savedIndex:(unsigned long*)arg3;
-(void)_configureCallTreeforLocationType:(int)arg1;
-(id)symbolForEvent:(id)arg1反向顺序:(BOOL)arg2;
-(id)反向追踪存储;
-(BOOL)eventiliveIncirentTimeRange:(id)arg1;
-(无符号整数)未分类计数;
-(unsigned int)对象事件计数类别:(unsigned int)arg1;
-(void)enumerateObjectEventsForCategory:(unsigned int)arg1 skipToIndex:(unsigned int)arg2 with block:(CDUnknownBlockType)arg3;
-(BOOL)\u applyLifecycleFilterToEvent:(id)arg1;
-(id)僵尸事件;
-(id)eventForIdentifier:(unsigned int)arg1;
-(BOOL)loadDTPerformanceSessionDatafromPath:(id)arg1错误:(id*)arg2;
-(作废)更新版本;
-(void)deleteGeneration:(id)arg1;
-(void)moveGeneration:(id)arg1 toTime:(unsigned long long)arg2;
-(void)setActiveGeneration:(id)arg1;
-(id)生成时间:(无符号长)arg1;
-(d)世代;
-(id)下一代标识符;
-(void)createGenerationAtTime:(无符号长)arg1;
-(void)removeFlag:(id)arg1;
-(struct XRTimeRange)\u显示时间过滤器;
-(BOOL)(未经检查);
-(BOOL)useTypeFilteringRules:(id)arg1;
-(void)setAllocationTypeFilter:(int)arg1;
-(void)setLifecycleFilter:(int)arg1;
-(struct XRTimeRange)选择的时间范围;
-(void)setSelectedTimeRange:(结构XRTimeRange)arg1;
-(id)categoryNameForIdentifier:(无符号整数)arg1;
-(id)全球统计局;
-(id)缩放状态;
-(无效)\ u清除状态;
-(空)允许腹侧;
-(void)RefreshStatsforActivityMeFilter;
-(void)_updateStatsWithEventIdentifier:(unsigned int)arg1 category:(unsigned int)arg2 type:(unsigned int)arg3 size:(int)arg4 pastEvent:(unsigned int)arg5 summaryMap:(id*)arg6 maxCat:(unsigned int)arg7;
-(id)_statsObjectForCategoryID:(无符号整数)arg1;
-(void)u changestStatsByTimeStampRange:(struct XRTimeRange)arg1全局范围:(struct XRTimeRange)arg2 startID:(unsigned int)arg3 endID:(unsigned int)arg4;
-(id*)_createCategorySummaryMapWithMaximum:(unsigned int)arg1;
-(void)_validateGlobalStatsForTimeRange:(struct XRTimeRange)arg1;
-(无效)_重新计算全局状态;
-(BOOL)丢弃完整的循环;
-(unsigned long long)lastTimestamp;
-(id)共享数据;
-(void)setRecordMode:(int)arg1;
-(void)setDiscardsLifeCycleComplete:(BOOL)arg1;
-(void)setTargetDevice:(id)arg1 pid:(int)arg2存储库:(id)arg3;
-(id)initWithCoder:(id)arg1;
-(void)encodeWithCoder:(id)arg1;
-(无效)解除锁定;
-(id)init;
//剩余财产
@属性(只读,复制)NSString*debugDescription;
@属性(只读,复制)NSString*说明;
@属性(只读)无符号长哈希;
@
#import "XRRun.h"
#import "SymbolAwareRun.h"
#import "XRCallTreeDataSource.h"
#import "XRSourceQuery.h"
@class NSMutableArray, NSMutableDictionary, NSString, XRHeapGeneration, XROAEventSummary, XRObjectAllocRunSharedData;
@interface XRObjectAllocRun : XRRun <SymbolAwareRun, XRSourceQuery, XRCallTreeDataSource>
{
XRObjectAllocRunSharedData *_sharedData;
NSMutableArray *_allStats;
NSMutableDictionary *_statsForCategory;
NSMutableDictionary *_categoryIDForName;
XROAEventSummary *_scaleStats;
NSMutableArray *_generations;
struct XRTimeRange _filterTimeRange;
unsigned int _filterMinEventID;
unsigned int _filterMaxEventID;
unsigned long long _nextGenNumber;
NSMutableDictionary *_samplesByCategoryNumber;
unsigned long long _catNumIndex;
struct XRTimeRange _currentStatsFilterRange;
int _lifecycleFilter;
int _allocationTypeFilter;
unsigned int *_quickEventCacheIds;
id *_quickEventCache;
XRHeapGeneration *_activeGeneration;
}
+ (void)initialize;
- (id)operation:(id)arg1 commentsForSymbol:(id)arg2 inSourceManager:(id)arg3 callTreeInformation:(id)arg4;
- (id)provideCategories;
- (id)backtracesForCategory:(id)arg1 timeRange:(struct XRTimeRange)arg2 savedIndex:(unsigned long long *)arg3;
- (void)_configureCallTreeForAllocationType:(int)arg1;
- (id)symbolsForEvent:(id)arg1 reverseOrder:(BOOL)arg2;
- (id)backtraceRepository;
- (BOOL)eventIsLiveInCurrentTimeRange:(id)arg1;
- (unsigned int)uncategorizedCount;
- (unsigned int)countOfObjectEventsForCategory:(unsigned int)arg1;
- (void)enumerateObjectEventsForCategory:(unsigned int)arg1 skipToIndex:(unsigned int)arg2 withBlock:(CDUnknownBlockType)arg3;
- (BOOL)_applyLifecycleFilterToEvent:(id)arg1;
- (id)zombieEvent;
- (id)eventForIdentifier:(unsigned int)arg1;
- (BOOL)loadDTPerformanceSessionDataFromPaths:(id)arg1 error:(id *)arg2;
- (void)updateGenerations;
- (void)deleteGeneration:(id)arg1;
- (void)moveGeneration:(id)arg1 toTime:(unsigned long long)arg2;
- (void)setActiveGeneration:(id)arg1;
- (id)generationAtTime:(unsigned long long)arg1;
- (id)generations;
- (id)nextGenerationIdentifier;
- (void)createGenerationAtTime:(unsigned long long)arg1;
- (void)removeFlag:(id)arg1;
- (struct XRTimeRange)_displayTimeFilter;
- (BOOL)_isTimeScoped;
- (BOOL)useTypeFilteringRules:(id)arg1;
- (void)setAllocationTypeFilter:(int)arg1;
- (void)setLifecycleFilter:(int)arg1;
- (struct XRTimeRange)selectedTimeRange;
- (void)setSelectedTimeRange:(struct XRTimeRange)arg1;
- (id)categoryNameForIdentifier:(unsigned int)arg1;
- (id)globalStats;
- (id)scalingStats;
- (void)_clearStats;
- (void)allowEventReuse;
- (void)refreshStatsForActiveTimeFilter;
- (void)_updateStatsWithEventIdentifier:(unsigned int)arg1 category:(unsigned int)arg2 type:(unsigned int)arg3 size:(int)arg4 pastEvent:(unsigned int)arg5 summaryMap:(id *)arg6 maxCat:(unsigned int)arg7;
- (id)_statsObjectForCategoryID:(unsigned int)arg1;
- (void)_changeStatsByTimestampRange:(struct XRTimeRange)arg1 overallRange:(struct XRTimeRange)arg2 startID:(unsigned int)arg3 endID:(unsigned int)arg4;
- (id *)_createCategorySummaryMapWithMaximum:(unsigned int)arg1;
- (void)_validateGlobalStatsForTimeRange:(struct XRTimeRange)arg1;
- (void)_recomputeGlobalStats;
- (BOOL)discardsLifeCycleComplete;
- (unsigned long long)lastTimestamp;
- (id)sharedData;
- (void)setRecordMode:(int)arg1;
- (void)setDiscardsLifeCycleComplete:(BOOL)arg1;
- (void)setTargetDevice:(id)arg1 pid:(int)arg2 repository:(id)arg3;
- (id)initWithCoder:(id)arg1;
- (void)encodeWithCoder:(id)arg1;
- (void)dealloc;
- (id)init;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end