YapDatabase/Testing/Xcode-mobile/YapDatabase/ViewController.m

53 lines
1.2 KiB
Objective-C

//
// ViewController.m
// YapDatabase
//
// Created by Robbie Hanson on 12/8/12.
// Copyright (c) 2012 Robbie Hanson. All rights reserved.
//
#import "ViewController.h"
#import "BenchmarkYapCache.h"
#import "BenchmarkYapDatabase.h"
@implementation ViewController
@synthesize databaseBenchmarksButton;
@synthesize cacheBenchmarksButton;
- (IBAction)runDatabaseBenchmarks
{
databaseBenchmarksButton.enabled = NO;
cacheBenchmarksButton.enabled = NO;
double delayInSeconds = 0.1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[BenchmarkYapDatabase runTestsWithCompletion:^{
databaseBenchmarksButton.enabled = YES;
cacheBenchmarksButton.enabled = YES;
}];
});
}
- (IBAction)runCacheBenchmarks
{
databaseBenchmarksButton.enabled = NO;
cacheBenchmarksButton.enabled = NO;
double delayInSeconds = 0.1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[BenchmarkYapCache runTestsWithCompletion:^{
databaseBenchmarksButton.enabled = YES;
cacheBenchmarksButton.enabled = YES;
}];
});
}
@end