{"action":"created","comment":{"url":"https://api.github.com/repos/ipfs/iptb/pulls/comments/214519377","pull_request_review_id":151599547,"id":214519377,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDUxOTM3Nw==","diff_hunk":"@@ -195,13 +203,96 @@ func buildReport(results []Result) error {\n \t\t\tio.Copy(os.Stdout, rs.Output.Stderr())\n \n \t\t\tfmt.Println()\n+\t\t\ttimeElapsedArray[i] = rs.TimeElapsed\n+\t\t\tnodeIDArray[i] = rs.Node\n \t\t}\n \n \t}\n+\tif statsFlag {\n+\t\tstats, err := BuildStats(timeElapsedArray)\n+\t\tif err != nil {\n+\t\t\terrs = append(errs, err)\n+\t\t} else {\n+\t\t\tstatsJSON, _ := json.Marshal(stats)\n+\t\t\tfmt.Printf(\"Executed command < %s > on %d node(s) \\nTime Statistics: %s \\n\", command, len(results), string(statsJSON))\n+\t\t\tprintIndivudualResults(timeElapsedArray, nodeIDArray, \"time\")\n+\t\t}\n+\t}\n \n \tif len(errs) != 0 {\n \t\treturn cli.NewMultiError(errs...)\n \t}\n \n \treturn nil\n }\n+\n+func buildMetricStats(metricsBefore []string, metricsAfter []string, metric string) error {\n+\tvar errs []error\n+\n+\t// Substract Before from After to generate the results\n+\tresults, err := substractArrays(metricsBefore, metricsAfter)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\t// Create an array of node IDs\n+\t// TODO: Make this pretty :)\n+\tnodesID := make([]int, len(metricsAfter))\n+\n+\tfor i := range metricsAfter {\n+\t\tnodesID[i] = i\n+\t}\n+\t// Use the build stats function to generate the stats\n+\tstats, err := BuildStats(results)\n+\tif err != nil {\n+\t\terrs = append(errs, err)\n+\t} else {\n+\t\tstatsJSON, _ := json.Marshal(stats)\n+\t\tfmt.Printf(\"Metric collected < %s > on %d node(s) \\nStatistics: %s \\n\", metric, len(metricsAfter), string(statsJSON))\n+\t\tprintIndivudualResults(results, nodesID, metric)\n+\t}\n+\tif len(errs) != 0 {\n+\t\treturn cli.NewMultiError(errs...)\n+\t}\n+\treturn nil\n+}\n+\n+// Print individual results to JSON format\n+func printIndivudualResults(nodeTime []float64, nodeID []int, metric string) {\n+\tfmt.Printf(\"Analytic Results: {[\")\n+\tfor i, time := range nodeTime {\n+\t\tfmt.Printf(\"{Node: %d, %s: %f}\", nodeID[i], metric, time)\n+\t\tif i != len(nodeTime)-1 {\n+\t\t\tfmt.Printf(\",\")\n+\t\t}\n+\t}\n+\tfmt.Printf(\"]},\")\n+}\n+\n+/*\n+Substract_arrays\n+Substract y from x returns [xi-yi] for i in len(x)\n+If the arrays do not have the same length or\n+the strings are not castable to float\n+the function returns an error\n+*/\n+func substractArrays(lhs []string, rhs []string) ([]float64, error) {","path":"commands/utils.go","position":143,"original_position":143,"commit_id":"f39998e8e3b0de4b9d505e9c07b5a6572dfc284b","original_commit_id":"b971247622d7385416d6b2c2d161f796b2663e54","user":{"login":"davinci26","id":32749078,"node_id":"MDQ6VXNlcjMyNzQ5MDc4","avatar_url":"https://avatars2.githubusercontent.com/u/32749078?v=4","gravatar_id":"","url":"https://api.github.com/users/davinci26","html_url":"https://github.com/davinci26","followers_url":"https://api.github.com/users/davinci26/followers","following_url":"https://api.github.com/users/davinci26/following{/other_user}","gists_url":"https://api.github.com/users/davinci26/gists{/gist_id}","starred_url":"https://api.github.com/users/davinci26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davinci26/subscriptions","organizations_url":"https://api.github.com/users/davinci26/orgs","repos_url":"https://api.github.com/users/davinci26/repos","events_url":"https://api.github.com/users/davinci26/events{/privacy}","received_events_url":"https://api.github.com/users/davinci26/received_events","type":"User","site_admin":false},"body":"I will fix all of them :) Thnx a lot for the review, I totally agree details matter a lot !","created_at":"2018-09-01T17:53:44Z","updated_at":"2018-09-01T17:53:44Z","html_url":"https://github.com/ipfs/iptb/pull/65#discussion_r214519377","pull_request_url":"https://api.github.com/repos/ipfs/iptb/pulls/65","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ipfs/iptb/pulls/comments/214519377"},"html":{"href":"https://github.com/ipfs/iptb/pull/65#discussion_r214519377"},"pull_request":{"href":"https://api.github.com/repos/ipfs/iptb/pulls/65"}},"in_reply_to_id":214518899},"pull_request":{"url":"https://api.github.com/repos/ipfs/iptb/pulls/65","id":204889670,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0ODg5Njcw","html_url":"https://github.com/ipfs/iptb/pull/65","diff_url":"https://github.com/ipfs/iptb/pull/65.diff","patch_url":"https://github.com/ipfs/iptb/pull/65.patch","issue_url":"https://api.github.com/repos/ipfs/iptb/issues/65","number":65,"state":"open","locked":false,"title":"Add stat collection to IPTB","user":{"login":"davinci26","id":32749078,"node_id":"MDQ6VXNlcjMyNzQ5MDc4","avatar_url":"https://avatars2.githubusercontent.com/u/32749078?v=4","gravatar_id":"","url":"https://api.github.com/users/davinci26","html_url":"https://github.com/davinci26","followers_url":"https://api.github.com/users/davinci26/followers","following_url":"https://api.github.com/users/davinci26/following{/other_user}","gists_url":"https://api.github.com/users/davinci26/gists{/gist_id}","starred_url":"https://api.github.com/users/davinci26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davinci26/subscriptions","organizations_url":"https://api.github.com/users/davinci26/orgs","repos_url":"https://api.github.com/users/davinci26/repos","events_url":"https://api.github.com/users/davinci26/events{/privacy}","received_events_url":"https://api.github.com/users/davinci26/received_events","type":"User","site_admin":false},"body":"Hey y'all,\r\n\r\nThanks for the project it helped me a lot!\r\n\r\nAs discussed in IPFS issue board [IPFS Performance #5226](https://github.com/ipfs/go-ipfs/issues/5226), I made some changes to the IPTB framework to generate measure the performance of IPFS and generate performance graphs. In detail I added the following functions in the framework:\r\n- iptb make-topology: This creates a connection graph between the nodes (e.g. star topology, barbell topology). In the topology files empty lines and lines starting with # are disregarded. For non empty line the syntax is `origin:connection 1, connection 2 ...` where origin and connections are specified with their node ID.\r\n- iptb dist -hash: The simulation here distributes a single file from node 0 to every other node in the network. Then it calculates the average time required to download the file, the standard deviation of the time, the maximum time, the minimum time, the duplicate blocks. The results are saved in a generated file called results.json. \r\n\r\nI also added a Python3 script to plot the results that adds an additional optional dependency in the project, Matplotlib. \r\n\r\nFinally I created a readme file, simulation.md, that explains the logic of the simulation. I also added there the response of @whyrusleeping  to the issue [Simulate bad network #50](https://github.com/ipfs/iptb/issues/50) so people would know that there is support for bad network.\r\n\r\nI would appreciate your feedback and any improvements suggestions :) ","created_at":"2018-07-30T18:25:08Z","updated_at":"2018-09-01T17:53:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9aaa30ede10af14261f6c6b3a3431a007d5051c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"frrist","id":6546409,"node_id":"MDQ6VXNlcjY1NDY0MDk=","avatar_url":"https://avatars1.githubusercontent.com/u/6546409?v=4","gravatar_id":"","url":"https://api.github.com/users/frrist","html_url":"https://github.com/frrist","followers_url":"https://api.github.com/users/frrist/followers","following_url":"https://api.github.com/users/frrist/following{/other_user}","gists_url":"https://api.github.com/users/frrist/gists{/gist_id}","starred_url":"https://api.github.com/users/frrist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frrist/subscriptions","organizations_url":"https://api.github.com/users/frrist/orgs","repos_url":"https://api.github.com/users/frrist/repos","events_url":"https://api.github.com/users/frrist/events{/privacy}","received_events_url":"https://api.github.com/users/frrist/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ipfs/iptb/pulls/65/commits","review_comments_url":"https://api.github.com/repos/ipfs/iptb/pulls/65/comments","review_comment_url":"https://api.github.com/repos/ipfs/iptb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ipfs/iptb/issues/65/comments","statuses_url":"https://api.github.com/repos/ipfs/iptb/statuses/f39998e8e3b0de4b9d505e9c07b5a6572dfc284b","head":{"label":"davinci26:master","ref":"master","sha":"f39998e8e3b0de4b9d505e9c07b5a6572dfc284b","user":{"login":"davinci26","id":32749078,"node_id":"MDQ6VXNlcjMyNzQ5MDc4","avatar_url":"https://avatars2.githubusercontent.com/u/32749078?v=4","gravatar_id":"","url":"https://api.github.com/users/davinci26","html_url":"https://github.com/davinci26","followers_url":"https://api.github.com/users/davinci26/followers","following_url":"https://api.github.com/users/davinci26/following{/other_user}","gists_url":"https://api.github.com/users/davinci26/gists{/gist_id}","starred_url":"https://api.github.com/users/davinci26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davinci26/subscriptions","organizations_url":"https://api.github.com/users/davinci26/orgs","repos_url":"https://api.github.com/users/davinci26/repos","events_url":"https://api.github.com/users/davinci26/events{/privacy}","received_events_url":"https://api.github.com/users/davinci26/received_events","type":"User","site_admin":false},"repo":{"id":141604691,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE2MDQ2OTE=","name":"iptb","full_name":"davinci26/iptb","owner":{"login":"davinci26","id":32749078,"node_id":"MDQ6VXNlcjMyNzQ5MDc4","avatar_url":"https://avatars2.githubusercontent.com/u/32749078?v=4","gravatar_id":"","url":"https://api.github.com/users/davinci26","html_url":"https://github.com/davinci26","followers_url":"https://api.github.com/users/davinci26/followers","following_url":"https://api.github.com/users/davinci26/following{/other_user}","gists_url":"https://api.github.com/users/davinci26/gists{/gist_id}","starred_url":"https://api.github.com/users/davinci26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davinci26/subscriptions","organizations_url":"https://api.github.com/users/davinci26/orgs","repos_url":"https://api.github.com/users/davinci26/repos","events_url":"https://api.github.com/users/davinci26/events{/privacy}","received_events_url":"https://api.github.com/users/davinci26/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davinci26/iptb","description":"InterPlanetary TestBed 🌌🛌","fork":true,"url":"https://api.github.com/repos/davinci26/iptb","forks_url":"https://api.github.com/repos/davinci26/iptb/forks","keys_url":"https://api.github.com/repos/davinci26/iptb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davinci26/iptb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davinci26/iptb/teams","hooks_url":"https://api.github.com/repos/davinci26/iptb/hooks","issue_events_url":"https://api.github.com/repos/davinci26/iptb/issues/events{/number}","events_url":"https://api.github.com/repos/davinci26/iptb/events","assignees_url":"https://api.github.com/repos/davinci26/iptb/assignees{/user}","branches_url":"https://api.github.com/repos/davinci26/iptb/branches{/branch}","tags_url":"https://api.github.com/repos/davinci26/iptb/tags","blobs_url":"https://api.github.com/repos/davinci26/iptb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davinci26/iptb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davinci26/iptb/git/refs{/sha}","trees_url":"https://api.github.com/repos/davinci26/iptb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davinci26/iptb/statuses/{sha}","languages_url":"https://api.github.com/repos/davinci26/iptb/languages","stargazers_url":"https://api.github.com/repos/davinci26/iptb/stargazers","contributors_url":"https://api.github.com/repos/davinci26/iptb/contributors","subscribers_url":"https://api.github.com/repos/davinci26/iptb/subscribers","subscription_url":"https://api.github.com/repos/davinci26/iptb/subscription","commits_url":"https://api.github.com/repos/davinci26/iptb/commits{/sha}","git_commits_url":"https://api.github.com/repos/davinci26/iptb/git/commits{/sha}","comments_url":"https://api.github.com/repos/davinci26/iptb/comments{/number}","issue_comment_url":"https://api.github.com/repos/davinci26/iptb/issues/comments{/number}","contents_url":"https://api.github.com/repos/davinci26/iptb/contents/{+path}","compare_url":"https://api.github.com/repos/davinci26/iptb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davinci26/iptb/merges","archive_url":"https://api.github.com/repos/davinci26/iptb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davinci26/iptb/downloads","issues_url":"https://api.github.com/repos/davinci26/iptb/issues{/number}","pulls_url":"https://api.github.com/repos/davinci26/iptb/pulls{/number}","milestones_url":"https://api.github.com/repos/davinci26/iptb/milestones{/number}","notifications_url":"https://api.github.com/repos/davinci26/iptb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davinci26/iptb/labels{/name}","releases_url":"https://api.github.com/repos/davinci26/iptb/releases{/id}","deployments_url":"https://api.github.com/repos/davinci26/iptb/deployments","created_at":"2018-07-19T16:22:26Z","updated_at":"2018-09-01T15:21:22Z","pushed_at":"2018-09-01T15:21:20Z","git_url":"git://github.com/davinci26/iptb.git","ssh_url":"git@github.com:davinci26/iptb.git","clone_url":"https://github.com/davinci26/iptb.git","svn_url":"https://github.com/davinci26/iptb","homepage":"","size":10128,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ipfs:master","ref":"master","sha":"e1363360e80c7d799665b9675181a6e04d452035","user":{"login":"ipfs","id":10536621,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNTM2NjIx","avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":34197787,"node_id":"MDEwOlJlcG9zaXRvcnkzNDE5Nzc4Nw==","name":"iptb","full_name":"ipfs/iptb","owner":{"login":"ipfs","id":10536621,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNTM2NjIx","avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/iptb","description":"InterPlanetary TestBed 🌌🛌","fork":false,"url":"https://api.github.com/repos/ipfs/iptb","forks_url":"https://api.github.com/repos/ipfs/iptb/forks","keys_url":"https://api.github.com/repos/ipfs/iptb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/iptb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/iptb/teams","hooks_url":"https://api.github.com/repos/ipfs/iptb/hooks","issue_events_url":"https://api.github.com/repos/ipfs/iptb/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/iptb/events","assignees_url":"https://api.github.com/repos/ipfs/iptb/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/iptb/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/iptb/tags","blobs_url":"https://api.github.com/repos/ipfs/iptb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/iptb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/iptb/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/iptb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/iptb/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/iptb/languages","stargazers_url":"https://api.github.com/repos/ipfs/iptb/stargazers","contributors_url":"https://api.github.com/repos/ipfs/iptb/contributors","subscribers_url":"https://api.github.com/repos/ipfs/iptb/subscribers","subscription_url":"https://api.github.com/repos/ipfs/iptb/subscription","commits_url":"https://api.github.com/repos/ipfs/iptb/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/iptb/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/iptb/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/iptb/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/iptb/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/iptb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/iptb/merges","archive_url":"https://api.github.com/repos/ipfs/iptb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/iptb/downloads","issues_url":"https://api.github.com/repos/ipfs/iptb/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/iptb/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/iptb/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/iptb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/iptb/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/iptb/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/iptb/deployments","created_at":"2015-04-19T07:43:35Z","updated_at":"2018-08-31T11:53:29Z","pushed_at":"2018-09-01T15:21:22Z","git_url":"git://github.com/ipfs/iptb.git","ssh_url":"git@github.com:ipfs/iptb.git","clone_url":"https://github.com/ipfs/iptb.git","svn_url":"https://github.com/ipfs/iptb","homepage":"","size":3322,"stargazers_count":111,"watchers_count":111,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":29,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":29,"open_issues":20,"watchers":111,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ipfs/iptb/pulls/65"},"html":{"href":"https://github.com/ipfs/iptb/pull/65"},"issue":{"href":"https://api.github.com/repos/ipfs/iptb/issues/65"},"comments":{"href":"https://api.github.com/repos/ipfs/iptb/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/ipfs/iptb/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/ipfs/iptb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ipfs/iptb/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/ipfs/iptb/statuses/f39998e8e3b0de4b9d505e9c07b5a6572dfc284b"}},"author_association":"NONE"}}
{"actor":{"display_login":"davinci26"}}