{"action":"created","comment":{"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments/74896642","id":74896642,"diff_hunk":"@@ -0,0 +1,100 @@\n+#!/usr/bin/env python\n+#\n+# This program is free software; you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation; either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n+#\n+# See LICENSE for more details.\n+#\n+# Copyright: 2016 IBM\n+# Author:Praveen K Pandey <praveen@linux.vnet.ibm.com>\n+#\n+\n+import os\n+import shutil\n+import json\n+\n+from avocado import Test\n+from avocado import main\n+from avocado.utils import process\n+from avocado.utils.software_manager import SoftwareManager\n+\n+\n+class Tlbflush(Test):\n+\n+    \"\"\"\n+    This is a macrobenchmark for TLB flush range testing.\n+    \"\"\"\n+\n+    def setUp(self):\n+\n+        self.tlbflush_max_entries = self.params.get('entries', default=200)\n+        self.tlbflush_iteration = self.params.get('iterations', default=50)\n+        self.nr_threads = self.params.get('nr_threads', default=50)\n+\n+        # Check for basic utilities\n+\n+        smm = SoftwareManager()\n+\n+        if not smm.check_installed(\"gcc\") and not smm.install(\"gcc\"):\n+            self.error(\n+                \"Fail to install %s required for this test.\" % package)\n+\n+        data_dir = os.path.abspath(self.datadir)\n+\n+        shutil.copyfile(os.path.join(data_dir, 'tlbflush.c'),\n+                        os.path.join(self.srcdir, 'tlbflush.c'))\n+\n+        os.chdir(self.srcdir)\n+        os.system('cp tlbflush.c /root/pp/tlbflush.c')\n+        tlbflush_patch = 'patch -p1 < %s' % (\n+            os.path.join(data_dir, 'tlbflush.patch'))\n+\n+        process.run(tlbflush_patch, shell=True)\n+        cmd = 'gcc -DFILE_SIZE=$((128*1048576)) -g -O2 tlbflush.c \\\n+               -lpthread -o tlbflush'\n+        process.run(cmd, shell=True)\n+\n+    def set_value(self):\n+\n+        self.perf_json = [{}]\n+        self.nr_entries = 100\n+\n+        for ite in range(1, self.tlbflush_iteration):\n+            # Select a range of entries to randomly select from.\n+            # This is to ensure an evenish spread of entries to\n+            # be tested\n+\n+            nr_section = ite % 8\n+            ranges = self.tlbflush_max_entries / 8\n+            min_entries = ranges * nr_section + 1\n+            max_entries = min_entries + ranges\n+            if self.nr_entries > max_entries:\n+                self.nr_entries = max_entries\n+\n+            out = self.run()\n+            self.perf_json.append({'Test time' + str(ite): out})\n+\n+        output_path = os.path.join(self.outputdir, \"perf.json\")\n+        json.dump(self.perf_json, open(output_path, \"w\"))\n+\n+    def run(self):\n+        out = process.system_output('%s ' % os.path.join(\n+            self.srcdir, 'tlbflush'), '-n ' + str(self.nr_entries) +\n+            ' -t' + str(self.nr_threads))","path":"kernel/tlbflush.py","position":89,"original_position":89,"commit_id":"e8d31c9493c5ee90cadf5157c3840c7da314304b","original_commit_id":"e8d31c9493c5ee90cadf5157c3840c7da314304b","user":{"login":"apahim","id":4717757,"avatar_url":"https://avatars.githubusercontent.com/u/4717757?v=3","gravatar_id":"","url":"https://api.github.com/users/apahim","html_url":"https://github.com/apahim","followers_url":"https://api.github.com/users/apahim/followers","following_url":"https://api.github.com/users/apahim/following{/other_user}","gists_url":"https://api.github.com/users/apahim/gists{/gist_id}","starred_url":"https://api.github.com/users/apahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apahim/subscriptions","organizations_url":"https://api.github.com/users/apahim/orgs","repos_url":"https://api.github.com/users/apahim/repos","events_url":"https://api.github.com/users/apahim/events{/privacy}","received_events_url":"https://api.github.com/users/apahim/received_events","type":"User","site_admin":false},"body":"This line is a little confuse, with `%s` and `+`, `join()`... could you make it easier to read? Something like:\r\n```python\r\ndef run(self):\r\n    tlbflush = os.path.join(self.srcdir, 'tlbflush')\r\n    cmd = '%s -n %s -t %s' % (tlbflush, self.nr_entries, self.nr_threads)\r\n    return process.system_output(cmd)\r\n```\r\nOther than that, looks good.","created_at":"2016-08-16T08:44:58Z","updated_at":"2016-08-16T08:44:58Z","html_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/137#discussion_r74896642","pull_request_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137","_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments/74896642"},"html":{"href":"https://github.com/avocado-framework/avocado-misc-tests/pull/137#discussion_r74896642"},"pull_request":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137"}}},"pull_request":{"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137","id":81246729,"html_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/137","diff_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/137.diff","patch_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/137.patch","issue_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/137","number":137,"state":"open","locked":false,"title":"Added tlbflush test in avocado","user":{"login":"PraveenPenguin","id":11898572,"avatar_url":"https://avatars.githubusercontent.com/u/11898572?v=3","gravatar_id":"","url":"https://api.github.com/users/PraveenPenguin","html_url":"https://github.com/PraveenPenguin","followers_url":"https://api.github.com/users/PraveenPenguin/followers","following_url":"https://api.github.com/users/PraveenPenguin/following{/other_user}","gists_url":"https://api.github.com/users/PraveenPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/PraveenPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PraveenPenguin/subscriptions","organizations_url":"https://api.github.com/users/PraveenPenguin/orgs","repos_url":"https://api.github.com/users/PraveenPenguin/repos","events_url":"https://api.github.com/users/PraveenPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/PraveenPenguin/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Praveen K Pandey <praveen@linux.vnet.ibm.com>\r\nAdded tlbflush test","created_at":"2016-08-14T15:38:19Z","updated_at":"2016-08-16T08:44:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f12a3859703387e40c16c0ca266cda624d97159","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137/commits","review_comments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137/comments","review_comment_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/137/comments","statuses_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/e8d31c9493c5ee90cadf5157c3840c7da314304b","head":{"label":"PraveenPenguin:tlbflush","ref":"tlbflush","sha":"e8d31c9493c5ee90cadf5157c3840c7da314304b","user":{"login":"PraveenPenguin","id":11898572,"avatar_url":"https://avatars.githubusercontent.com/u/11898572?v=3","gravatar_id":"","url":"https://api.github.com/users/PraveenPenguin","html_url":"https://github.com/PraveenPenguin","followers_url":"https://api.github.com/users/PraveenPenguin/followers","following_url":"https://api.github.com/users/PraveenPenguin/following{/other_user}","gists_url":"https://api.github.com/users/PraveenPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/PraveenPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PraveenPenguin/subscriptions","organizations_url":"https://api.github.com/users/PraveenPenguin/orgs","repos_url":"https://api.github.com/users/PraveenPenguin/repos","events_url":"https://api.github.com/users/PraveenPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/PraveenPenguin/received_events","type":"User","site_admin":false},"repo":{"id":60331734,"name":"avocado-misc-tests","full_name":"PraveenPenguin/avocado-misc-tests","owner":{"login":"PraveenPenguin","id":11898572,"avatar_url":"https://avatars.githubusercontent.com/u/11898572?v=3","gravatar_id":"","url":"https://api.github.com/users/PraveenPenguin","html_url":"https://github.com/PraveenPenguin","followers_url":"https://api.github.com/users/PraveenPenguin/followers","following_url":"https://api.github.com/users/PraveenPenguin/following{/other_user}","gists_url":"https://api.github.com/users/PraveenPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/PraveenPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PraveenPenguin/subscriptions","organizations_url":"https://api.github.com/users/PraveenPenguin/orgs","repos_url":"https://api.github.com/users/PraveenPenguin/repos","events_url":"https://api.github.com/users/PraveenPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/PraveenPenguin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PraveenPenguin/avocado-misc-tests","description":"Avocado tests repository","fork":true,"url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests","forks_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/forks","keys_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/teams","hooks_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/hooks","issue_events_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/issues/events{/number}","events_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/events","assignees_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/assignees{/user}","branches_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/branches{/branch}","tags_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/tags","blobs_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/languages","stargazers_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/stargazers","contributors_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/contributors","subscribers_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/subscribers","subscription_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/subscription","commits_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/contents/{+path}","compare_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/merges","archive_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/downloads","issues_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/issues{/number}","pulls_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/labels{/name}","releases_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/releases{/id}","deployments_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/deployments","created_at":"2016-06-03T08:30:55Z","updated_at":"2016-06-03T08:30:56Z","pushed_at":"2016-08-14T15:33:58Z","git_url":"git://github.com/PraveenPenguin/avocado-misc-tests.git","ssh_url":"git@github.com:PraveenPenguin/avocado-misc-tests.git","clone_url":"https://github.com/PraveenPenguin/avocado-misc-tests.git","svn_url":"https://github.com/PraveenPenguin/avocado-misc-tests","homepage":null,"size":1469,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"avocado-framework:master","ref":"master","sha":"6c90bd974929e832e1928bab1b8feee340e80efb","user":{"login":"avocado-framework","id":7245719,"avatar_url":"https://avatars.githubusercontent.com/u/7245719?v=3","gravatar_id":"","url":"https://api.github.com/users/avocado-framework","html_url":"https://github.com/avocado-framework","followers_url":"https://api.github.com/users/avocado-framework/followers","following_url":"https://api.github.com/users/avocado-framework/following{/other_user}","gists_url":"https://api.github.com/users/avocado-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/avocado-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avocado-framework/subscriptions","organizations_url":"https://api.github.com/users/avocado-framework/orgs","repos_url":"https://api.github.com/users/avocado-framework/repos","events_url":"https://api.github.com/users/avocado-framework/events{/privacy}","received_events_url":"https://api.github.com/users/avocado-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":49900980,"name":"avocado-misc-tests","full_name":"avocado-framework/avocado-misc-tests","owner":{"login":"avocado-framework","id":7245719,"avatar_url":"https://avatars.githubusercontent.com/u/7245719?v=3","gravatar_id":"","url":"https://api.github.com/users/avocado-framework","html_url":"https://github.com/avocado-framework","followers_url":"https://api.github.com/users/avocado-framework/followers","following_url":"https://api.github.com/users/avocado-framework/following{/other_user}","gists_url":"https://api.github.com/users/avocado-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/avocado-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avocado-framework/subscriptions","organizations_url":"https://api.github.com/users/avocado-framework/orgs","repos_url":"https://api.github.com/users/avocado-framework/repos","events_url":"https://api.github.com/users/avocado-framework/events{/privacy}","received_events_url":"https://api.github.com/users/avocado-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/avocado-framework/avocado-misc-tests","description":"Avocado tests repository","fork":false,"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests","forks_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/forks","keys_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/teams","hooks_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/hooks","issue_events_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/events{/number}","events_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/events","assignees_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/assignees{/user}","branches_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/branches{/branch}","tags_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/tags","blobs_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/languages","stargazers_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/stargazers","contributors_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/contributors","subscribers_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/subscribers","subscription_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/subscription","commits_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/contents/{+path}","compare_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/merges","archive_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/downloads","issues_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues{/number}","pulls_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/labels{/name}","releases_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/releases{/id}","deployments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/deployments","created_at":"2016-01-18T19:48:34Z","updated_at":"2016-07-22T14:49:34Z","pushed_at":"2016-08-16T08:38:43Z","git_url":"git://github.com/avocado-framework/avocado-misc-tests.git","ssh_url":"git@github.com:avocado-framework/avocado-misc-tests.git","clone_url":"https://github.com/avocado-framework/avocado-misc-tests.git","svn_url":"https://github.com/avocado-framework/avocado-misc-tests","homepage":null,"size":1598,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":17,"forks":20,"open_issues":17,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137"},"html":{"href":"https://github.com/avocado-framework/avocado-misc-tests/pull/137"},"issue":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/137"},"comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/137/comments"},"review_comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137/comments"},"review_comment":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/137/commits"},"statuses":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/e8d31c9493c5ee90cadf5157c3840c7da314304b"}}}}
{"actor":{"display_login":"apahim"}}