{"action":"created","comment":{"url":"https://api.github.com/repos/ARM-software/lisa/pulls/comments/167885337","pull_request_review_id":96164200,"id":167885337,"diff_hunk":"@@ -0,0 +1,129 @@\n+# SPDX-License-Identifier: Apache-2.0\n+#\n+# Copyright (C) 2015, ARM Limited and contributors.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+# not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+\n+\"\"\" SchedTune Analysis Module \"\"\"\n+\n+import matplotlib.gridspec as gridspec\n+import matplotlib.pyplot as plt\n+import numpy as np\n+import pylab as pl\n+\n+from analysis_module import AnalysisModule\n+from devlib.utils.misc import memoized\n+from trappy.utils import listify\n+\n+# Configure logging\n+import logging\n+\n+\n+class STuneAnalysis(AnalysisModule):\n+    \"\"\"\n+    Support for SchedTune signals anaysis\n+\n+    :param trace: input Trace object\n+    :type trace: :mod:`libs.utils.Trace`\n+    \"\"\"\n+\n+    def __init__(self, trace):\n+        super(STuneAnalysis, self).__init__(trace)\n+\n+###############################################################################\n+# DataFrame Getter Methods\n+###############################################################################\n+\n+    @memoized\n+    def _dfg_tasks_updates(self, cpus=None, cgroups=None):\n+        if not self._trace.hasEvents('sched_tune_tasks_update'):\n+            logging.warn('Events [sched_tune_tasks_updates] not found, '\n+                         'cannot get schedtune tasks updates!')\n+            return None\n+\n+        # Get SchedTune Accouting data\n+        df = self._dfg_trace_event('sched_tune_tasks_update')\n+\n+        # Get number of CPUs to plot\n+        if cpus:\n+            # Filter on requested CPUs\n+            cpus = listify(cpus)\n+            df = df[df.cpu.isin(cpus)]\n+\n+        # Get number of CGROUPs to plot\n+        if cgroups:\n+            # Filter on requested CGROUPs\n+            cgroups = listify(cgroups)\n+            df = df[df.idx.isin(cgroups)]\n+\n+        return df\n+\n+\n+###############################################################################\n+# Plotting Methods\n+###############################################################################\n+\n+    def plotTasksUpdate(self, cpus=None, cgroups=None, xlim=(0,None)):\n+        \"\"\" Plot SchedTune accouting on specified cpus/cgroups\n+        \"\"\"\n+\n+        if not self._trace.hasEvents('sched_tune_tasks_update'):\n+            logging.warn('Event [sched_tune_tasks_update] not found, plot DISABLED!')\n+            return\n+        df = self._dfg_tasks_updates(cpus, cgroups)\n+        if df is None:\n+            return\n+\n+        # Get number of CPUs to plot\n+        cpus = df.cpu.unique()\n+        cpus_cnt = cpus.size\n+        cpus = sorted(cpus.tolist())\n+\n+        # Ger number of CGROUPS to plot\n+        cgroups = df.idx.unique()\n+        cgroups_cnt = cgroups.size\n+        cgroups = sorted(cgroups.tolist())\n+\n+        # Get maximum number of RUNNABLE tasks in a single RQ\n+        ymax = df.tasks.max() + 1\n+\n+        logging.info(\"Plotting SchedTune Accounting [%d CGroups, %d CPUs]\",\n+                     cgroups_cnt, cpus_cnt)\n+        gs = gridspec.GridSpec(cpus_cnt, cgroups_cnt);\n+        fig = plt.figure(figsize=(6*cgroups_cnt, 3*cpus_cnt));\n+\n+        for cpu_idx, cpu in enumerate(cpus):\n+            for cg_idx, cg in enumerate(cgroups):\n+                axes = plt.subplot(gs[cpu_idx, cg_idx])\n+\n+                # Get accouting data for current CPU and CGroup\n+                data = df[(df.cpu == cpu) & (df.idx == cg)][['tasks']]\n+                if not data.empty:\n+                    data.plot(ax=axes, drawstyle='steps-post', xlim=xlim, ylim=(0, ymax))\n+\n+                axes.set_title(\"CPU_{:02d}, CGroup_{:02d}\".format(cpu, cg))","path":"libs/utils/analysis/stune_analysis.py","position":115,"original_position":115,"commit_id":"612a089cac3cc0a25bbc1bbc9eaa5ee96ea80ed3","original_commit_id":"612a089cac3cc0a25bbc1bbc9eaa5ee96ea80ed3","user":{"login":"valschneider","id":5830891,"avatar_url":"https://avatars3.githubusercontent.com/u/5830891?v=4","gravatar_id":"","url":"https://api.github.com/users/valschneider","html_url":"https://github.com/valschneider","followers_url":"https://api.github.com/users/valschneider/followers","following_url":"https://api.github.com/users/valschneider/following{/other_user}","gists_url":"https://api.github.com/users/valschneider/gists{/gist_id}","starred_url":"https://api.github.com/users/valschneider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valschneider/subscriptions","organizations_url":"https://api.github.com/users/valschneider/orgs","repos_url":"https://api.github.com/users/valschneider/repos","events_url":"https://api.github.com/users/valschneider/events{/privacy}","received_events_url":"https://api.github.com/users/valschneider/received_events","type":"User","site_admin":false},"body":"Why the formatting to 2 digits here ? Is that because of how the **sched_tune_tasks_update** event reports stuff ? If so, maybe a leading 0s-trim would suffice ?\r\n\r\nNit: I'd be more comfortable reading \"CPU2\" than \"CPU_2\"","created_at":"2018-02-13T14:46:54Z","updated_at":"2018-02-13T14:47:16Z","html_url":"https://github.com/ARM-software/lisa/pull/557#discussion_r167885337","pull_request_url":"https://api.github.com/repos/ARM-software/lisa/pulls/557","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ARM-software/lisa/pulls/comments/167885337"},"html":{"href":"https://github.com/ARM-software/lisa/pull/557#discussion_r167885337"},"pull_request":{"href":"https://api.github.com/repos/ARM-software/lisa/pulls/557"}}},"pull_request":{"url":"https://api.github.com/repos/ARM-software/lisa/pulls/557","id":168828611,"html_url":"https://github.com/ARM-software/lisa/pull/557","diff_url":"https://github.com/ARM-software/lisa/pull/557.diff","patch_url":"https://github.com/ARM-software/lisa/pull/557.patch","issue_url":"https://api.github.com/repos/ARM-software/lisa/issues/557","number":557,"state":"open","locked":false,"title":"[RFC] SchedTune Analysis","user":{"login":"derkling","id":63746,"avatar_url":"https://avatars3.githubusercontent.com/u/63746?v=4","gravatar_id":"","url":"https://api.github.com/users/derkling","html_url":"https://github.com/derkling","followers_url":"https://api.github.com/users/derkling/followers","following_url":"https://api.github.com/users/derkling/following{/other_user}","gists_url":"https://api.github.com/users/derkling/gists{/gist_id}","starred_url":"https://api.github.com/users/derkling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derkling/subscriptions","organizations_url":"https://api.github.com/users/derkling/orgs","repos_url":"https://api.github.com/users/derkling/repos","events_url":"https://api.github.com/users/derkling/events{/privacy}","received_events_url":"https://api.github.com/users/derkling/received_events","type":"User","site_admin":false},"body":"Here is the first patch of a series to add SchedTune analysis API.\r\nThis first patch introduces a new stune analysis module and a simple plot method to report tasks accounting on different CPUs and CGroups of a system.\r\n\r\nNOTE: this is given as a preview, other analysis methods will be added before merging this series.","created_at":"2018-02-13T12:12:03Z","updated_at":"2018-02-13T14:47:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0da515d745bac37be18e18b6b689bf3f4df3a48","assignee":null,"assignees":[],"requested_reviewers":[{"login":"qperret","id":19532754,"avatar_url":"https://avatars3.githubusercontent.com/u/19532754?v=4","gravatar_id":"","url":"https://api.github.com/users/qperret","html_url":"https://github.com/qperret","followers_url":"https://api.github.com/users/qperret/followers","following_url":"https://api.github.com/users/qperret/following{/other_user}","gists_url":"https://api.github.com/users/qperret/gists{/gist_id}","starred_url":"https://api.github.com/users/qperret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qperret/subscriptions","organizations_url":"https://api.github.com/users/qperret/orgs","repos_url":"https://api.github.com/users/qperret/repos","events_url":"https://api.github.com/users/qperret/events{/privacy}","received_events_url":"https://api.github.com/users/qperret/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":296402237,"url":"https://api.github.com/repos/ARM-software/lisa/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/ARM-software/lisa/pulls/557/commits","review_comments_url":"https://api.github.com/repos/ARM-software/lisa/pulls/557/comments","review_comment_url":"https://api.github.com/repos/ARM-software/lisa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARM-software/lisa/issues/557/comments","statuses_url":"https://api.github.com/repos/ARM-software/lisa/statuses/612a089cac3cc0a25bbc1bbc9eaa5ee96ea80ed3","head":{"label":"derkling:stune_accouting_plots","ref":"stune_accouting_plots","sha":"612a089cac3cc0a25bbc1bbc9eaa5ee96ea80ed3","user":{"login":"derkling","id":63746,"avatar_url":"https://avatars3.githubusercontent.com/u/63746?v=4","gravatar_id":"","url":"https://api.github.com/users/derkling","html_url":"https://github.com/derkling","followers_url":"https://api.github.com/users/derkling/followers","following_url":"https://api.github.com/users/derkling/following{/other_user}","gists_url":"https://api.github.com/users/derkling/gists{/gist_id}","starred_url":"https://api.github.com/users/derkling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derkling/subscriptions","organizations_url":"https://api.github.com/users/derkling/orgs","repos_url":"https://api.github.com/users/derkling/repos","events_url":"https://api.github.com/users/derkling/events{/privacy}","received_events_url":"https://api.github.com/users/derkling/received_events","type":"User","site_admin":false},"repo":{"id":50354980,"name":"lisa","full_name":"derkling/lisa","owner":{"login":"derkling","id":63746,"avatar_url":"https://avatars3.githubusercontent.com/u/63746?v=4","gravatar_id":"","url":"https://api.github.com/users/derkling","html_url":"https://github.com/derkling","followers_url":"https://api.github.com/users/derkling/followers","following_url":"https://api.github.com/users/derkling/following{/other_user}","gists_url":"https://api.github.com/users/derkling/gists{/gist_id}","starred_url":"https://api.github.com/users/derkling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derkling/subscriptions","organizations_url":"https://api.github.com/users/derkling/orgs","repos_url":"https://api.github.com/users/derkling/repos","events_url":"https://api.github.com/users/derkling/events{/privacy}","received_events_url":"https://api.github.com/users/derkling/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/derkling/lisa","description":"Linux Integrated System Analysis","fork":true,"url":"https://api.github.com/repos/derkling/lisa","forks_url":"https://api.github.com/repos/derkling/lisa/forks","keys_url":"https://api.github.com/repos/derkling/lisa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/derkling/lisa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/derkling/lisa/teams","hooks_url":"https://api.github.com/repos/derkling/lisa/hooks","issue_events_url":"https://api.github.com/repos/derkling/lisa/issues/events{/number}","events_url":"https://api.github.com/repos/derkling/lisa/events","assignees_url":"https://api.github.com/repos/derkling/lisa/assignees{/user}","branches_url":"https://api.github.com/repos/derkling/lisa/branches{/branch}","tags_url":"https://api.github.com/repos/derkling/lisa/tags","blobs_url":"https://api.github.com/repos/derkling/lisa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/derkling/lisa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/derkling/lisa/git/refs{/sha}","trees_url":"https://api.github.com/repos/derkling/lisa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/derkling/lisa/statuses/{sha}","languages_url":"https://api.github.com/repos/derkling/lisa/languages","stargazers_url":"https://api.github.com/repos/derkling/lisa/stargazers","contributors_url":"https://api.github.com/repos/derkling/lisa/contributors","subscribers_url":"https://api.github.com/repos/derkling/lisa/subscribers","subscription_url":"https://api.github.com/repos/derkling/lisa/subscription","commits_url":"https://api.github.com/repos/derkling/lisa/commits{/sha}","git_commits_url":"https://api.github.com/repos/derkling/lisa/git/commits{/sha}","comments_url":"https://api.github.com/repos/derkling/lisa/comments{/number}","issue_comment_url":"https://api.github.com/repos/derkling/lisa/issues/comments{/number}","contents_url":"https://api.github.com/repos/derkling/lisa/contents/{+path}","compare_url":"https://api.github.com/repos/derkling/lisa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/derkling/lisa/merges","archive_url":"https://api.github.com/repos/derkling/lisa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/derkling/lisa/downloads","issues_url":"https://api.github.com/repos/derkling/lisa/issues{/number}","pulls_url":"https://api.github.com/repos/derkling/lisa/pulls{/number}","milestones_url":"https://api.github.com/repos/derkling/lisa/milestones{/number}","notifications_url":"https://api.github.com/repos/derkling/lisa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/derkling/lisa/labels{/name}","releases_url":"https://api.github.com/repos/derkling/lisa/releases{/id}","deployments_url":"https://api.github.com/repos/derkling/lisa/deployments","created_at":"2016-01-25T14:15:56Z","updated_at":"2017-06-17T14:50:08Z","pushed_at":"2018-02-13T12:09:52Z","git_url":"git://github.com/derkling/lisa.git","ssh_url":"git@github.com:derkling/lisa.git","clone_url":"https://github.com/derkling/lisa.git","svn_url":"https://github.com/derkling/lisa","homepage":"","size":76995,"stargazers_count":2,"watchers_count":2,"language":"Jupyter Notebook","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"ARM-software:master","ref":"master","sha":"8aaa20650f15aa0a70aa0555c67f8f39abdb4e48","user":{"login":"ARM-software","id":5690313,"avatar_url":"https://avatars1.githubusercontent.com/u/5690313?v=4","gravatar_id":"","url":"https://api.github.com/users/ARM-software","html_url":"https://github.com/ARM-software","followers_url":"https://api.github.com/users/ARM-software/followers","following_url":"https://api.github.com/users/ARM-software/following{/other_user}","gists_url":"https://api.github.com/users/ARM-software/gists{/gist_id}","starred_url":"https://api.github.com/users/ARM-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARM-software/subscriptions","organizations_url":"https://api.github.com/users/ARM-software/orgs","repos_url":"https://api.github.com/users/ARM-software/repos","events_url":"https://api.github.com/users/ARM-software/events{/privacy}","received_events_url":"https://api.github.com/users/ARM-software/received_events","type":"Organization","site_admin":false},"repo":{"id":47548304,"name":"lisa","full_name":"ARM-software/lisa","owner":{"login":"ARM-software","id":5690313,"avatar_url":"https://avatars1.githubusercontent.com/u/5690313?v=4","gravatar_id":"","url":"https://api.github.com/users/ARM-software","html_url":"https://github.com/ARM-software","followers_url":"https://api.github.com/users/ARM-software/followers","following_url":"https://api.github.com/users/ARM-software/following{/other_user}","gists_url":"https://api.github.com/users/ARM-software/gists{/gist_id}","starred_url":"https://api.github.com/users/ARM-software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARM-software/subscriptions","organizations_url":"https://api.github.com/users/ARM-software/orgs","repos_url":"https://api.github.com/users/ARM-software/repos","events_url":"https://api.github.com/users/ARM-software/events{/privacy}","received_events_url":"https://api.github.com/users/ARM-software/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARM-software/lisa","description":"Linux Integrated System Analysis","fork":false,"url":"https://api.github.com/repos/ARM-software/lisa","forks_url":"https://api.github.com/repos/ARM-software/lisa/forks","keys_url":"https://api.github.com/repos/ARM-software/lisa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARM-software/lisa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARM-software/lisa/teams","hooks_url":"https://api.github.com/repos/ARM-software/lisa/hooks","issue_events_url":"https://api.github.com/repos/ARM-software/lisa/issues/events{/number}","events_url":"https://api.github.com/repos/ARM-software/lisa/events","assignees_url":"https://api.github.com/repos/ARM-software/lisa/assignees{/user}","branches_url":"https://api.github.com/repos/ARM-software/lisa/branches{/branch}","tags_url":"https://api.github.com/repos/ARM-software/lisa/tags","blobs_url":"https://api.github.com/repos/ARM-software/lisa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARM-software/lisa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARM-software/lisa/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARM-software/lisa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARM-software/lisa/statuses/{sha}","languages_url":"https://api.github.com/repos/ARM-software/lisa/languages","stargazers_url":"https://api.github.com/repos/ARM-software/lisa/stargazers","contributors_url":"https://api.github.com/repos/ARM-software/lisa/contributors","subscribers_url":"https://api.github.com/repos/ARM-software/lisa/subscribers","subscription_url":"https://api.github.com/repos/ARM-software/lisa/subscription","commits_url":"https://api.github.com/repos/ARM-software/lisa/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARM-software/lisa/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARM-software/lisa/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARM-software/lisa/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARM-software/lisa/contents/{+path}","compare_url":"https://api.github.com/repos/ARM-software/lisa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARM-software/lisa/merges","archive_url":"https://api.github.com/repos/ARM-software/lisa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARM-software/lisa/downloads","issues_url":"https://api.github.com/repos/ARM-software/lisa/issues{/number}","pulls_url":"https://api.github.com/repos/ARM-software/lisa/pulls{/number}","milestones_url":"https://api.github.com/repos/ARM-software/lisa/milestones{/number}","notifications_url":"https://api.github.com/repos/ARM-software/lisa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARM-software/lisa/labels{/name}","releases_url":"https://api.github.com/repos/ARM-software/lisa/releases{/id}","deployments_url":"https://api.github.com/repos/ARM-software/lisa/deployments","created_at":"2015-12-07T11:32:56Z","updated_at":"2018-01-27T17:45:42Z","pushed_at":"2018-02-13T12:20:19Z","git_url":"git://github.com/ARM-software/lisa.git","ssh_url":"git@github.com:ARM-software/lisa.git","clone_url":"https://github.com/ARM-software/lisa.git","svn_url":"https://github.com/ARM-software/lisa","homepage":"","size":76405,"stargazers_count":45,"watchers_count":45,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"archived":false,"open_issues_count":92,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":47,"open_issues":92,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ARM-software/lisa/pulls/557"},"html":{"href":"https://github.com/ARM-software/lisa/pull/557"},"issue":{"href":"https://api.github.com/repos/ARM-software/lisa/issues/557"},"comments":{"href":"https://api.github.com/repos/ARM-software/lisa/issues/557/comments"},"review_comments":{"href":"https://api.github.com/repos/ARM-software/lisa/pulls/557/comments"},"review_comment":{"href":"https://api.github.com/repos/ARM-software/lisa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARM-software/lisa/pulls/557/commits"},"statuses":{"href":"https://api.github.com/repos/ARM-software/lisa/statuses/612a089cac3cc0a25bbc1bbc9eaa5ee96ea80ed3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"valschneider"}}