mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[ASDisplayNode] Add Event Tracing to Help Debugging (#2243)
* Add some simple event logging for ASDisplayNode Improve the tracing * Add header to copy files phase * Make event header public
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#import "ASDisplayNode.h"
|
||||
#import "ASLayoutRangeType.h"
|
||||
#import "ASTraceEvent.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -18,6 +19,20 @@ void ASPerformBlockOnMainThread(void (^block)());
|
||||
void ASPerformBlockOnBackgroundThread(void (^block)()); // DISPATCH_QUEUE_PRIORITY_DEFAULT
|
||||
ASDISPLAYNODE_EXTERN_C_END
|
||||
|
||||
#ifndef ASDISPLAYNODE_EVENTLOG_CAPACITY
|
||||
#define ASDISPLAYNODE_EVENTLOG_CAPACITY 20
|
||||
#endif
|
||||
|
||||
#ifndef ASDISPLAYNODE_EVENTLOG_ENABLE
|
||||
#define ASDISPLAYNODE_EVENTLOG_ENABLE DEBUG
|
||||
#endif
|
||||
|
||||
#if ASDISPLAYNODE_EVENTLOG_ENABLE
|
||||
#define ASDisplayNodeLogEvent(node, ...) [node _logEventWithBacktrace:[NSThread callStackSymbols] format:__VA_ARGS__]
|
||||
#else
|
||||
#define ASDisplayNodeLogEvent(node, ...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Bitmask to indicate what performance measurements the cell should record.
|
||||
*/
|
||||
@@ -110,6 +125,20 @@ extern NSString *const ASDisplayNodeLayoutGenerationNumberOfPassesKey;
|
||||
*/
|
||||
+ (void)setRangeModeForMemoryWarnings:(ASLayoutRangeMode)rangeMode;
|
||||
|
||||
#if ASDISPLAYNODE_EVENTLOG_ENABLE
|
||||
|
||||
/**
|
||||
* The primitive event tracing method. You shouldn't call this. Use the ASDisplayNodeLogEvent macro instead.
|
||||
*/
|
||||
- (void)_logEventWithBacktrace:(NSArray<NSString *> *)backtrace format:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3);
|
||||
|
||||
/**
|
||||
* @abstract The most recent trace events for this node. Max count is ASDISPLAYNODE_EVENTLOG_CAPACITY.
|
||||
*/
|
||||
@property (readonly, copy) NSArray *eventLog;
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
Reference in New Issue
Block a user