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 "FirebasePerformance/Sources/Timer/FPRCounterList.h"
|
|
|
16 |
|
|
|
17 |
#import "FirebasePerformance/Sources/AppActivity/FPRSessionDetails.h"
|
|
|
18 |
|
|
|
19 |
#import "FirebasePerformance/Sources/AppActivity/FPRTraceBackgroundActivityTracker.h"
|
|
|
20 |
|
|
|
21 |
#import "FirebasePerformance/Sources/FPRClient+Private.h"
|
|
|
22 |
#import "FirebasePerformance/Sources/FPRClient.h"
|
|
|
23 |
|
|
|
24 |
/**
|
|
|
25 |
* Extension that is added on top of the class FIRTrace to make the private properties visible
|
|
|
26 |
* between the implementation file and the unit tests.
|
|
|
27 |
*/
|
|
|
28 |
@interface FIRTrace ()
|
|
|
29 |
|
|
|
30 |
/** @brief NSTimeInterval for which the trace was active. */
|
|
|
31 |
@property(nonatomic, assign, readonly) NSTimeInterval totalTraceTimeInterval;
|
|
|
32 |
|
|
|
33 |
/** @brief Start time of the trace since epoch. */
|
|
|
34 |
@property(nonatomic, assign, readonly) NSTimeInterval startTimeSinceEpoch;
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* Starts a stage with the given name. Multiple stages can have a same name. Starting a new stage
|
|
|
38 |
* would stop the previous active stage if any.
|
|
|
39 |
*
|
|
|
40 |
* @param stageName name of the Stage.
|
|
|
41 |
*/
|
|
|
42 |
- (void)startStageNamed:(nonnull NSString *)stageName;
|
|
|
43 |
|
|
|
44 |
/** @brief List of stages in the trace. */
|
|
|
45 |
@property(nonnull, nonatomic) FPRClient *fprClient;
|
|
|
46 |
|
|
|
47 |
/** @brief List of stages in the trace. */
|
|
|
48 |
@property(nonnull, nonatomic) NSMutableArray<FIRTrace *> *stages;
|
|
|
49 |
|
|
|
50 |
/** @brief The current active stage. */
|
|
|
51 |
@property(nullable, nonatomic) FIRTrace *activeStage;
|
|
|
52 |
|
|
|
53 |
/** List of counters managed by the Trace. */
|
|
|
54 |
@property(nonnull, nonatomic, readonly) FPRCounterList *counterList;
|
|
|
55 |
|
|
|
56 |
/** Background state of the trace. */
|
|
|
57 |
@property(nonatomic, readonly) FPRTraceState backgroundTraceState;
|
|
|
58 |
|
|
|
59 |
/** @brief List of sessions the trace is associated with. */
|
|
|
60 |
@property(nonatomic, readwrite, nonnull) NSMutableArray<FPRSessionDetails *> *activeSessions;
|
|
|
61 |
|
|
|
62 |
/** @brief Serial queue to manage sessionId updates. */
|
|
|
63 |
@property(nonnull, nonatomic, readonly) dispatch_queue_t sessionIdSerialQueue;
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Verifies if the trace contains all necessary and valid information.
|
|
|
67 |
*
|
|
|
68 |
* @return A boolean stating if the Trace is complete.
|
|
|
69 |
*/
|
|
|
70 |
- (BOOL)isCompleteAndValid;
|
|
|
71 |
|
|
|
72 |
@end
|