Permalink
Browse files

Improve remote profiler handling of app going to background

Cosmetic improvements to Detox Instruments
  • Loading branch information...
LeoNatan committed Mar 24, 2018
1 parent 1c2c6bf commit 59e990842de34b374581a783e6aad3b5012b1a05
Showing with 84 additions and 12 deletions.
  1. +2 −2 DetoxInstruments/DetoxInstruments/Info.plist
  2. +2 −2 DetoxInstruments/DetoxInstruments/Main.storyboard
  3. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXAxisHeaderPlotController.m
  4. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXCPUUsagePlotController.m
  5. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXCompactNetworkRequestsPlotController.m
  6. +6 −1 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXDiskReadWritesPlotController.m
  7. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXFPSPlotController.m
  8. +2 −1 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXManagedPlotControllerGroup.m
  9. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXMemoryUsagePlotController.m
  10. +1 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXPlotController.h
  11. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXSamplePlotController.m
  12. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/DTXThreadCPUUsagePlotController.m
  13. +6 −1 DetoxInstruments/DetoxInstruments/PlotDataProviders/ReactNative/DTXRNBridgeCountersPlotController.m
  14. +5 −0 ...nstruments/DetoxInstruments/PlotDataProviders/ReactNative/DTXRNBridgeDataTransferPlotController.m
  15. +5 −0 DetoxInstruments/DetoxInstruments/PlotDataProviders/ReactNative/DTXRNCPUUsagePlotController.m
  16. +1 −1 DetoxInstruments/DetoxInstruments/UIDataProviders/DTXCPUDataProvider.m
  17. +3 −1 DetoxInstruments/DetoxInstruments/UIDataProviders/DTXFilteredDataProvider.m
  18. BIN DetoxInstruments/DetoxInstruments/dtxicon.iconset/icon_256x256@2x.png
  19. BIN DetoxInstruments/DetoxInstruments/dtxicon.iconset/icon_512x512.png
  20. BIN DetoxInstruments/DetoxInstruments/dtxicon.iconset/icon_512x512@2x.png
  21. BIN DetoxInstruments/Supplementals/DocIcon.psd
  22. +1 −1 LICENSE
  23. +2 −2 Profiler/DTXProfiler/Info.plist
  24. +13 −0 Profiler/DTXProfiler/RemoteProfiler/DTXRemoteProfilingManager.m
