curl
명령줄에 다음과 같은 진행 상황이 표시됩니다.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
8 1000M 8 85.2M 0 0 57k 0 1:06:13 0:05:38 1:00:35 47k
이 예에 표시된 속도는 입니다 47k
. 그런데 이것이 무엇을 의미하는가? 이것은:
- 47KiB, 즉 47 * 1024바이트
- 47kB, 즉 47 * 1000바이트
- 47kb, 즉 47 * 1000비트(비트는 속도를 측정하는 데 자주 사용됨)
그리고 그것은:
- 초당
- 아니면 분당?
답변1
컬은 대역폭에 어떤 단위를 사용합니까?
에 따르면소스 코드그것은 KiB per second
.
1024
여기에서 정의가 사용되는 것을 볼 수 있습니다 .1000
/* The point of this function would be to return a string of the input data,
but never longer than 5 columns (+ one zero byte).
Add suffix k, M, G when suitable... */
static char *max5data(curl_off_t bytes, char *max5)
{
#define ONE_KILOBYTE CURL_OFF_T_C(1024)
#define ONE_MEGABYTE (CURL_OFF_T_C(1024) * ONE_KILOBYTE)
#define ONE_GIGABYTE (CURL_OFF_T_C(1024) * ONE_MEGABYTE)
#define ONE_TERABYTE (CURL_OFF_T_C(1024) * ONE_GIGABYTE)
#define ONE_PETABYTE (CURL_OFF_T_C(1024) * ONE_TERABYTE)
...
}
여기에서 계산이 ms 단위로 수행된 다음 1000
초로 나누어지는 것을 볼 수 있습니다.
/* Calculate the average speed the last 'span_ms' milliseconds */
{
curl_off_t amount = data->progress.speeder[nowindex]-
data->progress.speeder[checkindex];
if(amount > CURL_OFF_T_C(4294967) /* 0xffffffff/1000 */)
/* the 'amount' value is bigger than would fit in 32 bits if
multiplied with 1000, so we use the double math for this */
data->progress.current_speed = (curl_off_t)
((double)amount/((double)span_ms/1000.0));
else
/* the 'amount' value is small enough to fit within 32 bits even
when multiplied with 1000 */
data->progress.current_speed = amount*CURL_OFF_T_C(1000)/span_ms;
}