mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-23 11:44:41 -04:00
Remove performance classes
This commit is contained in:
parent
3a8db3fb72
commit
3b642d196d
@ -1,38 +0,0 @@
|
|||||||
// This file is part of Kiwix for iOS & macOS.
|
|
||||||
//
|
|
||||||
// Kiwix is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// any later version.
|
|
||||||
//
|
|
||||||
// Kiwix is distributed in the hope that it will be useful, but
|
|
||||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Kiwix; If not, see https://www.gnu.org/licenses/.
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import QuartzCore
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
final class Performance {
|
|
||||||
|
|
||||||
private let id: UUID
|
|
||||||
private var start: CFTimeInterval
|
|
||||||
|
|
||||||
init(id: UUID = UUID()) {
|
|
||||||
self.id = id
|
|
||||||
start = CACurrentMediaTime()
|
|
||||||
}
|
|
||||||
|
|
||||||
func measure(_ msg: String) {
|
|
||||||
print("\(msg) \(id): \((CACurrentMediaTime() - start) * 1000) ms")
|
|
||||||
}
|
|
||||||
|
|
||||||
func reset() {
|
|
||||||
start = CACurrentMediaTime()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||||||
// This file is part of Kiwix for iOS & macOS.
|
|
||||||
//
|
|
||||||
// Kiwix is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// any later version.
|
|
||||||
//
|
|
||||||
// Kiwix is distributed in the hope that it will be useful, but
|
|
||||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Kiwix; If not, see https://www.gnu.org/licenses/.
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <QuartzCore/QuartzCore.h>
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
|
|
||||||
@interface PerformanceObjC : NSObject
|
|
||||||
|
|
||||||
@property (nonatomic, strong, readonly) NSUUID *id;
|
|
||||||
@property (nonatomic, assign) CFTimeInterval start;
|
|
||||||
|
|
||||||
- (instancetype)initWithId:(NSUUID *)id;
|
|
||||||
- (void)measure:(NSString *)msg;
|
|
||||||
- (void)reset;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation PerformanceObjC
|
|
||||||
|
|
||||||
- (instancetype)init {
|
|
||||||
return [self initWithId:[NSUUID UUID]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithId:(NSUUID *)id {
|
|
||||||
self = [super init];
|
|
||||||
if (self) {
|
|
||||||
_id = id;
|
|
||||||
_start = CACurrentMediaTime();
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)measure:(NSString *)msg {
|
|
||||||
CFTimeInterval elapsedTime = (CACurrentMediaTime() - _start) * 1000;
|
|
||||||
NSLog(@"%@ %@: %.2f ms", msg, _id.UUIDString, elapsedTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)reset {
|
|
||||||
_start = CACurrentMediaTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
x
Reference in New Issue
Block a user