1 // 2 // ETCoreMLOperationProfilingInfo.h 3 // 4 // Copyright © 2024 Apple Inc. All rights reserved. 5 // 6 // Please refer to the license found in the LICENSE file in the root directory of the source tree. 7 8 #import <CoreML/CoreML.h> 9 10 #import <ETCoreMLComputeUnits.h> 11 12 NS_ASSUME_NONNULL_BEGIN 13 14 /// A class representing the profiling info of an operation. 15 __attribute__((objc_subclassing_restricted)) 16 @interface ETCoreMLOperationProfilingInfo : NSObject<NSCopying> 17 18 - (instancetype)init NS_UNAVAILABLE; 19 20 + (instancetype)new NS_UNAVAILABLE; 21 22 /// Constructs an `ETCoreMLOperationProfilingInfo` instance. 23 /// 24 /// @param preferredComputeUnit The compute unit used to execute the operation. 25 /// @param supportedComputeUnits The compute units that can execute the operation. 26 /// @param estimatedExecutionStartTime The estimated execution start time. 27 /// @param estimatedExecutionEndTime The estimated execution end time. 28 /// @param estimatedCost The estimated cost of executing an operation. 29 /// @param outputNames The output names of the operation. 30 /// @param operatorName The operator name of the operation. 31 /// @param metadata The metadata, for logging additional info. 32 - (instancetype)initWithPreferredComputeUnit:(ETCoreMLComputeUnits)preferredComputeUnit 33 supportedComputeUnits:(ETCoreMLComputeUnits)supportedComputeUnits 34 estimatedExecutionStartTime:(uint64_t)estimatedExecutionStartTime 35 estimatedExecutionEndTime:(uint64_t)estimatedExecutionEndTime 36 estimatedCost:(double)estimatedCost 37 outputNames:(NSArray<NSString*>*)outputNames 38 operatorName:(NSString*)operatorName 39 metadata:(NSData*)metadata NS_DESIGNATED_INITIALIZER; 40 41 /// Constructs an `ETCoreMLOperationProfilingInfo` instance. 42 /// 43 /// @param preferredComputeUnit The compute unit used to execute the operation. 44 /// @param supportedComputeUnits The compute units that can execute the operation. 45 /// @param estimatedExecutionStartTime The estimated execution start time. 46 /// @param estimatedExecutionEndTime The estimated execution end time. 47 /// @param estimatedCost The estimated cost of executing an operation. 48 /// @param outputNames The output names of the operation. 49 /// @param operatorName The operator name of the operation. 50 - (instancetype)initWithPreferredComputeUnit:(ETCoreMLComputeUnits)preferredComputeUnit 51 supportedComputeUnits:(ETCoreMLComputeUnits)supportedComputeUnits 52 estimatedExecutionStartTime:(uint64_t)estimatedExecutionStartTime 53 estimatedExecutionEndTime:(uint64_t)estimatedExecutionEndTime 54 estimatedCost:(double)estimatedCost 55 outputNames:(NSArray<NSString*>*)outputNames 56 operatorName:(NSString*)operatorName; 57 /// The preferred compute unit. 58 @property (readonly, assign, nonatomic) ETCoreMLComputeUnits preferredComputeUnit; 59 /// The supported compute units. 60 @property (readonly, assign, nonatomic) ETCoreMLComputeUnits supportedComputeUnits; 61 /// The estimated execution start time. 62 @property (readwrite, assign, nonatomic) uint64_t estimatedExecutionStartTime; 63 /// The estimated execution end time. 64 @property (readwrite, assign, nonatomic) uint64_t estimatedExecutionEndTime; 65 /// The output names of the operation. 66 @property (readonly, copy, nonatomic) NSArray<NSString*>* outputNames; 67 /// The operator name of the operation. 68 @property (readonly, copy, nonatomic) NSString* operatorName; 69 /// The estimated cost for executing the operation. 70 @property (readonly, assign, nonatomic) double estimatedCost; 71 /// The metadata, this is used to log additional info. 72 @property (readonly, strong, nonatomic) NSData* metadata; 73 74 @end 75 76 NS_ASSUME_NONNULL_END 77