Atualizado readme
This commit is contained in:
		
							parent
							
								
									6e4f68f362
								
							
						
					
					
						commit
						20ef1e7695
					
				
							
								
								
									
										57
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								README.md
									
									
									
									
									
								
							@ -1,3 +1,60 @@
 | 
				
			|||||||
# Data Transfer Test
 | 
					# Data Transfer Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Data Transfer Test is a software developed to measure the amount of data transferred over a period of time.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Screen
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								app.rb
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								app.rb
									
									
									
									
									
								
							@ -10,11 +10,11 @@ Time.now.utc.localtime("-04:00")
 | 
				
			|||||||
get '/' do
 | 
					get '/' do
 | 
				
			||||||
  @data = [
 | 
					  @data = [
 | 
				
			||||||
    { 
 | 
					    { 
 | 
				
			||||||
      'name': 'Taxa de Download', 
 | 
					      'name': 'Download Rate', 
 | 
				
			||||||
      'data': Rate.get_download
 | 
					      'data': Rate.get_download
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    { 
 | 
					    { 
 | 
				
			||||||
      'name': 'Taxa de Upload', 
 | 
					      'name': 'Upload Rate', 
 | 
				
			||||||
      'data': Rate.get_upload
 | 
					      'data': Rate.get_upload
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								public/images/screen.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								public/images/screen.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 75 KiB  | 
@ -3,16 +3,16 @@
 | 
				
			|||||||
<head>
 | 
					<head>
 | 
				
			||||||
  <meta charset="UTF-8">
 | 
					  <meta charset="UTF-8">
 | 
				
			||||||
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
					  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
  <script src="https://www.google.com/jsapi"></script>
 | 
					 | 
				
			||||||
  <link rel="stylesheet" href="style.css">
 | 
					  <link rel="stylesheet" href="style.css">
 | 
				
			||||||
  <link rel="stylesheet" href="node_modules/chart.js/dist/Chart.min.css">
 | 
					  <link rel="stylesheet" href="node_modules/chart.js/dist/Chart.min.css">
 | 
				
			||||||
  <link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,600,700" rel="stylesheet">
 | 
					  <link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,600,700" rel="stylesheet">
 | 
				
			||||||
 | 
					  <script src="https://www.google.com/jsapi"></script>
 | 
				
			||||||
  <script src="node_modules/chart.js/dist/Chart.bundle.js"></script>
 | 
					  <script src="node_modules/chart.js/dist/Chart.bundle.js"></script>
 | 
				
			||||||
  <script src="node_modules/chartkick/dist/chartkick.min.js"></script>
 | 
					  <script src="node_modules/chartkick/dist/chartkick.min.js"></script>
 | 
				
			||||||
  <title>Taxa de Velocidade</title>
 | 
					  <title>Data Transfer Test</title>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
  <h1>Taxa de Velocidade</h1>
 | 
					  <h1>Data Transfer Test</h1>
 | 
				
			||||||
  <%= yield %> 
 | 
					  <%= yield %> 
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user