mirror of https://git.sr.ht/~hrbrmstr/speedtest
boB Rudis
7 years ago
37 changed files with 803 additions and 48 deletions
@ -0,0 +1,25 @@ |
|||
# Contributor Code of Conduct |
|||
|
|||
As contributors and maintainers of this project, we pledge to respect all people who |
|||
contribute through reporting issues, posting feature requests, updating documentation, |
|||
submitting pull requests or patches, and other activities. |
|||
|
|||
We are committed to making participation in this project a harassment-free experience for |
|||
everyone, regardless of level of experience, gender, gender identity and expression, |
|||
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. |
|||
|
|||
Examples of unacceptable behavior by participants include the use of sexual language or |
|||
imagery, derogatory comments or personal attacks, trolling, public or private harassment, |
|||
insults, or other unprofessional conduct. |
|||
|
|||
Project maintainers have the right and responsibility to remove, edit, or reject comments, |
|||
commits, code, wiki edits, issues, and other contributions that are not aligned to this |
|||
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed |
|||
from the project team. |
|||
|
|||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by |
|||
opening an issue or contacting one or more of the project maintainers. |
|||
|
|||
This Code of Conduct is adapted from the Contributor Covenant |
|||
(http:contributor-covenant.org), version 1.0.0, available at |
|||
http://contributor-covenant.org/version/1/0/0/ |
@ -1,3 +1,7 @@ |
|||
.base_raw <- charToRaw('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|||
|
|||
.speedtest_ua <- "Mozilla/5.0 (Compatibe; r-speedtest/1.0; https://github.com/hrbrmstr/speedtest)" |
|||
|
|||
utils::globalVariables( |
|||
c("total", "latency_url", "test_result", "ping_time", "total_time", "retrieval_time", |
|||
"bw", "size", "secs")) |
@ -0,0 +1,14 @@ |
|||
#' Compute bandwidth from bytes transferred and time taken |
|||
#' |
|||
#' @md |
|||
#' @param size_bytes size (in bytes) of the payload transferred |
|||
#' @param xfer_secs time taken for the transfer |
|||
#' @param mbits produce output in megabits (Mb)? Default: `TRUE` |
|||
#' @export |
|||
#' @examples |
|||
#' spd_compute_bandwidth(19200000, 1) # 150 Mb/sec |
|||
spd_compute_bandwidth <- function(size_bytes, xfer_secs, mbits=TRUE) { |
|||
res <- size_bytes / xfer_secs |
|||
if (mbits) res <- (res*8) / 1024 / 1000 |
|||
res |
|||
} |
@ -1,37 +1,73 @@ |
|||
#' Download test |
|||
#' Perform a download speed/bandwidth test |
|||
#' |
|||
#' Currently, ten tests are performed in increasing order of size. |
|||
#' |
|||
#' This uses the legacy HTTP method of determining your bandwidth/speed and, |
|||
#' as such, has many issues. Rather than hack-compensate for error-prone |
|||
#' results with smaller files used on high-bandwidth connections, raw size + |
|||
#' transfer speed data is returned enabling you to perform your own adjustments |
|||
#' or choose which values to "believe". |
|||
#' |
|||
#' @md |
|||
#' @param server a data frame row from one of the functions that retrieves or |
|||
#' filters a server list. You can pass in a full servers list but |
|||
#' only the first entry will be processed. |
|||
#' @param config client configuration retrieved via [spd_config()]. If `NULL` it |
|||
#' will be retrieved |
|||
#' @param summarise the raw results from each test --- including file sizes --- |
|||
#' will be returned if the value is `FALSE`. If `TRUE` only summary |
|||
#' statistics will be returned. |
|||
#' @param timeout max time (seconds) to wait for a connection or download to finish. |
|||
#' Default is `60` seconds |
|||
#' @note speed/bandwidth values are in Mbits/s; these tests consume bandwidth so |
|||
#' if you're on a metered connection, you may incur charges. |
|||
#' @export |
|||
spd_download_test <- function(server, config=NULL) { |
|||
#' @examples \dontrun{ |
|||
#' config <- spd_config() |
|||
#' |
|||
#' servers <- spd_servers(config=config) |
|||
#' closest_servers <- spd_closest_servers(servers, config=config) |
|||
#' only_the_best_severs <- spd_best_servers(closest_servers, config) |
|||
#' |
|||
#' spd_download_test(closest_servers, config=config) |
|||
#' spd_download_test(best_servers, config=config) |
|||
#' } |
|||
spd_download_test <- function(server, config=NULL, summarise=TRUE, timeout=60) { |
|||
|
|||
if (nrow(server) > 1) server <- server[1,] |
|||
|
|||
server <- unclass(server) |
|||
if (is.null(config)) config <- spd_config() |
|||
|
|||
down_sizes <- c(350, 500, 750, 1000, 1500, 2000, 2500, 3000, 3500, 4000) |
|||
|
|||
dl_urls <- sprintf("%s/random%sx%s.jpg", dirname(server$url), down_sizes, down_sizes) |
|||
dl_urls <- sprintf("%s/random%sx%s.jpg", dirname(server$url[1]), down_sizes, down_sizes) |
|||
|
|||
pb <- dplyr::progress_estimated(length(dl_urls)) |
|||
purrr::map(dl_urls, ~{ |
|||
pb$tick()$print() |
|||
httr::GET( |
|||
url = .x, |
|||
httr::add_headers( |
|||
`Referer` = "http://c.speedtest.net/flash/speedtest.swf", |
|||
`Cache-Control` = "no-cache" |
|||
), |
|||
httr::user_agent( |
|||
splashr::ua_macos_chrome |
|||
), |
|||
query=list(ts=as.numeric(Sys.time())) |
|||
) |
|||
}) -> dl_resp |
|||
|
|||
purrr::discard(dl_resp, ~.x$status_code != 200) %>% |
|||
purrr::map_df(~{ |
|||
list(secs = .x$times[6] - .x$times[5], size = (length(.x$content) + length(.x$header))) |
|||
res <- .download_one(url=.x, timeout=timeout) |
|||
res$result |
|||
}) %>% |
|||
dplyr::mutate(bw = ((size/secs)*8) / 1024 / 1024) %>% |
|||
dplyr::summarise(min=min(bw), mean=mean(bw), median=median(bw), max=max(bw), sd=sd(bw), var=var(bw)) |
|||
purrr::discard(is.null) %>% |
|||
purrr::discard(~.x$status_code != 200) %>% |
|||
purrr::map_df(~{ |
|||
list( |
|||
test = "download", |
|||
secs = .x$times[6] - .x$times[5], |
|||
size = sum(purrr::map_dbl(names(unlist(.x$all_headers)), nchar)) + |
|||
sum(purrr::map_dbl(unlist(.x$all_headers), nchar)) + length(.x$content) |
|||
) |
|||
}) %>% |
|||
dplyr::mutate(bw = spd_compute_bandwidth(size, secs)) -> out |
|||
|
|||
if (summarise) { |
|||
out <- dplyr::summarise(out, min=min(bw, na.rm=TRUE), mean=mean(bw, na.rm=TRUE), |
|||
median=median(bw, na.rm=TRUE), max=max(bw, na.rm=TRUE), |
|||
sd=sd(bw, na.rm=TRUE)) |
|||
} |
|||
|
|||
out$id <- server$id |
|||
|
|||
dplyr::left_join(server, out, "id") |
|||
|
|||
} |
|||
|
@ -0,0 +1,61 @@ |
|||
#' Perform an upload speed/bandwidth test |
|||
#' |
|||
#' Currently, six tests are performed in increasing order of size. |
|||
#' |
|||
#' This uses the legacy HTTP method of determining your bandwidth/speed and, |
|||
#' as such, has many issues. Rather than hack-compensate for error-prone |
|||
#' results with smaller files used on high-bandwidth connections, raw size + |
|||
#' transfer speed data is returned enabling you to perform your own adjustments |
|||
#' or choose which values to "believe". |
|||
#' |
|||
#' @md |
|||
#' @param server a data frame row from one of the functions that retrieves or |
|||
#' filters a server list. You can pass in a full servers list but |
|||
#' only the first entry will be processed. |
|||
#' @param config client configuration retrieved via [spd_config()]. If `NULL` it |
|||
#' will be retrieved |
|||
#' @param summarise the raw results from each test --- including file sizes --- |
|||
#' will be returned if the value is `FALSE`. If `TRUE` only summary |
|||
#' statistics will be returned. |
|||
#' @param timeout max time (seconds) to wait for a connection or download to finish. |
|||
#' Default is `60` seconds |
|||
#' @note speed/bandwidth values are in Mbits/s; these tests consume bandwidth so |
|||
#' if you're on a metered connection, you may incur charges. |
|||
#' @export |
|||
spd_upload_test <- function(server, config=NULL, summarise=TRUE, timeout=60) { |
|||
|
|||
if (nrow(server) > 1) server <- server[1,] |
|||
|
|||
if (is.null(config)) config <- spd_config() |
|||
|
|||
up_sizes <- c(131072, 262144, 524288, 1048576, 4194304, 8388608) |
|||
|
|||
pb <- dplyr::progress_estimated(length(up_sizes)) |
|||
purrr::map(up_sizes, ~{ |
|||
pb$tick()$print() |
|||
.dat <- sample(.base_raw, .x, replace=TRUE) |
|||
res <- .upload_one(server$url[1], .dat, timeout) |
|||
list(sz=.x, res=res$result) |
|||
}) %>% |
|||
purrr::discard(~is.null(.x$res)) %>% |
|||
purrr::discard(~.x$res$status_code != 200) %>% |
|||
purrr::map_df(~{ |
|||
list( |
|||
test = "upload", |
|||
secs = .x$res$times[6] - .x$res$times[5], |
|||
size = .x$sz |
|||
) |
|||
}) %>% |
|||
dplyr::mutate(bw = spd_compute_bandwidth(size, secs)) -> out |
|||
|
|||
if (summarise) { |
|||
out <- dplyr::summarise(out, min=min(bw, na.rm=TRUE), mean=mean(bw, na.rm=TRUE), |
|||
median=median(bw, na.rm=TRUE), max=max(bw, na.rm=TRUE), |
|||
sd=sd(bw, na.rm=TRUE)) |
|||
} |
|||
|
|||
out$id <- server$id |
|||
|
|||
dplyr::left_join(server, out, "id") |
|||
|
|||
} |
@ -1 +1,32 @@ |
|||
sGET <- purrr::safely(httr::GET) |
|||
sGET <- purrr::safely(httr::GET) |
|||
sPOST <- purrr::safely(httr::POST) |
|||
|
|||
|
|||
.download_one <- function(url, timeout) { |
|||
sGET( |
|||
url = url, |
|||
httr::add_headers( |
|||
`Referer` = "http://c.speedtest.net/flash/speedtest.swf", |
|||
`Cache-Control` = "no-cache" # try to bust transparent proxy caches |
|||
), |
|||
httr::user_agent(.speedtest_ua), |
|||
httr::timeout(timeout), |
|||
query=list(ts=as.numeric(Sys.time())) # try to bust transparent proxy caches |
|||
) |
|||
} |
|||
|
|||
.upload_one <- function(url, dat, timeout) { |
|||
sPOST( |
|||
url = url, |
|||
httr::add_headers( |
|||
`Referer` = "http://c.speedtest.net/flash/speedtest.swf", |
|||
`Connection` = "Keep-Alive", |
|||
`Cache-Control` = "no-cache" # try to bust transparent proxy caches |
|||
), |
|||
encode="form", |
|||
body=dat, |
|||
httr::user_agent(.speedtest_ua), |
|||
httr::timeout(timeout), |
|||
query=list(ts=as.numeric(Sys.time())) # try to bust transparent proxy caches |
|||
) |
|||
} |
|||
|
@ -0,0 +1,295 @@ |
|||
|
|||
# speedtest |
|||
|
|||
Tools to Test and Compare Internet Bandwidth Speeds |
|||
|
|||
## Description |
|||
|
|||
The ‘Ookla’ ‘Speedtest’ site <http://beta.speedtest.net/about> provides |
|||
interactive and programmatic services to test and compare bandwidth |
|||
speeds from a source node on the Internet to thousands of test servers. |
|||
Tools are provided to obtain test server lists, identify target servers |
|||
for testing and performing speed/bandwidth tests. |
|||
|
|||
## What’s Inside The Tin |
|||
|
|||
The following functions are implemented: |
|||
|
|||
- `spd_best_servers`: Find “best” servers (latency-wise) from master |
|||
server list |
|||
- `spd_closest_servers`: Find “closest” servers (geography-wise) from |
|||
master server list |
|||
- `spd_compute_bandwidth`: Compute bandwidth from bytes transferred |
|||
and time taken |
|||
- `spd_config`: Retrieve client configuration information for the |
|||
speedtest |
|||
- `spd_download_test`: Perform a download speed/bandwidth test |
|||
- `spd_servers`: Retrieve a list of SpeedTest servers |
|||
- `spd_upload_test`: Perform an upload speed/bandwidth test |
|||
|
|||
## TODO |
|||
|
|||
Folks interested in contributing can take a look at the TODOs and pick |
|||
as many as you like\! Ones with question marks are truly a “I dunno if |
|||
we shld” kinda thing. Ones with exclamation marks are essentials. |
|||
|
|||
- \[ \] Cache config in memory at startup vs pass around to functions? |
|||
- \[ \] Figure out how to use beta sockets hidden API vs the old Flash |
|||
API? |
|||
- \[ \] Ensure the efficacy of relying on the cURL timings for speed |
|||
measures for the Flash API |
|||
- \[ \] Figure out best way to capture the results for post-processing |
|||
- \[ \] Upload results to speedtest (tis only fair)\! |
|||
- \[ \] Incorporate more network or host measures for better |
|||
statistical determination of the best target\! |
|||
- \[ \] `autoplot` support\! |
|||
- \[ \] RStudio Add-in |
|||
- \[ \] CLI wrapper |
|||
- \[ \] Shiny app? |
|||
|
|||
## Installation |
|||
|
|||
``` r |
|||
devtools::install_github("hrbrmstr/speedtest") |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
``` r |
|||
library(speedtest) |
|||
library(stringi) |
|||
library(hrbrthemes) |
|||
library(ggbeeswarm) |
|||
library(tidyverse) |
|||
|
|||
# current verison |
|||
packageVersion("speedtest") |
|||
``` |
|||
|
|||
## [1] '0.1.0' |
|||
|
|||
### Download Speed |
|||
|
|||
``` r |
|||
config <- spd_config() |
|||
|
|||
servers <- spd_servers(config=config) |
|||
closest_servers <- spd_closest_servers(servers, config=config) |
|||
only_the_best_severs <- spd_best_servers(closest_servers, config) |
|||
``` |
|||
|
|||
### Individual download tests |
|||
|
|||
``` r |
|||
glimpse(spd_download_test(closest_servers[1,], config=config)) |
|||
``` |
|||
|
|||
## Observations: 1 |
|||
## Variables: 15 |
|||
## $ url <chr> "http://speed0.xcelx.net/speedtest/upload.php" |
|||
## $ lat <dbl> 42.3875 |
|||
## $ lng <dbl> -71.1 |
|||
## $ name <chr> "Somerville, MA" |
|||
## $ country <chr> "United States" |
|||
## $ cc <chr> "US" |
|||
## $ sponsor <chr> "Axcelx Technologies LLC" |
|||
## $ id <chr> "5960" |
|||
## $ host <chr> "speed0.xcelx.net:8080" |
|||
## $ url2 <chr> "http://speed1.xcelx.net/speedtest/upload.php" |
|||
## $ min <dbl> 21.66333 |
|||
## $ mean <dbl> 74.9058 |
|||
## $ median <dbl> 67.30838 |
|||
## $ max <dbl> 136.195 |
|||
## $ sd <dbl> 41.85532 |
|||
|
|||
``` r |
|||
glimpse(spd_download_test(only_the_best_severs[1,], config=config)) |
|||
``` |
|||
|
|||
## Observations: 1 |
|||
## Variables: 18 |
|||
## $ ping_time <dbl> 0.038836 |
|||
## $ total_time <dbl> 0.114157 |
|||
## $ retrieval_time <dbl> 1.7e-05 |
|||
## $ url <chr> "http://speedtest.norwoodlight.com/speedtest/upload.php" |
|||
## $ lat <dbl> 42.1944 |
|||
## $ lng <dbl> -71.2 |
|||
## $ name <chr> "Norwood, MA" |
|||
## $ country <chr> "United States" |
|||
## $ cc <chr> "US" |
|||
## $ sponsor <chr> "Norwood Light Broadband" |
|||
## $ id <chr> "4920" |
|||
## $ host <chr> "speedtest.norwoodlight.com:8080" |
|||
## $ url2 <chr> "http://netgauge.norwoodlight.com/speedtest/upload.php" |
|||
## $ min <dbl> 10.52263 |
|||
## $ mean <dbl> 50.86126 |
|||
## $ median <dbl> 30.98824 |
|||
## $ max <dbl> 111.8747 |
|||
## $ sd <dbl> 35.40526 |
|||
|
|||
### Individual download tests |
|||
|
|||
``` r |
|||
glimpse(spd_upload_test(only_the_best_severs[1,], config=config)) |
|||
``` |
|||
|
|||
## Observations: 1 |
|||
## Variables: 18 |
|||
## $ ping_time <dbl> 0.038836 |
|||
## $ total_time <dbl> 0.114157 |
|||
## $ retrieval_time <dbl> 1.7e-05 |
|||
## $ url <chr> "http://speedtest.norwoodlight.com/speedtest/upload.php" |
|||
## $ lat <dbl> 42.1944 |
|||
## $ lng <dbl> -71.2 |
|||
## $ name <chr> "Norwood, MA" |
|||
## $ country <chr> "United States" |
|||
## $ cc <chr> "US" |
|||
## $ sponsor <chr> "Norwood Light Broadband" |
|||
## $ id <chr> "4920" |
|||
## $ host <chr> "speedtest.norwoodlight.com:8080" |
|||
## $ url2 <chr> "http://netgauge.norwoodlight.com/speedtest/upload.php" |
|||
## $ min <dbl> 7.307031 |
|||
## $ mean <dbl> 8.812541 |
|||
## $ median <dbl> 8.814865 |
|||
## $ max <dbl> 10.77554 |
|||
## $ sd <dbl> 1.260674 |
|||
|
|||
``` r |
|||
glimpse(spd_upload_test(closest_servers[1,], config=config)) |
|||
``` |
|||
|
|||
## Observations: 1 |
|||
## Variables: 15 |
|||
## $ url <chr> "http://speed0.xcelx.net/speedtest/upload.php" |
|||
## $ lat <dbl> 42.3875 |
|||
## $ lng <dbl> -71.1 |
|||
## $ name <chr> "Somerville, MA" |
|||
## $ country <chr> "United States" |
|||
## $ cc <chr> "US" |
|||
## $ sponsor <chr> "Axcelx Technologies LLC" |
|||
## $ id <chr> "5960" |
|||
## $ host <chr> "speed0.xcelx.net:8080" |
|||
## $ url2 <chr> "http://speed1.xcelx.net/speedtest/upload.php" |
|||
## $ min <dbl> 5.314042 |
|||
## $ mean <dbl> 10.20264 |
|||
## $ median <dbl> 10.64703 |
|||
## $ max <dbl> 13.97671 |
|||
## $ sd <dbl> 3.113636 |
|||
|
|||
### Moar download tests |
|||
|
|||
Choose closest, “best” and randomly (there can be, and are, some dups as |
|||
a result for best/closest), run the test and chart the results. This |
|||
will show just how disparate the results are from these core/crude |
|||
tests. Most of the test servers compensate when they present the |
|||
results. Newer, “socket”-based tests are more accurate but there are no |
|||
free/hidden exposed APIs yet for most of them. |
|||
|
|||
``` r |
|||
set.seed(8675309) |
|||
|
|||
bind_rows( |
|||
|
|||
closest_servers[1:3,] %>% |
|||
mutate(type="closest"), |
|||
|
|||
only_the_best_severs[1:3,] %>% |
|||
mutate(type="best"), |
|||
|
|||
filter(servers, !(id %in% c(closest_servers[1:3,]$id, only_the_best_severs[1:3,]$id))) %>% |
|||
sample_n(3) %>% |
|||
mutate(type="random") |
|||
|
|||
) %>% |
|||
group_by(type) %>% |
|||
ungroup() -> to_compare |
|||
|
|||
select(to_compare, sponsor, name, country, host, type) |
|||
``` |
|||
|
|||
## # A tibble: 9 x 5 |
|||
## sponsor name country host type |
|||
## <chr> <chr> <chr> <chr> <chr> |
|||
## 1 Axcelx Technologies LLC Somerville, MA United States speed0.xcelx.net:8080 closest |
|||
## 2 Comcast Boston, MA United States stosat-ndhm-01.sys.comcast.net:8080 closest |
|||
## 3 Starry, Inc. Boston, MA United States speedtest-server.starry.com:8080 closest |
|||
## 4 Norwood Light Broadband Norwood, MA United States speedtest.norwoodlight.com:8080 best |
|||
## 5 Comcast Boston, MA United States stosat-ndhm-01.sys.comcast.net:8080 best |
|||
## 6 Oxford Networks Lewiston, ME United States sp1.oxfordnetworks.com:8080 best |
|||
## 7 PirxNet Gliwice Poland st.pirx.pl:8080 random |
|||
## 8 QuadraNet, Inc Los Angeles, CA United States 69.12.66.27:80 random |
|||
## 9 PT. Telekomunikasi Indonesia Semarang Indonesia semarang.speedtest.telkom.net.id:8080 random |
|||
|
|||
``` r |
|||
map_df(1:nrow(to_compare), ~{ |
|||
spd_download_test(to_compare[.x,], config=config, summarise=FALSE, timeout=30) |
|||
}) -> dl_results_full |
|||
``` |
|||
|
|||
``` r |
|||
mutate(dl_results_full, type=stri_trans_totitle(type)) %>% |
|||
ggplot(aes(type, bw, fill=type)) + |
|||
geom_quasirandom(aes(size=size, color=type), width=0.15, shape=21, stroke=0.25) + |
|||
scale_y_continuous(expand=c(0,5), labels=c(sprintf("%s", seq(0,150,50)), "200 Mb/s"), limits=c(0,200)) + |
|||
scale_size(range=c(2,6)) + |
|||
scale_color_manual(values=c(Random="#b2b2b2", Best="#2b2b2b", Closest="#2b2b2b")) + |
|||
scale_fill_ipsum() + |
|||
labs(x=NULL, y=NULL, title="Download bandwidth test by selected server type", |
|||
subtitle="Circle size scaled by size of file used in that speed test") + |
|||
theme_ipsum_rc(grid="Y") + |
|||
theme(legend.position="none") |
|||
``` |
|||
|
|||
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-9-1.png)<!-- --> |
|||
|
|||
### Moar upload tests |
|||
|
|||
Choose closest and “best” and filter duplicates out since we’re really |
|||
trying to measure here vs show the disparity: |
|||
|
|||
``` r |
|||
bind_rows( |
|||
closest_servers[1:3,] %>% mutate(type="closest"), |
|||
only_the_best_severs[1:3,] %>% mutate(type="best") |
|||
) %>% |
|||
distinct(.keep_all=TRUE) -> to_compare |
|||
|
|||
select(to_compare, sponsor, name, country, host, type) |
|||
``` |
|||
|
|||
## # A tibble: 6 x 5 |
|||
## sponsor name country host type |
|||
## <chr> <chr> <chr> <chr> <chr> |
|||
## 1 Axcelx Technologies LLC Somerville, MA United States speed0.xcelx.net:8080 closest |
|||
## 2 Comcast Boston, MA United States stosat-ndhm-01.sys.comcast.net:8080 closest |
|||
## 3 Starry, Inc. Boston, MA United States speedtest-server.starry.com:8080 closest |
|||
## 4 Norwood Light Broadband Norwood, MA United States speedtest.norwoodlight.com:8080 best |
|||
## 5 Comcast Boston, MA United States stosat-ndhm-01.sys.comcast.net:8080 best |
|||
## 6 Oxford Networks Lewiston, ME United States sp1.oxfordnetworks.com:8080 best |
|||
|
|||
``` r |
|||
map_df(1:nrow(to_compare), ~{ |
|||
spd_upload_test(to_compare[.x,], config=config, summarise=FALSE, timeout=30) |
|||
}) -> ul_results_full |
|||
``` |
|||
|
|||
``` r |
|||
ggplot(ul_results_full, aes(x="Upload Test", y=bw)) + |
|||
geom_quasirandom(aes(size=size, fill="col"), width=0.1, shape=21, stroke=0.25, color="#2b2b2b") + |
|||
scale_y_continuous(expand=c(0,0.5), breaks=seq(0,16,4), |
|||
labels=c(sprintf("%s", seq(0,12,4)), "16 Mb/s"), limits=c(0,16)) + |
|||
scale_size(range=c(2,6)) + |
|||
scale_fill_ipsum() + |
|||
labs(x=NULL, y=NULL, title="Upload bandwidth test by selected server type", |
|||
subtitle="Circle size scaled by size of file used in that speed test") + |
|||
theme_ipsum_rc(grid="Y") + |
|||
theme(legend.position="none") |
|||
``` |
|||
|
|||
![](README.gfm-ascii_identifiers_files/figure-gfm/unnamed-chunk-11-1.png)<!-- --> |
|||
|
|||
## Code of Conduct |
|||
|
|||
Please note that this project is released with a [Contributor Code of |
|||
Conduct](CONDUCT.md). By participating in this project you agree to |
|||
abide by its terms. |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 50 KiB |
@ -0,0 +1,15 @@ |
|||
base |
|||
speedtest |
|||
stringi |
|||
hrbrthemes |
|||
ggplot2 |
|||
ggbeeswarm |
|||
tidyverse |
|||
tibble |
|||
tidyr |
|||
readr |
|||
purrr |
|||
dplyr |
|||
stringr |
|||
forcats |
|||
bindrcpp |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,21 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/bandwidth.r |
|||
\name{spd_compute_bandwidth} |
|||
\alias{spd_compute_bandwidth} |
|||
\title{Compute bandwidth from bytes transferred and time taken} |
|||
\usage{ |
|||
spd_compute_bandwidth(size_bytes, xfer_secs, mbits = TRUE) |
|||
} |
|||
\arguments{ |
|||
\item{size_bytes}{size (in bytes) of the payload transferred} |
|||
|
|||
\item{xfer_secs}{time taken for the transfer} |
|||
|
|||
\item{mbits}{produce output in megabits (Mb)? Default: \code{TRUE}} |
|||
} |
|||
\description{ |
|||
Compute bandwidth from bytes transferred and time taken |
|||
} |
|||
\examples{ |
|||
spd_compute_bandwidth(19200000, 1) # 150 Mb/sec |
|||
} |
@ -0,0 +1,37 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/upload.r |
|||
\name{spd_upload_test} |
|||
\alias{spd_upload_test} |
|||
\title{Perform an upload speed/bandwidth test} |
|||
\usage{ |
|||
spd_upload_test(server, config = NULL, summarise = TRUE, timeout = 60) |
|||
} |
|||
\arguments{ |
|||
\item{server}{a data frame row from one of the functions that retrieves or |
|||
filters a server list. You can pass in a full servers list but |
|||
only the first entry will be processed.} |
|||
|
|||
\item{config}{client configuration retrieved via \code{\link[=spd_config]{spd_config()}}. If \code{NULL} it |
|||
will be retrieved} |
|||
|
|||
\item{summarise}{the raw results from each test --- including file sizes --- |
|||
will be returned if the value is \code{FALSE}. If \code{TRUE} only summary |
|||
statistics will be returned.} |
|||
|
|||
\item{timeout}{max time (seconds) to wait for a connection or download to finish. |
|||
Default is \code{60} seconds} |
|||
} |
|||
\description{ |
|||
Currently, six tests are performed in increasing order of size. |
|||
} |
|||
\details{ |
|||
This uses the legacy HTTP method of determining your bandwidth/speed and, |
|||
as such, has many issues. Rather than hack-compensate for error-prone |
|||
results with smaller files used on high-bandwidth connections, raw size + |
|||
transfer speed data is returned enabling you to perform your own adjustments |
|||
or choose which values to "believe". |
|||
} |
|||
\note{ |
|||
speed/bandwidth values are in Mbits/s; these tests consume bandwidth so |
|||
if you're on a metered connection, you may incur charges. |
|||
} |
Loading…
Reference in new issue