1 |
efrain |
1 |
// Copyright 2020 Google LLC
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#import <Foundation/Foundation.h>
|
|
|
16 |
|
|
|
17 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
18 |
|
|
|
19 |
FOUNDATION_EXTERN NSInteger const kGaugeDataBatchSize;
|
|
|
20 |
|
|
|
21 |
/** List of gauges the gauge manager controls. */
|
|
|
22 |
typedef NS_OPTIONS(NSUInteger, FPRGauges) {
|
|
|
23 |
FPRGaugeNone = 0,
|
|
|
24 |
FPRGaugeCPU = (1 << 0),
|
|
|
25 |
FPRGaugeMemory = (1 << 1),
|
|
|
26 |
};
|
|
|
27 |
|
|
|
28 |
/** This class controls different gauge collection in the system. List of the gauges this class
|
|
|
29 |
manages are listed above. */
|
|
|
30 |
NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.")
|
|
|
31 |
@interface FPRGaugeManager : NSObject
|
|
|
32 |
|
|
|
33 |
/** @brief List of gauges that are currently being actively captured. */
|
|
|
34 |
@property(nonatomic, readonly) FPRGauges activeGauges;
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* Creates an instance of GaugeManager.
|
|
|
38 |
*
|
|
|
39 |
* @return Instance of GaugeManager.
|
|
|
40 |
*/
|
|
|
41 |
+ (instancetype)sharedInstance;
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* Initializer for the gauge manager. This is not available.
|
|
|
45 |
*/
|
|
|
46 |
- (instancetype)init NS_UNAVAILABLE;
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Starts collecting gauge metrics for the specified set of gauges. Calling this will dispatch all
|
|
|
50 |
* the currently existing gauge data and will start collecting the new data with the new sessionId.
|
|
|
51 |
*
|
|
|
52 |
* @param gauges Gauges that needs to be collected.
|
|
|
53 |
* @param sessionId SessionId for which the gauges are collected.
|
|
|
54 |
*/
|
|
|
55 |
- (void)startCollectingGauges:(FPRGauges)gauges forSessionId:(NSString *)sessionId;
|
|
|
56 |
|
|
|
57 |
/**
|
|
|
58 |
* Stops collecting gauge metrics for the specified set of gauges. Calling this will dispatch all
|
|
|
59 |
* the existing gauge data.
|
|
|
60 |
*
|
|
|
61 |
* @param gauges Gauges that needs to be stopped collecting.
|
|
|
62 |
*/
|
|
|
63 |
- (void)stopCollectingGauges:(FPRGauges)gauges;
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Collects all the gauges.
|
|
|
67 |
*/
|
|
|
68 |
- (void)collectAllGauges;
|
|
|
69 |
|
|
|
70 |
/**
|
|
|
71 |
* Takes a gauge metric and tries to dispatch the gauge metric.
|
|
|
72 |
*
|
|
|
73 |
* @param gaugeMetric Gauge metric that needs to be dispatched.
|
|
|
74 |
*/
|
|
|
75 |
- (void)dispatchMetric:(id)gaugeMetric;
|
|
|
76 |
|
|
|
77 |
@end
|
|
|
78 |
|
|
|
79 |
NS_ASSUME_NONNULL_END
|