FPRCPUGaugeCollector.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. @protocol FPRCPUGaugeCollectorDelegate
  22. /**
  23. * Reports the collected CPU gauge data back to its delegate.
  24. *
  25. * @param collector CPU gauge collector that collected the information.
  26. * @param gaugeData CPU gauge data.
  27. */
  28. - (void)cpuGaugeCollector:(FPRCPUGaugeCollector *)collector gaugeData:(FPRCPUGaugeData *)gaugeData;
  29. @end
  30. /** CPU Gauge collector implementation. This class collects the CPU utilitization and reports back
  31. * to the delegate.
  32. */
  33. @interface FPRCPUGaugeCollector : NSObject <FPRGaugeCollector>
  34. /** Reference to the delegate object. */
  35. @property(nonatomic, weak, readonly) id<FPRCPUGaugeCollectorDelegate> delegate;
  36. /**
  37. * Initializes the CPU collector object with the delegate object provided.
  38. *
  39. * @param delegate Delegate object to which the CPU gauge data is provided.
  40. * @return Instance of the CPU Gauge collector.
  41. */
  42. - (instancetype)initWithDelegate:(id<FPRCPUGaugeCollectorDelegate>)delegate
  43. NS_DESIGNATED_INITIALIZER;
  44. /**
  45. * Initializer for the CPU Gauge collector. This is not available.
  46. */
  47. - (instancetype)init NS_UNAVAILABLE;
  48. @end
  49. NS_ASSUME_NONNULL_END