FIRTrace+Private.h 2.5 KB

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