MP0 is a simple application that pings desired websites, as defined by the user, using Go-Routines and Go-Channels. This project was assigned to practice the newly learned Go-Routines and Go-Channels.
Clone the following git repository with git clone https://github.com/mringes13/mp0.git
.
Change the current directory to be within the recently cloned folder. Start the analytical ping with go run shellPing.go
If an error of the following form is triggered: "cannot find package 'github.com/go-echarts/go-echarts/v2/charts'", change module settings with export GO111MODULE=on
. Then restart the program with go run shellPing.go
.
go get github.com/go-echarts/go-echarts
go get github.com/montanaflynn/stats
Enter the website domains you wish you ping. You can input as many inputs as you want, but they must be separated by a white space. Press ENTER to generate analysis of parallel pings.
If you wish to quit the program, enter q
.
If input from command line was valid, an HTML file will be created. Open the created HTML file to see the GOMAXPROCS vs. Program Run Time plot with open gomaxprocsvsruntime.html
.
-
PingReturn Struct
type PingReturn struct { website string success bool latency float64 }
-
GOMAXPROCS-to-Runtime Map
var gmpToRuntime = make(map[int]int64)
0
: Successful1
: Incorrect command line input format2
: External package function error
- The plotting function is a modified version of sample code from Go E-Charts Examples.
- The data collected from the output table invokes functions from Go/montanaflynn/stats
- Our exact implementation of the
MaxParallelism()
function, which identifies and sets GOMAXPROCS to the maximum possible number of CPU Threads, was taken from this github repository.