...
|
...
|
@@ -308,8 +308,7 @@ |
|
|
- (void)handleMemoryWarning
|
|
|
{
|
|
|
if (self.mode == YHEventReportStrategyInterval) {
|
|
|
@synchronized (self) {
|
|
|
//[self.eventCacheArray removeAllObjects];
|
|
|
@synchronized (self.performanceCacheArray) {
|
|
|
[self.performanceCacheArray removeAllObjects];
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -317,26 +316,14 @@ |
|
|
- (void)handleDidFinishLaunch
|
|
|
{
|
|
|
if (self.mode == YHEventReportStrategyInterval) {
|
|
|
@synchronized (self.performanceCacheArray) {
|
|
|
NSMutableArray *data = [[NSMutableArray alloc]initWithCapacity:0];
|
|
|
[data setArray:self.performanceCacheArray];
|
|
|
[self.performanceCacheArray removeAllObjects];
|
|
|
[self.eventDataSession uploadPerformanceData:[self getPerformanceFormatData:data type:YHEventReportTrackDataTypeStart] tag:nil result:^(BOOL isSuc, id tag, NSError *error) {
|
|
|
}];
|
|
|
}
|
|
|
[self uploadPerformanceDataWithType:YHEventReportTrackDataTypeStart];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- (void)handleTerminate
|
|
|
{
|
|
|
if (self.mode == YHEventReportStrategyInterval) {
|
|
|
@synchronized (self.performanceCacheArray) {
|
|
|
NSMutableArray *data = [[NSMutableArray alloc]initWithCapacity:0];
|
|
|
[data setArray:self.performanceCacheArray];
|
|
|
[self.performanceCacheArray removeAllObjects];
|
|
|
[self.eventDataSession uploadPerformanceData:[self getPerformanceFormatData:data type:YHEventReportTrackDataTypeDestory] tag:nil result:^(BOOL isSuc, id tag, NSError *error) {
|
|
|
}];
|
|
|
}
|
|
|
[self uploadPerformanceDataWithType:YHEventReportTrackDataTypeDestory];
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -344,28 +331,27 @@ |
|
|
{
|
|
|
[self.performanceAppInfo resetSessionID];
|
|
|
if (self.mode == YHEventReportStrategyInterval) {
|
|
|
@synchronized (self.performanceCacheArray) {
|
|
|
NSMutableArray *data = [[NSMutableArray alloc]initWithCapacity:0];
|
|
|
[data setArray:self.performanceCacheArray];
|
|
|
[self.performanceCacheArray removeAllObjects];
|
|
|
[self.eventDataSession uploadPerformanceData:[self getPerformanceFormatData:data type:YHEventReportTrackDataTypeStop] tag:nil result:^(BOOL isSuc, id tag, NSError *error) {
|
|
|
}];
|
|
|
}
|
|
|
[self uploadPerformanceDataWithType:YHEventReportTrackDataTypeStop];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#pragma mark - timer
|
|
|
- (void)timerAction
|
|
|
{
|
|
|
[self uploadPerformanceDataWithType:YHEventReportTrackDataTypeHeartbeat];
|
|
|
}
|
|
|
|
|
|
#pragma mark - upload performance data
|
|
|
-(void)uploadPerformanceDataWithType:(YHEventReportTrackDataType)type{
|
|
|
@synchronized (self.performanceCacheArray) {
|
|
|
[self.eventDataSession uploadPerformanceData:[self getPerformanceFormatData:[self.performanceCacheArray copy] type:type] tag:nil result:^(BOOL isSuc, id tag, NSError *error) {
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
@synchronized (self.performanceCacheArray) {
|
|
|
NSMutableArray *data = [[NSMutableArray alloc]initWithCapacity:0];
|
|
|
[data setArray:self.performanceCacheArray];
|
|
|
[self.performanceCacheArray removeAllObjects];
|
|
|
//if ([data count] > 0) {
|
|
|
[self.eventDataSession uploadPerformanceData:[self getPerformanceFormatData:data type:YHEventReportTrackDataTypeHeartbeat] tag:nil result:^(BOOL isSuc, id tag, NSError *error) {
|
|
|
}];
|
|
|
//}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@end |
...
|
...
|
|