diff --git a/README.md b/README.md index 89e945e..1ceab77 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,60 @@ # Data Transfer Test +Data Transfer Test is a software developed to measure the amount of data transferred over a period of time. + +# Screen + +![alt](https://github.com/luizpicolo/data_transfer_test/raw/master/public/images/screen.png) + +# How to configure + +First clone this repository to the local machine + + git clone https://github.com/luizpicolo/data_transfer_test.git + +After, access local respository and install the dependencies + + cd data_transfer_test + bundle install + +and + + cd data_transfer_test/public + npm install + +# How to use + +Add `init.rb` to your cronjob or just create an infinite loop so that data is collected during a pre-defined period. + +init.rb +```ruby +require 'speedtest' +require 'sinatra/activerecord' +require './models/rate' + +test = Speedtest::Test.new(debug: false) + +while true + result = test.run + Rate.create({ + download: result.pretty_download_rate, + upload: result.pretty_upload_rate, + }) + + # Run every 10 minutes + sleep(60 * 10) +end +``` + +And, in another terminal, run the `app.rb` and access `localhost:4567` + + ruby app.rb +or + + rerun 'ruby app.rb' + + +## License + +DataTransferTest use Licença MIT. For more details read the [User License](./LICENSE.txt) diff --git a/app.rb b/app.rb index eb757f4..857f9db 100644 --- a/app.rb +++ b/app.rb @@ -10,11 +10,11 @@ Time.now.utc.localtime("-04:00") get '/' do @data = [ { - 'name': 'Taxa de Download', + 'name': 'Download Rate', 'data': Rate.get_download }, { - 'name': 'Taxa de Upload', + 'name': 'Upload Rate', 'data': Rate.get_upload }, ] diff --git a/public/images/screen.png b/public/images/screen.png new file mode 100644 index 0000000..4f68d2c Binary files /dev/null and b/public/images/screen.png differ diff --git a/views/layout.erb b/views/layout.erb index e875e7e..f62754b 100644 --- a/views/layout.erb +++ b/views/layout.erb @@ -3,16 +3,16 @@ - + - Taxa de Velocidade + Data Transfer Test -

Taxa de Velocidade

+

Data Transfer Test

<%= yield %> \ No newline at end of file