116
116
bool _json_output = false ;
117
117
NSMutableArray *_file_meta_info = nil ;
118
118
int port = 0 ; // 0 means "dynamically assigned"
119
- CFStringRef last_path = NULL ;
120
119
ServiceConnRef dbgServiceConnection = NULL ;
121
120
pid_t parent = 0 ;
122
121
// PID of child process running lldb
@@ -717,10 +716,13 @@ mach_error_t transfer_callback(CFDictionaryRef dict, int arg) {
717
716
CFNumberGetValue (CFDictionaryGetValue (dict, CFSTR (" PercentComplete" )), kCFNumberSInt32Type , &percent);
718
717
719
718
if (CFEqual (status, CFSTR (" CopyingFile" ))) {
719
+ static CFStringRef last_path = NULL ;
720
+ static int last_overall_percent = -1 ;
721
+
720
722
CFStringRef path = CFDictionaryGetValue (dict, CFSTR (" Path" ));
723
+ int overall_percent = percent / 2 ;
721
724
722
- if ((last_path == NULL || !CFEqual (path, last_path)) && !CFStringHasSuffix (path, CFSTR (" .ipa" ))) {
723
- int overall_percent = percent / 2 ;
725
+ if ((last_path == NULL || !CFEqual (path, last_path) || last_overall_percent != overall_percent) && !CFStringHasSuffix (path, CFSTR (" .ipa" ))) {
724
726
NSLogOut (@" [%3d%% ] Copying %@ to device" , overall_percent, path);
725
727
NSLogJSON (@{@" Event" : @" BundleCopy" ,
726
728
@" OverallPercent" : @(overall_percent),
@@ -729,6 +731,8 @@ mach_error_t transfer_callback(CFDictionaryRef dict, int arg) {
729
731
});
730
732
}
731
733
734
+ last_overall_percent = overall_percent;
735
+
732
736
if (last_path != NULL ) {
733
737
CFRelease (last_path);
734
738
}
0 commit comments