• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLINFO_SPEED_UPLOAD
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_SPEED_DOWNLOAD_T (3)
9  - curl_easy_getinfo (3)
10  - curl_easy_setopt (3)
11---
12
13# NAME
14
15CURLINFO_SPEED_UPLOAD - get upload speed
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_UPLOAD, double *speed);
23~~~
24
25# DESCRIPTION
26
27Pass a pointer to a double to receive the average upload speed that curl
28measured for the complete upload. Measured in bytes/second.
29
30CURLINFO_SPEED_UPLOAD_T(3) is a newer replacement that returns a more
31sensible variable type.
32
33# PROTOCOLS
34
35# EXAMPLE
36
37~~~c
38int main(void)
39{
40  CURL *curl = curl_easy_init();
41  if(curl) {
42    CURLcode res;
43    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
44
45    /* Perform the request */
46    res = curl_easy_perform(curl);
47
48    if(!res) {
49      double speed;
50      res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed);
51      if(!res) {
52        printf("Upload speed %.0f bytes/sec\n", speed);
53      }
54    }
55  }
56}
57~~~
58
59# AVAILABILITY
60
61Added in 7.4.1. Deprecated since 7.55.0.
62
63# RETURN VALUE
64
65Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
66