@@ -44,9 +44,9 @@
<key>CFBundleShortVersionString</key>
<string>0.9</string>
<key>CFBundleVersion</key>
<string>4558</string>
<string>4601</string>
<key>DTXBuildDate</key>
<date>2018-03-21T23:45:31Z</date>
<date>2018-03-24T21:16:48Z</date>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
@@ -736,8 +736,8 @@
</scroller>
</scrollView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="PVg-YW-dy8">
<rect key="frame" x="18" y="313" width="158" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Select a device to profile:" id="lPg-Uz-0wi">
<rect key="frame" x="18" y="313" width="149" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Select an app to profile:" id="lPg-Uz-0wi">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -202,6 +202,11 @@ - (NSString *)displayName
return @"";
}
- (NSString *)toolTip
{
return nil;
}
- (NSImage*)displayIcon
{
return nil;
@@ -22,6 +22,11 @@ - (NSString *)displayName
return NSLocalizedString(@"CPU Usage", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The CPU Usage instrument captures information about the profiled app's load on the CPU.", @"");
}
- (NSImage*)displayIcon
{
return [NSImage imageNamed:@"CPUActivity"];
@@ -261,6 +261,11 @@ - (NSString *)displayName
return NSLocalizedString(@"Network Activity", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The Network Activity instrument captures information about the profiled app's network activity.", @"");
}
- (NSImage*)displayIcon
{
return [NSImage imageNamed:@"networkActivity"];
@@ -19,7 +19,12 @@ + (Class)UIDataProviderClass
- (NSString *)displayName
{
return NSLocalizedString(@"Disk Usage", @"");
return NSLocalizedString(@"Disk Activity", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The Disk Activity instrument captures information about the profiled app's disk reads and writes.", @"");
}
- (NSImage*)displayIcon
@@ -21,6 +21,11 @@ - (NSString *)displayName
return NSLocalizedString(@"FPS", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The FPS instrument captures information about the frame-rate of the profiled app's user interface.", @"");
}
- (NSImage*)displayIcon
{
return [NSImage imageNamed:@"graphicsDriverUtility"];
@@ -387,11 +387,12 @@ - (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTable
DTXPlotTypeCellView* cell = [outlineView makeViewWithIdentifier:@"InfoTableViewCell" owner:nil];
cell.textField.font = controller.titleFont;
cell.textField.stringValue = controller.displayName;
cell.textField.toolTip = controller.displayName;
cell.textField.toolTip = controller.toolTip ?: controller.displayName;
cell.textField.allowsDefaultTighteningForTruncation = YES;
cell.imageView.image = controller.displayIcon;
cell.secondaryImageView.image = controller.secondaryIcon;
cell.secondaryImageView.hidden = controller.secondaryIcon == nil;
cell.toolTip = controller.toolTip ?: controller.displayName;
if(controller.legendTitles.count > 1)
{
@@ -22,6 +22,11 @@ - (NSString *)displayName
return NSLocalizedString(@"Memory Usage", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The Memory Usage instrument captures information about the profiled app's memory usage.", @"");
}
- (NSImage*)displayIcon
{
return [NSImage imageNamed:@"memoryTracker"];
@@ -32,6 +32,7 @@
@property (nonatomic, strong, readonly) NSString* displayName;
@property (nonatomic, strong, readonly) NSImage* displayIcon;
@property (nonatomic, strong, readonly) NSImage* secondaryIcon;
@property (nonatomic, strong, readonly) NSString* toolTip;
@property (nonatomic, strong, readonly) NSFont* titleFont;
@property (nonatomic, strong, readonly) NSArray<NSString*>* legendTitles;
@property (nonatomic, strong, readonly) NSArray<NSColor*>* legendColors;
@@ -660,6 +660,11 @@ - (NSString *)displayName
return @"";
}
- (NSString *)toolTip
{
return nil;
}
- (NSImage*)displayIcon
{
return nil;
@@ -35,6 +35,11 @@ - (NSString *)displayName
return _threadInfo.name.length > 0 ? _threadInfo.name : _threadInfo.number == 0 ? NSLocalizedString(@"Main Thread", @"") : [NSString stringWithFormat:NSLocalizedString(@"Thread %@", @""), @(_threadInfo.number)];
}
- (NSString *)toolTip
{
return nil;
}
- (NSFont *)titleFont
{
return [NSFont systemFontOfSize:10];
@@ -23,7 +23,12 @@ - (Class)classForPerformanceSamples
- (NSString *)displayName
{
return NSLocalizedString(@"Bridge Calls", @"");
return NSLocalizedString(@"Bridge Counters", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The Bridge Counters instrument captures information about React Native bridge calls made by the profiled app.", @"");
}
- (NSImage*)displayIcon
@@ -26,6 +26,11 @@ - (NSString *)displayName
return NSLocalizedString(@"Bridge Data", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The Bridge Data instrument captures information about React Native bridge data passed in the profiled app.", @"");
}
- (NSImage*)displayIcon
{
return [NSImage imageNamed:@"bridgeData"];
@@ -26,6 +26,11 @@ - (NSString *)displayName
return NSLocalizedString(@"JavaScript Thread", @"");
}
- (NSString *)toolTip
{
return NSLocalizedString(@"The JavaScript Thread instrument captures information about the CPU load of the profiled app's JavaScript thread.", @"");
}
- (NSImage*)displayIcon
{
return [NSImage imageNamed:@"CPUActivity"];
@@ -26,7 +26,7 @@ + (Class)inspectorDataProviderClass
[rv addObject:info];
if(self.showsHeaviestThreadColumn && [self.document.recording.managedObjectContext countForFetchRequest:[DTXAdvancedPerformanceSample fetchRequest] error:NULL])
if(self.showsHeaviestThreadColumn)
{
DTXColumnInformation* heaviestThread = [DTXColumnInformation new];
heaviestThread.title = NSLocalizedString(@"Heaviest Thread", @"");
@@ -42,7 +42,9 @@ - (void)filterSamplesWithFilter:(NSString *)filter
NSParameterAssert(self.sampleTypes.count == 1);
NSFetchRequest* fr = [NSFetchRequest new];
fr.entity = [[DTXSample classFromSampleType:self.sampleTypes.firstObject.unsignedIntegerValue] entity]; //[NSEntityDescription entityForName:@"Sample" inManagedObjectContext:_document.recording.managedObjectContext];
Class cls = [DTXSample classFromSampleType:self.sampleTypes.firstObject.unsignedIntegerValue];
NSString* entityName = [NSStringFromClass(cls) substringFromIndex:3];
fr.entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:_document.recording.managedObjectContext];
fr.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"timestamp" ascending:YES]];
_frc = [[NSFetchedResultsController alloc] initWithFetchRequest:fr managedObjectContext:_document.recording.managedObjectContext sectionNameKeyPath:nil cacheName:nil];
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 Wix.com
Copyright (c) 2017-2018 Wix.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -17,9 +17,9 @@
<key>CFBundleShortVersionString</key>
<string>0.9</string>
<key>CFBundleVersion</key>
<string>4558</string>
<string>4601</string>
<key>DTXBuildDate</key>
<date>2018-03-21T23:45:31Z</date>
<date>2018-03-24T21:16:48Z</date>
<key>NSPrincipalClass</key>
<string></string>
</dict>
@@ -82,12 +82,20 @@ - (void)_readCommandWithCompletionHandler:(void (^)(NSDictionary *cmd))completio
}];
}
- (void)_applicationDidEnterForeground
{
[_publishingService stop];
[self _resumePublishing];
}
- (instancetype)init
{
self = [super init];
if(self)
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidEnterForeground) name:UIApplicationWillEnterForegroundNotification object:nil];
_publishingService = [[NSNetService alloc] initWithDomain:@"local" type:@"_detoxprofiling._tcp" name:@"" port:0];
_publishingService.delegate = self;
[self _resumePublishing];
@@ -98,6 +106,11 @@ - (instancetype)init
- (void)_resumePublishing
{
if(_remoteProfiler != nil)
{
return;
}
dtx_log_info(@"Attempting to publish “%@” service", _publishingService.type);
[_publishingService publishWithOptions:NSNetServiceListenForConnections];
}

0 comments on commit 59e9908

Please sign in to comment.