~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/scripts/python/powerpc-hcalls.py

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/scripts/python/powerpc-hcalls.py (Architecture alpha) and /tools/perf/scripts/python/powerpc-hcalls.py (Architecture mips)


  1 # SPDX-License-Identifier: GPL-2.0+                 1 # SPDX-License-Identifier: GPL-2.0+
  2 #                                                   2 #
  3 # Copyright (C) 2018 Ravi Bangoria, IBM Corpor      3 # Copyright (C) 2018 Ravi Bangoria, IBM Corporation
  4 #                                                   4 #
  5 # Hypervisor call statisics                         5 # Hypervisor call statisics
  6                                                     6 
  7 from __future__ import print_function               7 from __future__ import print_function
  8                                                     8 
  9 import os                                           9 import os
 10 import sys                                         10 import sys
 11                                                    11 
 12 sys.path.append(os.environ['PERF_EXEC_PATH'] +     12 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 13         '/scripts/python/Perf-Trace-Util/lib/P     13         '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
 14                                                    14 
 15 from perf_trace_context import *                   15 from perf_trace_context import *
 16 from Core import *                                 16 from Core import *
 17 from Util import *                                 17 from Util import *
 18                                                    18 
 19 # output: {                                        19 # output: {
 20 #       opcode: {                                  20 #       opcode: {
 21 #               'min': minimum time nsec           21 #               'min': minimum time nsec
 22 #               'max': maximum time nsec           22 #               'max': maximum time nsec
 23 #               'time': average time nsec          23 #               'time': average time nsec
 24 #               'cnt': counter                     24 #               'cnt': counter
 25 #       } ...                                      25 #       } ...
 26 # }                                                26 # }
 27 output = {}                                        27 output = {}
 28                                                    28 
 29 # d_enter: {                                       29 # d_enter: {
 30 #       cpu: {                                     30 #       cpu: {
 31 #               opcode: nsec                       31 #               opcode: nsec
 32 #       } ...                                      32 #       } ...
 33 # }                                                33 # }
 34 d_enter = {}                                       34 d_enter = {}
 35                                                    35 
 36 hcall_table = {                                    36 hcall_table = {
 37         4: 'H_REMOVE',                             37         4: 'H_REMOVE',
 38         8: 'H_ENTER',                              38         8: 'H_ENTER',
 39         12: 'H_READ',                              39         12: 'H_READ',
 40         16: 'H_CLEAR_MOD',                         40         16: 'H_CLEAR_MOD',
 41         20: 'H_CLEAR_REF',                         41         20: 'H_CLEAR_REF',
 42         24: 'H_PROTECT',                           42         24: 'H_PROTECT',
 43         28: 'H_GET_TCE',                           43         28: 'H_GET_TCE',
 44         32: 'H_PUT_TCE',                           44         32: 'H_PUT_TCE',
 45         36: 'H_SET_SPRG0',                         45         36: 'H_SET_SPRG0',
 46         40: 'H_SET_DABR',                          46         40: 'H_SET_DABR',
 47         44: 'H_PAGE_INIT',                         47         44: 'H_PAGE_INIT',
 48         48: 'H_SET_ASR',                           48         48: 'H_SET_ASR',
 49         52: 'H_ASR_ON',                            49         52: 'H_ASR_ON',
 50         56: 'H_ASR_OFF',                           50         56: 'H_ASR_OFF',
 51         60: 'H_LOGICAL_CI_LOAD',                   51         60: 'H_LOGICAL_CI_LOAD',
 52         64: 'H_LOGICAL_CI_STORE',                  52         64: 'H_LOGICAL_CI_STORE',
 53         68: 'H_LOGICAL_CACHE_LOAD',                53         68: 'H_LOGICAL_CACHE_LOAD',
 54         72: 'H_LOGICAL_CACHE_STORE',               54         72: 'H_LOGICAL_CACHE_STORE',
 55         76: 'H_LOGICAL_ICBI',                      55         76: 'H_LOGICAL_ICBI',
 56         80: 'H_LOGICAL_DCBF',                      56         80: 'H_LOGICAL_DCBF',
 57         84: 'H_GET_TERM_CHAR',                     57         84: 'H_GET_TERM_CHAR',
 58         88: 'H_PUT_TERM_CHAR',                     58         88: 'H_PUT_TERM_CHAR',
 59         92: 'H_REAL_TO_LOGICAL',                   59         92: 'H_REAL_TO_LOGICAL',
 60         96: 'H_HYPERVISOR_DATA',                   60         96: 'H_HYPERVISOR_DATA',
 61         100: 'H_EOI',                              61         100: 'H_EOI',
 62         104: 'H_CPPR',                             62         104: 'H_CPPR',
 63         108: 'H_IPI',                              63         108: 'H_IPI',
 64         112: 'H_IPOLL',                            64         112: 'H_IPOLL',
 65         116: 'H_XIRR',                             65         116: 'H_XIRR',
 66         120: 'H_MIGRATE_DMA',                      66         120: 'H_MIGRATE_DMA',
 67         124: 'H_PERFMON',                          67         124: 'H_PERFMON',
 68         220: 'H_REGISTER_VPA',                     68         220: 'H_REGISTER_VPA',
 69         224: 'H_CEDE',                             69         224: 'H_CEDE',
 70         228: 'H_CONFER',                           70         228: 'H_CONFER',
 71         232: 'H_PROD',                             71         232: 'H_PROD',
 72         236: 'H_GET_PPP',                          72         236: 'H_GET_PPP',
 73         240: 'H_SET_PPP',                          73         240: 'H_SET_PPP',
 74         244: 'H_PURR',                             74         244: 'H_PURR',
 75         248: 'H_PIC',                              75         248: 'H_PIC',
 76         252: 'H_REG_CRQ',                          76         252: 'H_REG_CRQ',
 77         256: 'H_FREE_CRQ',                         77         256: 'H_FREE_CRQ',
 78         260: 'H_VIO_SIGNAL',                       78         260: 'H_VIO_SIGNAL',
 79         264: 'H_SEND_CRQ',                         79         264: 'H_SEND_CRQ',
 80         272: 'H_COPY_RDMA',                        80         272: 'H_COPY_RDMA',
 81         276: 'H_REGISTER_LOGICAL_LAN',             81         276: 'H_REGISTER_LOGICAL_LAN',
 82         280: 'H_FREE_LOGICAL_LAN',                 82         280: 'H_FREE_LOGICAL_LAN',
 83         284: 'H_ADD_LOGICAL_LAN_BUFFER',           83         284: 'H_ADD_LOGICAL_LAN_BUFFER',
 84         288: 'H_SEND_LOGICAL_LAN',                 84         288: 'H_SEND_LOGICAL_LAN',
 85         292: 'H_BULK_REMOVE',                      85         292: 'H_BULK_REMOVE',
 86         304: 'H_MULTICAST_CTRL',                   86         304: 'H_MULTICAST_CTRL',
 87         308: 'H_SET_XDABR',                        87         308: 'H_SET_XDABR',
 88         312: 'H_STUFF_TCE',                        88         312: 'H_STUFF_TCE',
 89         316: 'H_PUT_TCE_INDIRECT',                 89         316: 'H_PUT_TCE_INDIRECT',
 90         332: 'H_CHANGE_LOGICAL_LAN_MAC',           90         332: 'H_CHANGE_LOGICAL_LAN_MAC',
 91         336: 'H_VTERM_PARTNER_INFO',               91         336: 'H_VTERM_PARTNER_INFO',
 92         340: 'H_REGISTER_VTERM',                   92         340: 'H_REGISTER_VTERM',
 93         344: 'H_FREE_VTERM',                       93         344: 'H_FREE_VTERM',
 94         348: 'H_RESET_EVENTS',                     94         348: 'H_RESET_EVENTS',
 95         352: 'H_ALLOC_RESOURCE',                   95         352: 'H_ALLOC_RESOURCE',
 96         356: 'H_FREE_RESOURCE',                    96         356: 'H_FREE_RESOURCE',
 97         360: 'H_MODIFY_QP',                        97         360: 'H_MODIFY_QP',
 98         364: 'H_QUERY_QP',                         98         364: 'H_QUERY_QP',
 99         368: 'H_REREGISTER_PMR',                   99         368: 'H_REREGISTER_PMR',
100         372: 'H_REGISTER_SMR',                    100         372: 'H_REGISTER_SMR',
101         376: 'H_QUERY_MR',                        101         376: 'H_QUERY_MR',
102         380: 'H_QUERY_MW',                        102         380: 'H_QUERY_MW',
103         384: 'H_QUERY_HCA',                       103         384: 'H_QUERY_HCA',
104         388: 'H_QUERY_PORT',                      104         388: 'H_QUERY_PORT',
105         392: 'H_MODIFY_PORT',                     105         392: 'H_MODIFY_PORT',
106         396: 'H_DEFINE_AQP1',                     106         396: 'H_DEFINE_AQP1',
107         400: 'H_GET_TRACE_BUFFER',                107         400: 'H_GET_TRACE_BUFFER',
108         404: 'H_DEFINE_AQP0',                     108         404: 'H_DEFINE_AQP0',
109         408: 'H_RESIZE_MR',                       109         408: 'H_RESIZE_MR',
110         412: 'H_ATTACH_MCQP',                     110         412: 'H_ATTACH_MCQP',
111         416: 'H_DETACH_MCQP',                     111         416: 'H_DETACH_MCQP',
112         420: 'H_CREATE_RPT',                      112         420: 'H_CREATE_RPT',
113         424: 'H_REMOVE_RPT',                      113         424: 'H_REMOVE_RPT',
114         428: 'H_REGISTER_RPAGES',                 114         428: 'H_REGISTER_RPAGES',
115         432: 'H_DISABLE_AND_GETC',                115         432: 'H_DISABLE_AND_GETC',
116         436: 'H_ERROR_DATA',                      116         436: 'H_ERROR_DATA',
117         440: 'H_GET_HCA_INFO',                    117         440: 'H_GET_HCA_INFO',
118         444: 'H_GET_PERF_COUNT',                  118         444: 'H_GET_PERF_COUNT',
119         448: 'H_MANAGE_TRACE',                    119         448: 'H_MANAGE_TRACE',
120         468: 'H_FREE_LOGICAL_LAN_BUFFER',         120         468: 'H_FREE_LOGICAL_LAN_BUFFER',
121         472: 'H_POLL_PENDING',                    121         472: 'H_POLL_PENDING',
122         484: 'H_QUERY_INT_STATE',                 122         484: 'H_QUERY_INT_STATE',
123         580: 'H_ILLAN_ATTRIBUTES',                123         580: 'H_ILLAN_ATTRIBUTES',
124         592: 'H_MODIFY_HEA_QP',                   124         592: 'H_MODIFY_HEA_QP',
125         596: 'H_QUERY_HEA_QP',                    125         596: 'H_QUERY_HEA_QP',
126         600: 'H_QUERY_HEA',                       126         600: 'H_QUERY_HEA',
127         604: 'H_QUERY_HEA_PORT',                  127         604: 'H_QUERY_HEA_PORT',
128         608: 'H_MODIFY_HEA_PORT',                 128         608: 'H_MODIFY_HEA_PORT',
129         612: 'H_REG_BCMC',                        129         612: 'H_REG_BCMC',
130         616: 'H_DEREG_BCMC',                      130         616: 'H_DEREG_BCMC',
131         620: 'H_REGISTER_HEA_RPAGES',             131         620: 'H_REGISTER_HEA_RPAGES',
132         624: 'H_DISABLE_AND_GET_HEA',             132         624: 'H_DISABLE_AND_GET_HEA',
133         628: 'H_GET_HEA_INFO',                    133         628: 'H_GET_HEA_INFO',
134         632: 'H_ALLOC_HEA_RESOURCE',              134         632: 'H_ALLOC_HEA_RESOURCE',
135         644: 'H_ADD_CONN',                        135         644: 'H_ADD_CONN',
136         648: 'H_DEL_CONN',                        136         648: 'H_DEL_CONN',
137         664: 'H_JOIN',                            137         664: 'H_JOIN',
138         676: 'H_VASI_STATE',                      138         676: 'H_VASI_STATE',
139         688: 'H_ENABLE_CRQ',                      139         688: 'H_ENABLE_CRQ',
140         696: 'H_GET_EM_PARMS',                    140         696: 'H_GET_EM_PARMS',
141         720: 'H_SET_MPP',                         141         720: 'H_SET_MPP',
142         724: 'H_GET_MPP',                         142         724: 'H_GET_MPP',
143         748: 'H_HOME_NODE_ASSOCIATIVITY',         143         748: 'H_HOME_NODE_ASSOCIATIVITY',
144         756: 'H_BEST_ENERGY',                     144         756: 'H_BEST_ENERGY',
145         764: 'H_XIRR_X',                          145         764: 'H_XIRR_X',
146         768: 'H_RANDOM',                          146         768: 'H_RANDOM',
147         772: 'H_COP',                             147         772: 'H_COP',
148         788: 'H_GET_MPP_X',                       148         788: 'H_GET_MPP_X',
149         796: 'H_SET_MODE',                        149         796: 'H_SET_MODE',
150         61440: 'H_RTAS',                          150         61440: 'H_RTAS',
151 }                                                 151 }
152                                                   152 
153 def hcall_table_lookup(opcode):                   153 def hcall_table_lookup(opcode):
154         if (opcode in hcall_table):               154         if (opcode in hcall_table):
155                 return hcall_table[opcode]        155                 return hcall_table[opcode]
156         else:                                     156         else:
157                 return opcode                     157                 return opcode
158                                                   158 
159 print_ptrn = '%-28s%10s%10s%10s%10s'              159 print_ptrn = '%-28s%10s%10s%10s%10s'
160                                                   160 
161 def trace_end():                                  161 def trace_end():
162         print(print_ptrn % ('hcall', 'count',     162         print(print_ptrn % ('hcall', 'count', 'min(ns)', 'max(ns)', 'avg(ns)'))
163         print('-' * 68)                           163         print('-' * 68)
164         for opcode in output:                     164         for opcode in output:
165                 h_name = hcall_table_lookup(op    165                 h_name = hcall_table_lookup(opcode)
166                 time = output[opcode]['time']     166                 time = output[opcode]['time']
167                 cnt = output[opcode]['cnt']       167                 cnt = output[opcode]['cnt']
168                 min_t = output[opcode]['min']     168                 min_t = output[opcode]['min']
169                 max_t = output[opcode]['max']     169                 max_t = output[opcode]['max']
170                                                   170 
171                 print(print_ptrn % (h_name, cn    171                 print(print_ptrn % (h_name, cnt, min_t, max_t, time//cnt))
172                                                   172 
173 def powerpc__hcall_exit(name, context, cpu, se    173 def powerpc__hcall_exit(name, context, cpu, sec, nsec, pid, comm, callchain,
174                         opcode, retval):          174                         opcode, retval):
175         if (cpu in d_enter and opcode in d_ent    175         if (cpu in d_enter and opcode in d_enter[cpu]):
176                 diff = nsecs(sec, nsec) - d_en    176                 diff = nsecs(sec, nsec) - d_enter[cpu][opcode]
177                                                   177 
178                 if (opcode in output):            178                 if (opcode in output):
179                         output[opcode]['time']    179                         output[opcode]['time'] += diff
180                         output[opcode]['cnt']     180                         output[opcode]['cnt'] += 1
181                         if (output[opcode]['mi    181                         if (output[opcode]['min'] > diff):
182                                 output[opcode]    182                                 output[opcode]['min'] = diff
183                         if (output[opcode]['ma    183                         if (output[opcode]['max'] < diff):
184                                 output[opcode]    184                                 output[opcode]['max'] = diff
185                 else:                             185                 else:
186                         output[opcode] = {        186                         output[opcode] = {
187                                 'time': diff,     187                                 'time': diff,
188                                 'cnt': 1,         188                                 'cnt': 1,
189                                 'min': diff,      189                                 'min': diff,
190                                 'max': diff,      190                                 'max': diff,
191                         }                         191                         }
192                                                   192 
193                 del d_enter[cpu][opcode]          193                 del d_enter[cpu][opcode]
194 #       else:                                     194 #       else:
195 #               print("Can't find matching hca    195 #               print("Can't find matching hcall_enter event. Ignoring sample")
196                                                   196 
197 def powerpc__hcall_entry(event_name, context,     197 def powerpc__hcall_entry(event_name, context, cpu, sec, nsec, pid, comm,
198                          callchain, opcode):      198                          callchain, opcode):
199                 if (cpu in d_enter):              199                 if (cpu in d_enter):
200                         d_enter[cpu][opcode] =    200                         d_enter[cpu][opcode] = nsecs(sec, nsec)
201                 else:                             201                 else:
202                         d_enter[cpu] = {opcode    202                         d_enter[cpu] = {opcode: nsecs(sec, nsec)}
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php