I have few buttons on screen. I need to calculate execution time when any ui element is pressed, but without adding that to every button. I have function that catches only View Controller touching.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSString * strLoad = @"";
for (int i = 1; i <=100000; i++) {
strLoad = [strLoad stringByAppendingString:@"add"];
}
NSLog(@"touchesBegan");
NSTimeInterval delta = ([[NSProcessInfo processInfo] systemUptime] - [(UIEvent*)event timestamp]);
NSLog(@"time %.2f", delta);
}
- (void)viewDidLoad {
[super viewDidLoad];
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (IBAction)btnMetadata:(id)sender {
NSString * strLoad = @"aBC";
for (int i = 1; i <=500; i++) {
strLoad = [strLoad stringByAppendingString:@"add"];
}
}
- (IBAction)btnGenerateCrash:(id)sender {
NSString * strLoad = @"aBC";
for (int i = 1; i <=5000; i++) {
strLoad = [strLoad stringByAppendingString:@"add"];
}
}