GULRuntimeStateHelper.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2018 Google LLC
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "GULRuntimeClassDiff.h"
  18. #import "GULRuntimeDiff.h"
  19. NS_ASSUME_NONNULL_BEGIN
  20. /** A helper class that enables the snapshotting and diffing of ObjC runtime state. */
  21. @interface GULRuntimeStateHelper : NSObject
  22. /** Captures the current state of the entire runtime and returns the snapshot number.
  23. *
  24. * @return The snapshot number corresponding to this capture.
  25. */
  26. + (NSUInteger)captureRuntimeState;
  27. /** Captures the current state of the runtime for the provided classes.
  28. *
  29. * @param classes The classes whose state should be snapshotted.
  30. * @return The snapshot number corresponding to this capture.
  31. */
  32. + (NSUInteger)captureRuntimeStateOfClasses:(NSSet<Class> *)classes;
  33. /** Prints the diff between two snapshot numbers.
  34. *
  35. * @param firstSnapshot The first runtime snapshot, as provided by captureRuntimeState.
  36. * @param secondSnapshot The runtime snapshot sometime after firstSnapshot.
  37. * @return An instance of GULRuntimeDiff that contains the diff information.
  38. */
  39. + (GULRuntimeDiff *)diffBetween:(NSUInteger)firstSnapshot secondSnapshot:(NSUInteger)secondSnapshot;
  40. @end
  41. NS_ASSUME_NONNULL_END