FPRCPUGaugeCollector.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 <Foundation/Foundation.h>
  15. #import "FirebasePerformance/Sources/AppActivity/FPRAppActivityTracker.h"
  16. #import "FirebasePerformance/Sources/Gauges/CPU/FPRCPUGaugeData.h"
  17. #import "FirebasePerformance/Sources/Gauges/FPRGaugeCollector.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. @class FPRCPUGaugeCollector;
  20. /** Delegate method for the CPU Gauge collector to report back the CPU gauge data. */
  21. NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.")
  22. @protocol FPRCPUGaugeCollectorDelegate
  23. /**
  24. * Reports the collected CPU gauge data back to its delegate.
  25. *
  26. * @param collector CPU gauge collector that collected the information.
  27. * @param gaugeData CPU gauge data.
  28. */
  29. - (void)cpuGaugeCollector:(FPRCPUGaugeCollector *)collector gaugeData:(FPRCPUGaugeData *)gaugeData;
  30. @end
  31. /** CPU Gauge collector implementation. This class collects the CPU utilitization and reports back
  32. * to the delegate.
  33. */
  34. NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.")
  35. @interface FPRCPUGaugeCollector : NSObject <FPRGaugeCollector>
  36. /** Reference to the delegate object. */
  37. @property(nonatomic, weak, readonly) id<FPRCPUGaugeCollectorDelegate> delegate;
  38. /**
  39. * Initializes the CPU collector object with the delegate object provided.
  40. *
  41. * @param delegate Delegate object to which the CPU gauge data is provided.
  42. * @return Instance of the CPU Gauge collector.
  43. */
  44. - (instancetype)initWithDelegate:(id<FPRCPUGaugeCollectorDelegate>)delegate
  45. NS_DESIGNATED_INITIALIZER;
  46. /**
  47. * Initializer for the CPU Gauge collector. This is not available.
  48. */
  49. - (instancetype)init NS_UNAVAILABLE;
  50. @end
  51. NS_ASSUME_NONNULL_END