diff options
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
-rwxr-xr-x | tools/perf/scripts/python/exported-sql-viewer.py | 69 |
1 files changed, 56 insertions, 13 deletions
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py index f5b1b63995b0..94489cf2ce0e 100755 --- a/tools/perf/scripts/python/exported-sql-viewer.py +++ b/tools/perf/scripts/python/exported-sql-viewer.py | |||
@@ -781,11 +781,13 @@ class CallGraphModel(CallGraphModelBase): | |||
781 | 781 | ||
782 | class CallTreeLevelTwoPlusItemBase(CallGraphLevelItemBase): | 782 | class CallTreeLevelTwoPlusItemBase(CallGraphLevelItemBase): |
783 | 783 | ||
784 | def __init__(self, glb, params, row, comm_id, thread_id, calls_id, time, branch_count, parent_item): | 784 | def __init__(self, glb, params, row, comm_id, thread_id, calls_id, time, insn_cnt, cyc_cnt, branch_count, parent_item): |
785 | super(CallTreeLevelTwoPlusItemBase, self).__init__(glb, params, row, parent_item) | 785 | super(CallTreeLevelTwoPlusItemBase, self).__init__(glb, params, row, parent_item) |
786 | self.comm_id = comm_id | 786 | self.comm_id = comm_id |
787 | self.thread_id = thread_id | 787 | self.thread_id = thread_id |
788 | self.calls_id = calls_id | 788 | self.calls_id = calls_id |
789 | self.insn_cnt = insn_cnt | ||
790 | self.cyc_cnt = cyc_cnt | ||
789 | self.branch_count = branch_count | 791 | self.branch_count = branch_count |
790 | self.time = time | 792 | self.time = time |
791 | 793 | ||
@@ -795,8 +797,12 @@ class CallTreeLevelTwoPlusItemBase(CallGraphLevelItemBase): | |||
795 | comm_thread = " AND comm_id = " + str(self.comm_id) + " AND thread_id = " + str(self.thread_id) | 797 | comm_thread = " AND comm_id = " + str(self.comm_id) + " AND thread_id = " + str(self.thread_id) |
796 | else: | 798 | else: |
797 | comm_thread = "" | 799 | comm_thread = "" |
800 | if self.params.have_ipc: | ||
801 | ipc_str = ", insn_count, cyc_count" | ||
802 | else: | ||
803 | ipc_str = "" | ||
798 | query = QSqlQuery(self.glb.db) | 804 | query = QSqlQuery(self.glb.db) |
799 | QueryExec(query, "SELECT calls.id, name, short_name, call_time, return_time - call_time, branch_count" | 805 | QueryExec(query, "SELECT calls.id, name, short_name, call_time, return_time - call_time" + ipc_str + ", branch_count" |
800 | " FROM calls" | 806 | " FROM calls" |
801 | " INNER JOIN call_paths ON calls.call_path_id = call_paths.id" | 807 | " INNER JOIN call_paths ON calls.call_path_id = call_paths.id" |
802 | " INNER JOIN symbols ON call_paths.symbol_id = symbols.id" | 808 | " INNER JOIN symbols ON call_paths.symbol_id = symbols.id" |
@@ -804,7 +810,15 @@ class CallTreeLevelTwoPlusItemBase(CallGraphLevelItemBase): | |||
804 | " WHERE calls.parent_id = " + str(self.calls_id) + comm_thread + | 810 | " WHERE calls.parent_id = " + str(self.calls_id) + comm_thread + |
805 | " ORDER BY call_time, calls.id") | 811 | " ORDER BY call_time, calls.id") |
806 | while query.next(): | 812 | while query.next(): |
807 | child_item = CallTreeLevelThreeItem(self.glb, self.params, self.child_count, self.comm_id, self.thread_id, query.value(0), query.value(1), query.value(2), query.value(3), int(query.value(4)), int(query.value(5)), self) | 813 | if self.params.have_ipc: |
814 | insn_cnt = int(query.value(5)) | ||
815 | cyc_cnt = int(query.value(6)) | ||
816 | branch_count = int(query.value(7)) | ||
817 | else: | ||
818 | insn_cnt = 0 | ||
819 | cyc_cnt = 0 | ||
820 | branch_count = int(query.value(5)) | ||
821 | child_item = CallTreeLevelThreeItem(self.glb, self.params, self.child_count, self.comm_id, self.thread_id, query.value(0), query.value(1), query.value(2), query.value(3), int(query.value(4)), insn_cnt, cyc_cnt, branch_count, self) | ||
808 | self.child_items.append(child_item) | 822 | self.child_items.append(child_item) |
809 | self.child_count += 1 | 823 | self.child_count += 1 |
810 | 824 | ||
@@ -812,10 +826,17 @@ class CallTreeLevelTwoPlusItemBase(CallGraphLevelItemBase): | |||
812 | 826 | ||
813 | class CallTreeLevelThreeItem(CallTreeLevelTwoPlusItemBase): | 827 | class CallTreeLevelThreeItem(CallTreeLevelTwoPlusItemBase): |
814 | 828 | ||
815 | def __init__(self, glb, params, row, comm_id, thread_id, calls_id, name, dso, count, time, branch_count, parent_item): | 829 | def __init__(self, glb, params, row, comm_id, thread_id, calls_id, name, dso, count, time, insn_cnt, cyc_cnt, branch_count, parent_item): |
816 | super(CallTreeLevelThreeItem, self).__init__(glb, params, row, comm_id, thread_id, calls_id, time, branch_count, parent_item) | 830 | super(CallTreeLevelThreeItem, self).__init__(glb, params, row, comm_id, thread_id, calls_id, time, insn_cnt, cyc_cnt, branch_count, parent_item) |
817 | dso = dsoname(dso) | 831 | dso = dsoname(dso) |
818 | self.data = [ name, dso, str(count), str(time), PercentToOneDP(time, parent_item.time), str(branch_count), PercentToOneDP(branch_count, parent_item.branch_count) ] | 832 | if self.params.have_ipc: |
833 | insn_pcnt = PercentToOneDP(insn_cnt, parent_item.insn_cnt) | ||
834 | cyc_pcnt = PercentToOneDP(cyc_cnt, parent_item.cyc_cnt) | ||
835 | br_pcnt = PercentToOneDP(branch_count, parent_item.branch_count) | ||
836 | ipc = CalcIPC(cyc_cnt, insn_cnt) | ||
837 | self.data = [ name, dso, str(count), str(time), PercentToOneDP(time, parent_item.time), str(insn_cnt), insn_pcnt, str(cyc_cnt), cyc_pcnt, ipc, str(branch_count), br_pcnt ] | ||
838 | else: | ||
839 | self.data = [ name, dso, str(count), str(time), PercentToOneDP(time, parent_item.time), str(branch_count), PercentToOneDP(branch_count, parent_item.branch_count) ] | ||
819 | self.dbid = calls_id | 840 | self.dbid = calls_id |
820 | 841 | ||
821 | # Call tree data model level two item | 842 | # Call tree data model level two item |
@@ -823,18 +844,28 @@ class CallTreeLevelThreeItem(CallTreeLevelTwoPlusItemBase): | |||
823 | class CallTreeLevelTwoItem(CallTreeLevelTwoPlusItemBase): | 844 | class CallTreeLevelTwoItem(CallTreeLevelTwoPlusItemBase): |
824 | 845 | ||
825 | def __init__(self, glb, params, row, comm_id, thread_id, pid, tid, parent_item): | 846 | def __init__(self, glb, params, row, comm_id, thread_id, pid, tid, parent_item): |
826 | super(CallTreeLevelTwoItem, self).__init__(glb, params, row, comm_id, thread_id, 0, 0, 0, parent_item) | 847 | super(CallTreeLevelTwoItem, self).__init__(glb, params, row, comm_id, thread_id, 0, 0, 0, 0, 0, parent_item) |
827 | self.data = [str(pid) + ":" + str(tid), "", "", "", "", "", ""] | 848 | if self.params.have_ipc: |
849 | self.data = [str(pid) + ":" + str(tid), "", "", "", "", "", "", "", "", "", "", ""] | ||
850 | else: | ||
851 | self.data = [str(pid) + ":" + str(tid), "", "", "", "", "", ""] | ||
828 | self.dbid = thread_id | 852 | self.dbid = thread_id |
829 | 853 | ||
830 | def Select(self): | 854 | def Select(self): |
831 | super(CallTreeLevelTwoItem, self).Select() | 855 | super(CallTreeLevelTwoItem, self).Select() |
832 | for child_item in self.child_items: | 856 | for child_item in self.child_items: |
833 | self.time += child_item.time | 857 | self.time += child_item.time |
858 | self.insn_cnt += child_item.insn_cnt | ||
859 | self.cyc_cnt += child_item.cyc_cnt | ||
834 | self.branch_count += child_item.branch_count | 860 | self.branch_count += child_item.branch_count |
835 | for child_item in self.child_items: | 861 | for child_item in self.child_items: |
836 | child_item.data[4] = PercentToOneDP(child_item.time, self.time) | 862 | child_item.data[4] = PercentToOneDP(child_item.time, self.time) |
837 | child_item.data[6] = PercentToOneDP(child_item.branch_count, self.branch_count) | 863 | if self.params.have_ipc: |
864 | child_item.data[6] = PercentToOneDP(child_item.insn_cnt, self.insn_cnt) | ||
865 | child_item.data[8] = PercentToOneDP(child_item.cyc_cnt, self.cyc_cnt) | ||
866 | child_item.data[11] = PercentToOneDP(child_item.branch_count, self.branch_count) | ||
867 | else: | ||
868 | child_item.data[6] = PercentToOneDP(child_item.branch_count, self.branch_count) | ||
838 | 869 | ||
839 | # Call tree data model level one item | 870 | # Call tree data model level one item |
840 | 871 | ||
@@ -842,7 +873,10 @@ class CallTreeLevelOneItem(CallGraphLevelItemBase): | |||
842 | 873 | ||
843 | def __init__(self, glb, params, row, comm_id, comm, parent_item): | 874 | def __init__(self, glb, params, row, comm_id, comm, parent_item): |
844 | super(CallTreeLevelOneItem, self).__init__(glb, params, row, parent_item) | 875 | super(CallTreeLevelOneItem, self).__init__(glb, params, row, parent_item) |
845 | self.data = [comm, "", "", "", "", "", ""] | 876 | if self.params.have_ipc: |
877 | self.data = [comm, "", "", "", "", "", "", "", "", "", "", ""] | ||
878 | else: | ||
879 | self.data = [comm, "", "", "", "", "", ""] | ||
846 | self.dbid = comm_id | 880 | self.dbid = comm_id |
847 | 881 | ||
848 | def Select(self): | 882 | def Select(self): |
@@ -885,14 +919,23 @@ class CallTreeModel(CallGraphModelBase): | |||
885 | return CallTreeRootItem(self.glb, self.params) | 919 | return CallTreeRootItem(self.glb, self.params) |
886 | 920 | ||
887 | def columnCount(self, parent=None): | 921 | def columnCount(self, parent=None): |
888 | return 7 | 922 | if self.params.have_ipc: |
923 | return 12 | ||
924 | else: | ||
925 | return 7 | ||
889 | 926 | ||
890 | def columnHeader(self, column): | 927 | def columnHeader(self, column): |
891 | headers = ["Call Path", "Object", "Call Time", "Time (ns) ", "Time (%) ", "Branch Count ", "Branch Count (%) "] | 928 | if self.params.have_ipc: |
929 | headers = ["Call Path", "Object", "Call Time", "Time (ns) ", "Time (%) ", "Insn Cnt", "Insn Cnt (%)", "Cyc Cnt", "Cyc Cnt (%)", "IPC", "Branch Count ", "Branch Count (%) "] | ||
930 | else: | ||
931 | headers = ["Call Path", "Object", "Call Time", "Time (ns) ", "Time (%) ", "Branch Count ", "Branch Count (%) "] | ||
892 | return headers[column] | 932 | return headers[column] |
893 | 933 | ||
894 | def columnAlignment(self, column): | 934 | def columnAlignment(self, column): |
895 | alignment = [ Qt.AlignLeft, Qt.AlignLeft, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight ] | 935 | if self.params.have_ipc: |
936 | alignment = [ Qt.AlignLeft, Qt.AlignLeft, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight ] | ||
937 | else: | ||
938 | alignment = [ Qt.AlignLeft, Qt.AlignLeft, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight ] | ||
896 | return alignment[column] | 939 | return alignment[column] |
897 | 940 | ||
898 | def DoFindSelect(self, query, match): | 941 | def DoFindSelect(self, query, match): |