diff --git a/TraceUtility/InstrumentsPrivateHeader.h b/TraceUtility/InstrumentsPrivateHeader.h index 7a6e6e9..9fbac3e 100644 --- a/TraceUtility/InstrumentsPrivateHeader.h +++ b/TraceUtility/InstrumentsPrivateHeader.h @@ -253,6 +253,24 @@ BOOL XRAnalysisCoreReadCursorGetValue(XRAnalysisCoreReadCursor *cursor, UInt8 co - (NSArray *)_permittedContexts; @end +@interface XRVMInstrument : XRInstrument +- (BOOL)_refreshDataSources; +@end + +@interface XRVMRegion : NSObject +- (NSString *)displayType; +- (unsigned long long)pageSize; +- (unsigned long long)swappedSize; +- (unsigned long long)dirtySize; +- (unsigned long long)residentSize; +- (unsigned int)virtualPages; +- (unsigned long long)virtualSize; +- (unsigned long long)location; +@end + +@interface XRVMCoalescedRegion : XRVMRegion +@end + @interface XRRawBacktrace : NSObject @end diff --git a/TraceUtility/main.m b/TraceUtility/main.m index d25b410..58f333d 100644 --- a/TraceUtility/main.m +++ b/TraceUtility/main.m @@ -188,8 +188,22 @@ int main(int argc, const char * argv[]) { } }]; }]; + } if ([instrumentID isEqualToString:@"com.apple.xray.instrument-type.vmtrack"]) { + XRVMInstrument *vm = (XRVMInstrument *)instrument; + [vm _refreshDataSources]; + NSArray *displayArray = [vm valueForKey:@"_displayArray"]; + if (displayArray && displayArray.count > 0) { + TUPrint(@"Type Resident(byte) Dirty(byte) Swapped(byte) Virtual(byte) \n"); + } + [displayArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if ( [obj isKindOfClass:XRVMCoalescedRegion.class] ) { + XRVMCoalescedRegion *region = (XRVMCoalescedRegion *)obj; + TUPrint(@"\"%@\" %@ %@ %@ %@ \n", region.displayType ? region.displayType : [region valueForKey:@"_groupName"], + @(region.residentSize), @(region.dirtySize), @(region.swappedSize), @(region.virtualSize)); + } + }]; } else { - TUPrint(@"Data processor has not been implemented for this type of instrument.\n"); + TUPrint(@"Data processor has not been implemented for(%@) this type of instrument.\n", instrumentID); } // Common routine to cleanup after done.