2015-06-19 21:59:42 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-06-19 21:59:42 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-06-19 21:59:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSUInteger, RCTPLTag) {
|
|
|
|
RCTPLScriptDownload = 0,
|
2015-08-21 18:33:04 +00:00
|
|
|
RCTPLScriptExecution,
|
2016-04-01 14:24:40 +00:00
|
|
|
RCTPLRAMBundleLoad,
|
|
|
|
RCTPLRAMStartupCodeSize,
|
2016-09-09 22:22:20 +00:00
|
|
|
RCTPLRAMStartupNativeRequires,
|
|
|
|
RCTPLRAMStartupNativeRequiresCount,
|
2016-04-01 18:08:19 +00:00
|
|
|
RCTPLRAMNativeRequires,
|
2016-04-01 14:24:40 +00:00
|
|
|
RCTPLRAMNativeRequiresCount,
|
2015-08-21 18:33:04 +00:00
|
|
|
RCTPLNativeModuleInit,
|
2016-03-15 12:40:09 +00:00
|
|
|
RCTPLNativeModuleMainThread,
|
2015-10-08 15:41:55 +00:00
|
|
|
RCTPLNativeModulePrepareConfig,
|
2015-10-05 17:53:33 +00:00
|
|
|
RCTPLNativeModuleInjectConfig,
|
2016-03-16 16:46:55 +00:00
|
|
|
RCTPLNativeModuleMainThreadUsesCount,
|
2016-05-31 19:50:48 +00:00
|
|
|
RCTPLJSCWrapperOpenLibrary,
|
2016-03-15 12:40:09 +00:00
|
|
|
RCTPLJSCExecutorSetup,
|
2016-04-01 14:24:40 +00:00
|
|
|
RCTPLBridgeStartup,
|
2015-06-19 21:59:42 +00:00
|
|
|
RCTPLTTI,
|
2015-10-21 17:53:35 +00:00
|
|
|
RCTPLBundleSize,
|
2015-06-19 21:59:42 +00:00
|
|
|
RCTPLSize
|
|
|
|
};
|
|
|
|
|
2016-07-07 14:20:03 +00:00
|
|
|
@interface RCTPerformanceLogger : NSObject
|
|
|
|
|
2016-03-15 12:40:09 +00:00
|
|
|
/**
|
|
|
|
* Starts measuring a metric with the given tag.
|
|
|
|
* Overrides previous value if the measurement has been already started.
|
|
|
|
* If RCTProfile is enabled it also begins appropriate async event.
|
2016-07-07 14:20:03 +00:00
|
|
|
* All work is scheduled on the background queue so this doesn't block current thread.
|
2016-03-15 12:40:09 +00:00
|
|
|
*/
|
2016-07-07 14:20:03 +00:00
|
|
|
- (void)markStartForTag:(RCTPLTag)tag;
|
2016-03-15 12:40:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stops measuring a metric with given tag.
|
|
|
|
* Checks if RCTPerformanceLoggerStart() has been called before
|
|
|
|
* and doesn't do anything and log a message if it hasn't.
|
|
|
|
* If RCTProfile is enabled it also ends appropriate async event.
|
2016-07-07 14:20:03 +00:00
|
|
|
* All work is scheduled on the background queue so this doesn't block current thread.
|
2016-03-15 12:40:09 +00:00
|
|
|
*/
|
2016-07-07 14:20:03 +00:00
|
|
|
- (void)markStopForTag:(RCTPLTag)tag;
|
2016-03-15 12:40:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets given value for a metric with given tag.
|
2016-07-07 14:20:03 +00:00
|
|
|
* All work is scheduled on the background queue so this doesn't block current thread.
|
2016-03-15 12:40:09 +00:00
|
|
|
*/
|
2016-07-07 14:20:03 +00:00
|
|
|
- (void)setValue:(int64_t)value forTag:(RCTPLTag)tag;
|
2016-03-15 12:40:09 +00:00
|
|
|
|
2016-04-01 14:24:40 +00:00
|
|
|
/**
|
|
|
|
* Adds given value to the current value for a metric with given tag.
|
2016-07-07 14:20:03 +00:00
|
|
|
* All work is scheduled on the background queue so this doesn't block current thread.
|
2016-04-01 14:24:40 +00:00
|
|
|
*/
|
2016-07-07 14:20:03 +00:00
|
|
|
- (void)addValue:(int64_t)value forTag:(RCTPLTag)tag;
|
2016-04-01 14:24:40 +00:00
|
|
|
|
2016-03-15 12:40:09 +00:00
|
|
|
/**
|
|
|
|
* Starts an additional measurement for a metric with given tag.
|
|
|
|
* It doesn't override previous measurement, instead it'll append a new value
|
|
|
|
* to the old one.
|
2016-07-07 14:20:03 +00:00
|
|
|
* All work is scheduled on the background queue so this doesn't block current thread.
|
2016-03-15 12:40:09 +00:00
|
|
|
*/
|
2016-07-07 14:20:03 +00:00
|
|
|
- (void)appendStartForTag:(RCTPLTag)tag;
|
2016-03-15 12:40:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stops measurement and appends the result to the metric with given tag.
|
|
|
|
* Checks if RCTPerformanceLoggerAppendStart() has been called before
|
|
|
|
* and doesn't do anything and log a message if it hasn't.
|
2016-07-07 14:20:03 +00:00
|
|
|
* All work is scheduled on the background queue so this doesn't block current thread.
|
|
|
|
*/
|
|
|
|
- (void)appendStopForTag:(RCTPLTag)tag;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array with values for all tags.
|
|
|
|
* Use RCTPLTag to go over the array, there's a pair of values
|
|
|
|
* for each tag: start and stop (with indexes 2 * tag and 2 * tag + 1).
|
|
|
|
*/
|
|
|
|
- (NSArray<NSNumber *> *)valuesForTags;
|
|
|
|
|
|
|
|
/**
|
2016-07-22 16:50:48 +00:00
|
|
|
* Returns a duration in ms (stop_time - start_time) for given RCTPLTag.
|
2016-07-07 14:20:03 +00:00
|
|
|
*/
|
|
|
|
- (int64_t)durationForTag:(RCTPLTag)tag;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a value for given RCTPLTag.
|
|
|
|
*/
|
|
|
|
- (int64_t)valueForTag:(RCTPLTag)tag;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array with values for all tags.
|
|
|
|
* Use RCTPLTag to go over the array.
|
2016-03-15 12:40:09 +00:00
|
|
|
*/
|
2016-07-07 14:20:03 +00:00
|
|
|
- (NSArray<NSString *> *)labelsForTags;
|
2016-03-15 12:40:09 +00:00
|
|
|
|
2016-07-07 14:20:03 +00:00
|
|
|
@end
|