QNUploadRequestMetrics.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // QNUploadRequestMetrics.h
  3. // QiniuSDK
  4. //
  5. // Created by yangsen on 2020/4/29.
  6. // Copyright © 2020 Qiniu. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "QNUploadRegionInfo.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. @interface QNUploadSingleRequestMetrics : NSObject
  12. // 请求的 httpVersion
  13. @property(nonatomic, copy)NSString *httpVersion;
  14. // 只有进行网络检测才会有 connectCheckMetrics
  15. @property (nullable , strong) QNUploadSingleRequestMetrics *connectCheckMetrics;
  16. // 错误信息
  17. @property (nullable , strong) NSError *error;
  18. @property (nonatomic, copy) NSURLRequest *request;
  19. @property (nullable , copy) NSURLResponse *response;
  20. @property (nullable, copy) NSDate *startDate;
  21. @property (nullable, copy) NSDate *endDate;
  22. @property (nonatomic, strong, readonly) NSNumber *totalElapsedTime;
  23. @property (nullable, copy) NSDate *domainLookupStartDate;
  24. @property (nullable, copy) NSDate *domainLookupEndDate;
  25. @property (nonatomic, strong, readonly) NSNumber *totalDnsTime;
  26. @property (nullable, copy) NSDate *connectStartDate;
  27. @property (nullable, copy) NSDate *connectEndDate;
  28. @property (nonatomic, strong, readonly) NSNumber *totalConnectTime;
  29. @property (nullable, copy) NSDate *secureConnectionStartDate;
  30. @property (nullable, copy) NSDate *secureConnectionEndDate;
  31. @property (nonatomic, strong, readonly) NSNumber *totalSecureConnectTime;
  32. @property (nullable, copy) NSDate *requestStartDate;
  33. @property (nullable, copy) NSDate *requestEndDate;
  34. @property (nonatomic, strong, readonly) NSNumber *totalRequestTime;
  35. @property (nonatomic, strong, readonly) NSNumber *totalWaitTime;
  36. @property (nullable, copy) NSDate *responseStartDate;
  37. @property (nullable, copy) NSDate *responseEndDate;
  38. @property (nonatomic, strong, readonly) NSNumber *totalResponseTime;
  39. @property (assign) int64_t countOfRequestHeaderBytesSent;
  40. @property (assign) int64_t countOfRequestBodyBytesSent;
  41. @property (assign) int64_t countOfResponseHeaderBytesReceived;
  42. @property (assign) int64_t countOfResponseBodyBytesReceived;
  43. @property (nullable, copy) NSString *localAddress;
  44. @property (nullable, copy) NSNumber *localPort;
  45. @property (nullable, copy) NSString *remoteAddress;
  46. @property (nullable, copy) NSNumber *remotePort;
  47. @property (nonatomic, strong, readonly) NSNumber *totalBytes;
  48. @property (nonatomic, strong, readonly) NSNumber *bytesSend;
  49. //MARK:-- 构造
  50. + (instancetype)emptyMetrics;
  51. @end
  52. @interface QNUploadRegionRequestMetrics : NSObject
  53. @property (nonatomic, strong, readonly) NSNumber *totalElapsedTime;
  54. @property (nonatomic, strong, readonly) NSNumber *requestCount;
  55. @property (nonatomic, strong, readonly) NSNumber *bytesSend;
  56. @property (nonatomic, strong, readonly) id <QNUploadRegion> region;
  57. @property (nonatomic, copy, readonly) NSArray<QNUploadSingleRequestMetrics *> *metricsList;
  58. //MARK:-- 构造
  59. + (instancetype)emptyMetrics;
  60. - (instancetype)initWithRegion:(id <QNUploadRegion>)region;
  61. - (void)addMetricsList:(NSArray <QNUploadSingleRequestMetrics *> *)metricsList;
  62. - (void)addMetrics:(QNUploadRegionRequestMetrics*)metrics;
  63. @end
  64. @interface QNUploadTaskMetrics : NSObject
  65. @property (nonatomic, strong, readonly) NSNumber *totalElapsedTime;
  66. @property (nonatomic, strong, readonly) NSNumber *requestCount;
  67. @property (nonatomic, strong, readonly) NSNumber *bytesSend;
  68. @property (nonatomic, strong, readonly) NSNumber *regionCount;
  69. @property (nonatomic, strong) NSArray<id <QNUploadRegion>> *regions;
  70. //MARK:-- 构造
  71. + (instancetype)emptyMetrics;
  72. - (void)addMetrics:(QNUploadRegionRequestMetrics *)metrics;
  73. @end
  74. NS_ASSUME_NONNULL_END