-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathBLStopwatch.h
58 lines (44 loc) · 1.33 KB
/
BLStopwatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* This file is part of the BLStopwatch package.
* (c) NewPan <13246884282@163.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Click https://github.com/beiliao-mobile/BLStopwatch
* or https://juejin.im/user/5941fa488d6d810058c0d4df to contact us.
*/
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, BLStopwatchSplitType) {
BLStopwatchSplitTypeMedian = 0, // 记录中间值.
BLStopwatchSplitTypeContinuous // 记录连续值.
};
NS_ASSUME_NONNULL_BEGIN
@interface BLStopwatch : NSObject
+ (instancetype)sharedStopwatch;
@property (nonatomic, readonly) NSArray<NSDictionary<NSString *, NSNumber *> *> *splits;
@property (nonatomic, readonly) NSString *prettyPrintedSplits;
@property (nonatomic, readonly) NSTimeInterval elapseTimeInterval;
- (void)start;
/**
* 打点(默认记录中间值).
*
* @param description 描述信息.
*/
- (void)splitWithDescription:(NSString * _Nullable)description;
/**
* 打点.
*
* @param type 记录的类型.
* @param description 描述信息.
*/
- (void)splitWithType:(BLStopwatchSplitType)type description:(NSString * _Nullable)description;
/**
* 刷新中间值.
*/
- (void)refreshMedianTime;
- (void)stop;
- (void)reset;
- (void)stopAndPresentResultsThenReset;
@end
NS_ASSUME_NONNULL_END