AFNetworking/AFNetworking — pull request #745 by OliverLetterer (2013-01-20 10:42:16+00:00)
Title: Download and upload speed.

This pull request adds the ability to measure download and upload speed of an `AFURLConnectionOperation`.

###### Highlights:

* To reuse code between download and upload speed calculation (and to not clutter `AFURLConnectionOperation`), I introduced a new class `AFURLSpeedMeasure` that takes care of the speed calculation.
* `AFURLConnectionOperation` has two new properties `@property (nonatomic, strong, readonly) AFURLSpeedMeasure *downloadSpeedMeasure;` and `@property (nonatomic, strong, readonly) AFURLSpeedMeasure *uploadSpeedMeasure;`, which both have to be set active to start measuring speed. They are deactivated by default.
* `AFURLSpeedMeasure` uses a window to calculate the average speed over the last X data chunks that have been send or received.
* `AFURLSpeedMeasure` has a property `speedCalculationTimeInterval` that specifies a number of seconds that have to be passed after the next speed calculation can happen.
* `AFURLSpeedMeasure` has a property `@property (nonatomic, readonly) double speed;` with the speed in bytes per seconds.
* `AFURLSpeedMeasure` has a property `@property (nonatomic, copy, readonly) NSString *humanReadableSpeed;` which converts the speed in a human readable format. `1320919.431142 bytes/s` will be converted to `1.26 MB/s`.