Authored by John Tai

修改统计SDWebImage图片下载时间.reviewed by yuliang

... ... @@ -21,7 +21,7 @@ NSArray* cityList;
- (void)viewDidLoad {
[super viewDidLoad];
[self configureTableView];
[self configureTableView];
}
- (void)didReceiveMemoryWarning {
... ...
... ... @@ -277,33 +277,34 @@
}
#pragma mark - UIImageView download performance
- (void)timeEventStartWithWebImageDownload:(SDWebImageManager *)downloaderOperation
- (void)timeEventStartWithWebImageDownloadURL:(NSString *)imageURL
{
NSNumber *startTime = @([[NSDate date] timeIntervalSince1970]);
NSString *yh_webImageId = [NSString stringWithFormat:@"%@",startTime];
if (startTime==0||IsStrEmpty(yh_webImageId)) {
if (startTime==0||IsStrEmpty(imageURL)) {
return;
}
downloaderOperation.yh_webImageId=yh_webImageId;
dispatch_async(self.serialQueue, ^{
self.timedEvents[yh_webImageId] = startTime;
self.timedEvents[imageURL] = startTime;
});
}
- (void)timeEventEndWithWebImageDownload:(SDWebImageManager *)downloaderOperation url:(NSString*)url status:(YHEventLoadStatus)status
- (void)timeEventEndWithWebImageDownloadURL:(NSString*)imageURL status:(YHEventLoadStatus)status
{
NSTimeInterval elapsedTime = [self eventElapsedTime:downloaderOperation.yh_webImageId];
if (elapsedTime==0) {
if (IsStrEmpty(imageURL)) {
return;
}
if (!IsStrEmpty(downloaderOperation.yh_webImageId)) {
dispatch_async(self.serialQueue, ^{
[self.timedEvents removeObjectForKey:downloaderOperation.yh_webImageId];
});
NSTimeInterval elapsedTime = [self eventElapsedTime:imageURL];
if (elapsedTime==0) {
return;
}
NSDictionary *param = [YH_EventDataFactory factoryTimeEventDataWithSDWebImageDownloader:downloaderOperation ElapsedTime:elapsedTime status:status url:url];
if (param && status == YHEventLoadStatusSuc) {
dispatch_async(self.serialQueue, ^{
[self.timedEvents removeObjectForKey:imageURL];
});
NSDictionary *param = [YH_EventDataFactory factoryTimeEventDataWithElapsedTime:elapsedTime status:status url:imageURL];
if (param && status == YHEventLoadStatusSuc) {
[[YH_EventCacheManager sharedInstance] pushPerformanceData:param pointName:YHPN_IMAGEVIEW];
}
}
... ...
... ... @@ -17,7 +17,7 @@
+(NSDictionary *)factoryTimeEventDataWithWebView:(UIWebView *)webView ElapsedTime:(NSTimeInterval)elapsedTime status:(YHEventLoadStatus)status;;
+(NSDictionary *)factoryTimeEventDataWithSDWebImageDownloader:(SDWebImageManager *)downloaderOperation ElapsedTime:(NSTimeInterval)elapsedTime status:(YHEventLoadStatus)status url:(NSString*)url;
+(NSDictionary *)factoryTimeEventDataWithElapsedTime:(NSTimeInterval)elapsedTime status:(YHEventLoadStatus)status url:(NSString*)url;
+(NSDictionary *)factoryTimeEventDataWithUIControl:(UIControl *)control ElapsedTime:(NSTimeInterval)elapsedTime;
... ...
... ... @@ -41,7 +41,7 @@
return dict;
}
+(NSDictionary *)factoryTimeEventDataWithSDWebImageDownloader:(SDWebImageManager *)downloaderOperation ElapsedTime:(NSTimeInterval)elapsedTime status:(YHEventLoadStatus)status url:(NSString*)url
+(NSDictionary *)factoryTimeEventDataWithElapsedTime:(NSTimeInterval)elapsedTime status:(YHEventLoadStatus)status url:(NSString*)url
{
NSString *currentUrl = [[NSString alloc]initWithString:url];
if (IsStrEmpty(currentUrl)) {
... ...