├── LICENSE ├── README.md ├── cpu ├── cpustat.sh ├── runqstat │ └── runqstat └── schedstat │ ├── latency.c │ └── stats-15.pl ├── debug ├── gdb │ └── kgdb_start.sh └── systemtap │ ├── bio_sectors.stp │ ├── devmem_enable.stp │ ├── fiohist.stp │ ├── kgdb.stp │ ├── mdelay_inject.stp │ ├── msleep_inject.stp │ └── sysrq.stp ├── github ├── checkpatch.pl ├── github_merge_upstream.sh ├── km2bdmap.sh └── spelling.txt ├── interrupt ├── chk_intr.sh ├── chk_irq_config.sh ├── dump_intr.sh ├── intr_diff.sh └── show_smp_affi.sh ├── test └── fio │ └── fs_seq_write_sync_001 └── usb └── ls_usbdisk.sh /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | tools 2 | ===== 3 | 4 | Useful debug tools on Linux 5 | 6 | The tools are organized with by following directories, 7 | 8 | * cpu - the tools related to cpu and kernel scheduling 9 | 10 | * debug - the tools related to debug OS issues 11 | 12 | * github - the tools related to github management 13 | 14 | * interrupt - the tools related to interrupts 15 | 16 | * test - the tools or profiles related to Linux test 17 | 18 | * usb - the tools related to usb 19 | -------------------------------------------------------------------------------- /cpu/cpustat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TIME=$(date +"%Y%m%d_%H%M%S") 4 | TMP_DIR=/dev/shm 5 | LOG_DIR=${HOME}/cpustat_${TIME}_$$_logs 6 | 7 | PS_LOG=${TMP_DIR}/ps_${TIME}_$$.log 8 | SCHE_DEBUG_LOG=${TMP_DIR}/sched_debug_${TIME}_$$.log 9 | SCHESTAT_BEFORE_LOG=${TMP_DIR}/schedstat_before_${TIME}_$$.log 10 | SCHESTAT_AFTER_LOG=${TMP_DIR}/schedstat_after_${TIME}_$$.log 11 | SCHESTAT_PS_BEFORE_LOG=${TMP_DIR}/schedstat_ps_before_${TIME}_$$.log 12 | SCHESTAT_PS_AFTER_LOG=${TMP_DIR}/schedstat_ps_after_${TIME}_$$.log 13 | 14 | SAR_LOG=${TMP_DIR}/sar_${TIME}_$$.log 15 | MPSTAT_LOG=${TMP_DIR}/mpstat_${TIME}_$$.log 16 | IRQSTAT_LOG=${TMP_DIR}/irqstat_${TIME}_$$.log 17 | PIDSTAT_LOG=${TMP_DIR}/pidstat_${TIME}_$$.log 18 | 19 | SAR_PID=${TMP_DIR}/sar_${TIME}_$$.pid 20 | MPSTAT_PID=${TMP_DIR}/mpstat_${TIME}_$$.pid 21 | IRQSTAT_PID=${TMP_DIR}/irqstat_${TIME}_$$.pid 22 | PIDSTAT_PID=${TMP_DIR}/pidstat_${TIME}_$$.pid 23 | 24 | STAT_EXIT=0 25 | 26 | usage(){ 27 | printf "Usage: $0 [interval]" 28 | exit 1 29 | } 30 | 31 | function file_create { 32 | 33 | if [ ! -f $1 ] 34 | then 35 | touch $1 36 | fi 37 | } 38 | 39 | function dir_create { 40 | 41 | if [ ! -d $1 ] 42 | then 43 | mkdir $1 44 | fi 45 | } 46 | 47 | function dump_pid_list_schedstat { 48 | 49 | file_create $2 50 | 51 | for pid in $1 52 | do 53 | printf "********SCHEDSTAT_for_$pid************\n" >> $2 54 | date >> $2 55 | echo "cat /proc/$pid/sched" >> $2 56 | cat /proc/$pid/sched >> $2 57 | echo "cat /proc/$pid/schedstat" >> $2 58 | cat /proc/$pid/schedstat >> $2 59 | echo "\n\n" >> $2 60 | done 61 | } 62 | 63 | function exec_cmd { 64 | 65 | eval "$1 2>&1 &" 66 | echo $! > $2 67 | } 68 | 69 | function kill_cmd { 70 | 71 | kill -9 `cat $1` 72 | 73 | if [ $? -eq 0 ] 74 | then 75 | rm -f $1 76 | fi 77 | } 78 | 79 | function dump_schedstat { 80 | 81 | file_create $1 82 | 83 | date >> $1 84 | cat /proc/schedstat >> $1 85 | } 86 | 87 | function dump_sched_debug { 88 | 89 | printf "dump /proc/sched_debug into ${SCHE_DEBUG_LOG}\n" 90 | 91 | file_create ${SCHE_DEBUG_LOG} 92 | 93 | date >> ${SCHE_DEBUG_LOG} 94 | cat /proc/sched_debug >> ${SCHE_DEBUG_LOG} 95 | echo "*******************" >> ${SCHE_DEBUG_LOG} 96 | echo "\n\n" >> ${SCHE_DEBUG_LOG} 97 | } 98 | 99 | function dump_sched_debug_loop { 100 | 101 | while true 102 | do 103 | dump_sched_debug 104 | sleep 30 105 | done 106 | } 107 | 108 | function collect_logs { 109 | 110 | dir_create $LOG_DIR 111 | 112 | cp -f $TMP_DIR/*_${TIME}_$$* $LOG_DIR 113 | } 114 | 115 | trap 'trap_exit' SIGINT SIGQUIT SIGHUP 116 | 117 | trap_exit() 118 | { 119 | printf "Hitted Ctrl-C/Ctrl-\, or received SIGHUP. Now exiting..\n" 120 | 121 | dump_schedstat ${SCHESTAT_AFTER_LOG} 122 | 123 | dump_pid_list_schedstat "$USR_PID_LIST" ${SCHESTAT_PS_AFTER_LOG} 124 | dump_pid_list_schedstat "$KERN_PID_LIST" ${SCHESTAT_PS_AFTER_LOG} 125 | 126 | kill_cmd $SAR_PID 127 | kill_cmd $MPSTAT_PID 128 | kill_cmd $IRQSTAT_PID 129 | kill_cmd $PIDSTAT_PID 130 | 131 | collect_logs 132 | 133 | exit 134 | } 135 | 136 | 137 | 138 | [[ $# -gt 1 ]] && usage 139 | 140 | if [ x$1 != x ] 141 | then 142 | INTERVAL=$1 143 | else 144 | INTERVAL=10 145 | fi 146 | 147 | printf "Dump system process by crash tool\n" 148 | 149 | echo ps | crash > ${PS_LOG} 150 | 151 | printf "Get target process pid\n" 152 | 153 | USR_PID_LIST=`grep ddfs ${PS_LOG} | awk '{print $1}'` 154 | KERN_PID_LIST=`grep dd_dg1/ppart0 ${PS_LOG} | awk '{print $1}'` 155 | 156 | dump_pid_list_schedstat "$USR_PID_LIST" ${SCHESTAT_PS_BEFORE_LOG} 157 | dump_pid_list_schedstat "$KERN_PID_LIST" ${SCHESTAT_PS_BEFORE_LOG} 158 | 159 | dump_schedstat ${SCHESTAT_BEFORE_LOG} 160 | 161 | exec_cmd "sar -q ${INTERVAL} > ${SAR_LOG}" $SAR_PID 162 | exec_cmd "mpstat -u -I SUM -P ALL ${INTERVAL} > ${MPSTAT_LOG}" $MPSTAT_PID 163 | exec_cmd "irqstat -b -r 40 -t ${INTERVAL} > ${IRQSTAT_LOG}" $IRQSTAT_PID 164 | exec_cmd "pidstat -C 'dd_dg1' ${INTERVAL} > ${PIDSTAT_LOG}" $PIDSTAT_PID 165 | 166 | 167 | dump_sched_debug_loop 168 | -------------------------------------------------------------------------------- /cpu/runqstat/runqstat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # COPYRIGHT: Copyright (c) 2014 Yong Yang. 4 | # 5 | # This program is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License 7 | # as published by the Free Software Foundation; either version 2 8 | # of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software Foundation, 17 | # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | # 19 | # (http://www.gnu.org/copyleft/gpl.html) 20 | # 21 | # 3-Jul-2015 Yong Yang Created this. 22 | 23 | """ 24 | A tool that could show tasks information on Linux per-CPU runq 25 | """ 26 | 27 | import sys 28 | from optparse import OptionParser 29 | import re 30 | import subprocess 31 | import time 32 | from time import sleep 33 | 34 | __version__ = '0.1' 35 | 36 | def gen_numa(): 37 | """Generate NUMA info""" 38 | cpunodes = {} 39 | numacores = {} 40 | out = subprocess.Popen('numactl --hardware | grep cpus', shell=True, 41 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) 42 | errtxt = out.stderr.readline() 43 | if errtxt: 44 | print errtxt + '\r\n' 45 | print "Is numactl installed?\r" 46 | exit(1) 47 | for line in out.stdout.readlines(): 48 | arr = line.split() 49 | if arr[0] == "node" and arr[2] == "cpus:" and len(arr) > 3: 50 | node = arr[1] 51 | numacores[node] = arr[3:] 52 | for core in arr[3:]: 53 | cpunodes[core] = node 54 | return numacores, cpunodes 55 | 56 | def cpus_init(cpus, numacores): 57 | """initialize cpus data with default value""" 58 | 59 | runq = {} 60 | node = 0 61 | while node < len(numacores): 62 | for cpu in numacores[str(node)]: 63 | runq[".nr_switches_old"] = -1 64 | cpus[int(cpu)] = runq.copy() 65 | node += 1 66 | 67 | def print_stat(numacores, cpus): 68 | """print runq stat data""" 69 | 70 | header_width = len("nr_switches") 71 | width = len("CPUXX") 72 | node = 0 73 | fmtstr1 = '\t%' + str(width) + 's' 74 | fmtstr2 = '%' + str(header_width) + 's\t%' + str(width) + 's' 75 | while node < len(numacores): 76 | header = ('%' + str(header_width) + 's') % ' ' 77 | header += ('\t%' + str(width) + 's') % ("Node" + str(node)) 78 | data1 = '' 79 | data2 = '' 80 | data3 = '' 81 | node_sum1 = 0 82 | node_sum2 = 0 83 | node_sum3 = 0 84 | for cpu in numacores[str(node)]: 85 | header += ('\t%' + str(width) + 's') % ("CPU" + cpu) 86 | runq = cpus[int(cpu)] 87 | data1 += fmtstr1 % runq[".nr_running"] 88 | data2 += fmtstr1 % runq[".load"] 89 | delta = int(runq[".nr_switches"]) - int(runq[".nr_switches_old"]) 90 | data3 += fmtstr1 % delta 91 | node_sum1 += int(runq[".nr_running"]) 92 | node_sum2 += int(runq[".load"]) 93 | node_sum3 += delta 94 | print header 95 | print fmtstr2 % ("nr_running", str(node_sum1) + data1) 96 | print fmtstr2 % ("load", str(node_sum2) + data2) 97 | print fmtstr2 % ("nr_switches", str(node_sum3) + data3) 98 | print '\n' 99 | node += 1 100 | print '\n' 101 | 102 | 103 | def header_parse(out): 104 | """sched_debug header parse""" 105 | 106 | while True: 107 | line = out.readline() 108 | if re.search("Sched Debug Version:", line): 109 | print line 110 | if re.search("sched_clock_stable", line): 111 | print line 112 | break 113 | 114 | def sysctl_sched_parse(out): 115 | """sysctl_sched parse""" 116 | 117 | print_start = 0 118 | while True: 119 | line = out.readline() 120 | if re.search("sysctl_sched", line): 121 | print_start = 1 122 | if print_start: 123 | print line 124 | if print_start and re.search("^\n$", line): 125 | print_start = 0 126 | break 127 | 128 | def runq_parse(out, numacores, cpus): 129 | """runq parse""" 130 | 131 | cpu = 0 132 | cpu_found = 0 133 | for line in out.readlines(): 134 | if re.search("cpu#", line): 135 | cpu_found = 1 136 | runq = cpus[cpu] 137 | continue 138 | if cpu_found: 139 | key, val = line.split(':') 140 | key = key.strip() 141 | val = val.strip('\n') 142 | if re.search("\.nr_switches", line): 143 | if runq[".nr_switches_old"] != -1: 144 | runq[".nr_switches_old"] = runq[".nr_switches"] 145 | else: 146 | runq[".nr_switches_old"] = 0 147 | cpu += 1 148 | cpu_found = 0 149 | runq[key] = val 150 | 151 | print_stat(numacores, cpus) 152 | 153 | def runq_stat(seconds): 154 | """Main I/O loop""" 155 | 156 | cpus = {} 157 | numacores, cpunodes = gen_numa() 158 | 159 | run_once = 1 160 | 161 | try: 162 | out = open('/proc/sched_debug', 'r') 163 | 164 | while True: 165 | if run_once == 1: 166 | cpus_init(cpus, numacores) 167 | header_parse(out) 168 | sysctl_sched_parse(out) 169 | print "CPU runq task numbers for every %d second(s)\n" % seconds 170 | run_once = 0 171 | 172 | print time.ctime() + '\n' 173 | runq_parse(out, numacores, cpus) 174 | 175 | for _ in range(0, seconds * 10): 176 | sleep(.1) 177 | 178 | out.seek(0,0) 179 | 180 | except IOError: 181 | print "Error: can't open /proc/sched_debug" 182 | print "please make sure kernel is configed with SCHED_DEBUG." 183 | return 184 | 185 | out.close() 186 | 187 | def main(args): 188 | """Parse arguments, call main loop""" 189 | 190 | parser = OptionParser(description=__doc__) 191 | 192 | parser.add_option("-v", "--version", action="store_true", 193 | help="get version") 194 | parser.add_option("-t", "--time", default='5', 195 | help="update interval in seconds") 196 | 197 | options = parser.parse_args(args)[0] 198 | 199 | if options.version: 200 | print __version__ 201 | return 0 202 | 203 | try: 204 | runq_stat(int(options.time)) 205 | except (KeyboardInterrupt, SystemExit): 206 | pass 207 | 208 | if __name__ == "__main__": 209 | sys.exit(main(sys.argv)) 210 | -------------------------------------------------------------------------------- /cpu/schedstat/latency.c: -------------------------------------------------------------------------------- 1 | /* 2 | * latency -- measure the scheduling latency of a particular process from 3 | * the extra information provided in /proc/stat by version 4 of 4 | * the schedstat patch. PLEASE NOTE: This program does NOT check to 5 | * make sure that extra information is there; it assumes the last 6 | * three fields in that line are the ones it's interested in. Using 7 | * it on a kernel that does not have the schedstat patch compiled in 8 | * will cause it to happily produce bizarre results. 9 | * 10 | * Note too that this is known to work only with versions 4 and 5 11 | * of the schedstat patch, for similar reasons. 12 | * 13 | * This currently monitors only one pid at a time but could easily 14 | * be modified to do more. 15 | */ 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | extern char *index(), *rindex(); 24 | char procbuf[512]; 25 | char statname[64]; 26 | char *Progname; 27 | FILE *fp; 28 | 29 | void usage() 30 | { 31 | fprintf(stderr,"Usage: %s [-s sleeptime ] \n", Progname); 32 | exit(-1); 33 | } 34 | 35 | /* 36 | * get_stats() -- we presume that we are interested in the first three 37 | * fields of the line we are handed, and further, that they contain 38 | * only numbers and single spaces. 39 | */ 40 | void get_stats(char *buf, unsigned int *run_ticks, unsigned int *wait_ticks, 41 | unsigned int *nran) 42 | { 43 | char *ptr; 44 | 45 | /* sanity */ 46 | if (!buf || !run_ticks || !wait_ticks || !nran) 47 | return; 48 | 49 | /* leading blanks */ 50 | ptr = buf; 51 | while (*ptr && isblank(*ptr)) 52 | ptr++; 53 | 54 | /* first number -- run_ticks */ 55 | *run_ticks = atoi(ptr); 56 | while (*ptr && isdigit(*ptr)) 57 | ptr++; 58 | while (*ptr && isblank(*ptr)) 59 | ptr++; 60 | 61 | /* second number -- wait_ticks */ 62 | *wait_ticks = atoi(ptr); 63 | while (*ptr && isdigit(*ptr)) 64 | ptr++; 65 | while (*ptr && isblank(*ptr)) 66 | ptr++; 67 | 68 | /* last number -- nran */ 69 | *nran = atoi(ptr); 70 | } 71 | 72 | /* 73 | * get_id() -- extract the id field from that /proc//stat file 74 | */ 75 | void get_id(char *buf, char *id) 76 | 77 | { 78 | char *ptr; 79 | 80 | /* sanity */ 81 | if (!buf || !id) 82 | return; 83 | 84 | ptr = index(buf, ')') + 1; 85 | *ptr = 0; 86 | strcpy(id, buf); 87 | *ptr = ' '; 88 | 89 | return; 90 | } 91 | 92 | void main(int argc, char *argv[]) 93 | { 94 | int c; 95 | unsigned int sleeptime = 5, pid = 0, verbose = 0; 96 | char id[32]; 97 | unsigned int run_ticks, wait_ticks, nran; 98 | unsigned int orun_ticks=0, owait_ticks=0, oran=0; 99 | 100 | Progname = argv[0]; 101 | id[0] = 0; 102 | while ((c = getopt(argc,argv,"s:v")) != -1) { 103 | switch (c) { 104 | case 's': 105 | sleeptime = atoi(optarg); 106 | break; 107 | case 'v': 108 | verbose++; 109 | break; 110 | default: 111 | usage(); 112 | } 113 | } 114 | 115 | if (optind < argc) { 116 | pid = atoi(argv[optind]); 117 | } 118 | 119 | if (!pid) 120 | usage(); 121 | 122 | sprintf(statname,"/proc/%d/stat", pid); 123 | if (fp = fopen(statname, "r")) { 124 | if (fgets(procbuf, sizeof(procbuf), fp)) 125 | get_id(procbuf,id); 126 | fclose(fp); 127 | } 128 | 129 | /* 130 | * now just spin collecting the stats 131 | */ 132 | sprintf(statname,"/proc/%d/schedstat", pid); 133 | while (fp = fopen(statname, "r")) { 134 | if (!fgets(procbuf, sizeof(procbuf), fp)) 135 | break; 136 | 137 | get_stats(procbuf, &run_ticks, &wait_ticks, &nran); 138 | 139 | if (verbose) 140 | printf("%s %d(%d) %d(%d) %d(%d) %4.2f %4.2f\n", 141 | id, run_ticks, run_ticks - orun_ticks, 142 | wait_ticks, wait_ticks - owait_ticks, 143 | nran, nran - oran, 144 | nran - oran ? 145 | (double)(run_ticks-orun_ticks)/(nran - oran) : 0, 146 | nran - oran ? 147 | (double)(wait_ticks-owait_ticks)/(nran - oran) : 0); 148 | else 149 | printf("%s avgrun=%4.2fns avgwait=%4.2fns\n", 150 | id, nran - oran ? 151 | (double)(run_ticks-orun_ticks)/(nran - oran) : 0, 152 | nran - oran ? 153 | (double)(wait_ticks-owait_ticks)/(nran - oran) : 0); 154 | fclose(fp); 155 | oran = nran; 156 | orun_ticks = run_ticks; 157 | owait_ticks = wait_ticks; 158 | sleep(sleeptime); 159 | fp = fopen(statname,"r"); 160 | if (!fp) 161 | break; 162 | } 163 | if (id[0]) 164 | printf("Process %s has exited.\n", id); 165 | else 166 | printf("Process %d does not exist, or no schedstat proc file\n", pid); 167 | exit(0); 168 | } 169 | -------------------------------------------------------------------------------- /cpu/schedstat/stats-15.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use Getopt::Std; 4 | 5 | $curr_version = 15; 6 | 7 | $YLD_CNT = 1; 8 | $SCHED_EXP_CNT = 2; 9 | $SCHED_CNT = 3; 10 | $SCHED_GOIDLE = 4; 11 | $TTWU_CNT = 5; 12 | $TTWU_LOCAL = 6; 13 | $CPU_CPUTIME = 7; 14 | $CPU_RUNDELAY = 8; 15 | $CPU_SLICE_CNT = 9; 16 | 17 | # 18 | # per-domain stats 19 | # 20 | $LB_CNT_IDLE = 2; 21 | $LB_NOT_NEEDED_IDLE = 3; 22 | $LB_FAILED_IDLE = 4; 23 | $LB_IMBALANCE_IDLE = 5; 24 | $PT_CNT_IDLE = 6; 25 | $PT_HOT_IDLE = 7; 26 | $LB_NOBUSYQ_IDLE = 8; 27 | $LB_NOBUSYG_IDLE = 9; 28 | 29 | $LB_CNT_NOIDLE = 10; 30 | $LB_NOT_NEEDED_NOIDLE = 11; 31 | $LB_FAILED_NOIDLE = 12; 32 | $LB_IMBALANCE_NOIDLE = 13; 33 | $PT_CNT_NOIDLE = 14; 34 | $PT_HOT_NOIDLE = 15; 35 | $LB_NOBUSYQ_NOIDLE = 16; 36 | $LB_NOBUSYG_NOIDLE = 17; 37 | 38 | $LB_CNT_NEWIDLE = 18; 39 | $LB_NOT_NEEDED_NEWIDLE = 19; 40 | $LB_FAILED_NEWIDLE = 20; 41 | $LB_IMBALANCE_NEWIDLE = 11; 42 | $PT_CNT_NEWIDLE = 22; 43 | $PT_HOT_NEWIDLE = 23; 44 | $LB_NOBUSYQ_NEWIDLE = 24; 45 | $LB_NOBUSYG_NEWIDLE = 25; 46 | 47 | $ALB_CNT = 26; 48 | $ALB_FAILED = 27; 49 | $ALB_PUSHED = 28; 50 | 51 | $SBE_CNT = 29; 52 | $SBE_FAILED = 30; 53 | $SBE_PUSHED = 31; 54 | 55 | $SBF_CNT = 32; 56 | $SBF_FAILED = 33; 57 | $SBF_PUSHED = 34; 58 | 59 | $TTWU_WAKE_REMOTE = 35; 60 | $TTWU_MOVE_AFFINE = 36; 61 | $TTWU_MOVE_BALANCE = 37; 62 | 63 | die "Usage: $0 [-t] [file_prev] [file_curr]\n" unless &getopts("tcdv"); 64 | 65 | # 66 | # @domain_diff_all is an array, for each field of domain data, of the sum 67 | # of that field across all cpus and all domains. 68 | # 69 | # @domain_diff_bycpu is an array of references to arrays. For each cpu, it 70 | # contains a reference to an array which sums each field in all its 71 | # domain stats. 72 | # 73 | # @diff is the array of runqueue data. 74 | # 75 | # @per_cpu_curr and @per_cpu_prev are arrays of runqueue data on a per cpu 76 | # basis for the current stats (just read) and previous stats. These 77 | # are referenced to calculate @diff, above. Fields beyond 78 | # $PT_LOST_IDLE are references to arrays of per-domain information 79 | # for this cpu; as many references are there are unique domains. 80 | # 81 | sub summarize_data { 82 | my $i; 83 | my $cpu, $domain; 84 | my @arr_curr, @arr_prev, @arr_diff; 85 | 86 | # 87 | # first we must sum up the diffs for the individual cpus 88 | # 89 | @diff = (); 90 | 91 | @domain_diff_all = (); 92 | foreach $cpu (0 .. $max_cpu) { 93 | @arr_curr = @{$per_cpu_curr[$cpu]}; 94 | @arr_prev = @{$per_cpu_prev[$cpu]}; 95 | foreach $i (1 .. 9) { 96 | $arr_diff[$i] = $arr_curr[$i] - $arr_prev[$i]; 97 | $diff[$i] += $arr_diff[$i]; 98 | } 99 | $per_cpu_diff[$cpu] = [ @arr_diff ]; 100 | 101 | # 102 | # now stats from domains 103 | # 104 | @domain_diff_bycpu[$cpu] = [ ]; 105 | foreach $domain (0..$max_domain) { 106 | @arr_curr = @{@{$per_cpu_curr[$cpu]}[$domain+10]}; 107 | @arr_prev = @{@{$per_cpu_prev[$cpu]}[$domain+10]}; 108 | foreach $i (2..37) { 109 | if ($opt_v) { 110 | print "domain$domain: arr_curr[$i] ($arr_curr[$i]) -" . 111 | " arr_prev[$i] ($arr_prev[$i])\n"; 112 | } 113 | $arr_diff[$i] = $arr_curr[$i] - $arr_prev[$i]; 114 | $diff[$domain+10][$i] += $arr_diff[$i]; 115 | $domain_diff_bycpu[$cpu]->[i] += $arr_diff[$i]; 116 | $domain_diff_all[$i] += $arr_diff[$i]; 117 | } 118 | push @{$per_cpu_diff[$cpu]} , [ @arr_diff ]; 119 | } 120 | } 121 | } 122 | 123 | $first = 2; 124 | while (<>) { 125 | 126 | next if (/^$/); 127 | 128 | @curr = split; 129 | if ($curr[0] =~ /cpu(\d+)/) { 130 | $curr_cpu = $1; 131 | $per_cpu_curr[$curr_cpu] = [ @curr ]; 132 | $max_cpu = $curr_cpu if ($curr_cpu > $max_cpu); 133 | next; 134 | } 135 | if ($curr[0] =~ /domain(\d+)/) { 136 | $arr = $per_cpu_curr[$curr_cpu]; 137 | push @{$arr}, [ @curr ]; 138 | if ($opt_v) { 139 | print "@{$arr}\n"; 140 | print "($curr_cpu,$1)$arr->[0],$arr->[$#{@{$arr}}]->[0]\n"; 141 | print "$#{@{$arr}}\n"; 142 | } 143 | $max_domain = $1 if ($1 > $max_domain); 144 | next; 145 | } 146 | if ($curr[0] eq "version") { 147 | if ($curr[1] != $curr_version) { 148 | die "$0: Version mismatch: input is version $curr[1] but this" . 149 | " tool\nis for version $curr_version.\n"; 150 | } 151 | if (!$first) { 152 | 153 | 154 | # 155 | # display diffs 156 | # 157 | if (!$opt_t) { 158 | summarize_data(); 159 | $diff[0] = "diff"; 160 | print "\n"; 161 | print_diffs(); 162 | @per_cpu_prev = @per_cpu_curr; 163 | } else { 164 | @per_cpu_prev = @per_cpu_curr if (!@per_cpu_prev); 165 | } 166 | } else { 167 | @per_cpu_prev = @per_cpu_curr if (!--$first && !@per_cpu_prev); 168 | } 169 | next; 170 | } 171 | if ($curr[0] eq "timestamp") { 172 | if ($curr[1] > $otimestamp) { 173 | $delta = $curr[1] - $otimestamp; 174 | } else { 175 | # timestamp rolled over 176 | $delta = $curr[1] + (~0 - $otimestamp); 177 | print "ROLLOVER! (delta=$delta)\n"; 178 | } 179 | $otimestamp = $curr[1]; 180 | $timestart = $delta if (!$timestart); 181 | $timestamp += $delta; 182 | next; 183 | } 184 | 185 | # 186 | # format of line in /proc/schedstat 187 | # 188 | # cpuN 1 2 3 4 5 6 7 8 9 189 | # domainN xxxxxxxx 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 190 | # 191 | # version == 15 192 | # 193 | # These are the fields from the cpuN field, and deal with the runqueue 194 | # that cpu is in. 195 | # 196 | # First one are sched_yield statistics: 197 | # 1) # of times sched_yield() was called 198 | # 199 | # Next three are schedule() statistics: 200 | # 2) A legacy array expiration count used in the O(1), always zero 201 | # 3) # of times schedule() was called 202 | # 4) # of times schedule() left the processor idle 203 | # 204 | # Next two are statistics dealing with try_to_wake_up(): 205 | # 5) # of times try_to_wake_up() was called 206 | # 6) # of times try_to_wake_up() was called to wake up the local cpu 207 | # 208 | # Next three are statistics dealing with scheduling latency: 209 | # 7) sum of all time spent running by tasks on this processor (in ms) 210 | # 8) sum of all time spent waiting to run by tasks on this processor 211 | # (in ms) 212 | # 9) # of timeslices run on this cpu 213 | # 214 | # These are the fields from the domainN field, and deal with each of the 215 | # domains the previously mentioned cpu is in. The first field is a bit 216 | # mask which indicates the span of the domain being described. 217 | # 218 | # Next twenty-four fields are statistics dealing with load_balance() and 219 | # pull_task(): 220 | # 2) # of times in this domain load_balance() was called when the 221 | # cpu was idle 222 | # 3) # of times in this domain load_balance() checked but found 223 | # the load did not require balancing when the cpu was idle 224 | # 4) # of times in this domain load_balance() tried to move one or 225 | # more tasks and failed, when the cpu was idle 226 | # 5) sum of imbalances discovered (if any) with each call to 227 | # load_balance() in this domain when the cpu was idle 228 | # 6) # of times in this domain pull_task() was called when the cpu 229 | # was idle 230 | # 7) # of times in this domain pull_task() was called even though 231 | # the target task was cache-hot when idle 232 | # 8) # of times in this domain load_balance() was called but did 233 | # not find a busier queue while the cpu was idle 234 | # 9) # of times in this domain a busier queue was found while the 235 | # cpu was idle but no busier group was found 236 | # 237 | # 10) # of times in this domain load_balance() was called when the 238 | # cpu was busy 239 | # 11) # of times in this domain load_balance() checked but found the 240 | # load did not require balancing when busy 241 | # 12) # of times in this domain load_balance() tried to move one or 242 | # more tasks and failed, when the cpu was busy 243 | # 13) sum of imbalances discovered (if any) with each call to 244 | # load_balance() in this domain when the cpu was busy 245 | # 14) # of times in this domain pull_task() was called when busy 246 | # 15) # of times in this domain pull_task() was called even though the 247 | # target task was cache-hot when busy 248 | # 16) # of times in this domain load_balance() was called but did not 249 | # find a busier queue while the cpu was busy 250 | # 17) # of times in this domain a busier queue was found while the cpu 251 | # was busy but no busier group was found 252 | # 253 | # 18) # of times in this domain load_balance() was called when the 254 | # cpu was just becoming idle 255 | # 19) # of times in this domain load_balance() checked but found the 256 | # load did not require balancing when the cpu was just becoming idle 257 | # 20) # of times in this domain load_balance() tried to move one or more 258 | # tasks and failed, when the cpu was just becoming idle 259 | # 21) sum of imbalances discovered (if any) with each call to 260 | # load_balance() in this domain when the cpu was just becoming idle 261 | # 22) # of times in this domain pull_task() was called when newly idle 262 | # 23) # of times in this domain pull_task() was called even though the 263 | # target task was cache-hot when just becoming idle 264 | # 24) # of times in this domain load_balance() was called but did not 265 | # find a busier queue while the cpu was just becoming idle 266 | # 25) # of times in this domain a busier queue was found while the cpu 267 | # was just becoming idle but no busier group was found 268 | # 269 | # Next three are active_load_balance() statistics: 270 | # 26) # of times active_load_balance() was called 271 | # 27) # of times active_load_balance() tried to move a task and failed 272 | # 28) # of times active_load_balance() successfully moved a task 273 | # 274 | # Next six are for sched_balance_exec and sched_balance_fork, always zero: 275 | # 29) sbe_cnt is not used 276 | # 30) sbe_balanced is not used 277 | # 31) sbe_pushed is not used 278 | # 32) sbf_cnt is not used 279 | # 33) sbf_balanced is not used 280 | # 34) sbf_pushed is not used 281 | # 282 | # Next three are try_to_wake_up() statistics: 283 | # 35) # of times in this domain try_to_wake_up() awoke a task that 284 | # last ran on a different cpu in this domain 285 | # 36) # of times in this domain try_to_wake_up() moved a task to the 286 | # waking cpu because it was cache-cold on its own cpu anyway 287 | # 37) # of times in this domain try_to_wake_up() moved a task to the 288 | # 289 | 290 | } 291 | 292 | summarize_data(); 293 | print_diffs() if ($opt_t); 294 | 295 | sub print_diffs { 296 | my $t; 297 | 298 | if ($timestamp > $timestart) { 299 | $t = $timestamp-$timestart; 300 | } else { 301 | $t = $timestamp + (~0 - $timestart); 302 | } 303 | 304 | printf "%02d:%02d:%02d--------------------------------------------------------------\n", 305 | $t/3600000, ($t/60000)%60, ($t/1000)%60; 306 | 307 | #print "@domain_diff_all\n"; 308 | # 309 | # sched_yield() stats 310 | # 311 | printf " %7d sys_sched_yield()\n", $diff[$YLD_CNT]; 312 | 313 | # 314 | # schedule() stats 315 | # 316 | print "\n"; 317 | printf " %7d schedule()\n", $diff[$SCHED_CNT]; 318 | printf " %7d(%6.2f%%) scheduled no process (left cpu idle)\n", 319 | $diff[$SCHED_GOIDLE], 100*$diff[$SCHED_GOIDLE]/$diff[$SCHED_CNT] 320 | if ($diff[$SCHED_CNT]); 321 | 322 | # 323 | # try_to_wake_up() stats 324 | # 325 | print "\n\n"; 326 | printf " %7d try_to_wake_up()\n", $diff[$TTWU_CNT]; 327 | printf " %7d(%6.2f%%) task being awakened was last on same cpu as waker\n", 328 | $diff[$TTWU_LOCAL], 100*$diff[$TTWU_LOCAL]/$diff[$TTWU_CNT] 329 | if ($diff[$TTWU_CNT] && $diff[$TTWU_LOCAL]); 330 | printf " %7d(%6.2f%%) task being awakened was last on different cpu than waker\n", 331 | $diff[$TTWU_CNT] - $diff[$TTWU_LOCAL], 332 | 100*($diff[$TTWU_CNT] - $diff[$TTWU_LOCAL])/$diff[$TTWU_CNT] 333 | if ($diff[$TTWU_CNT] && $diff[$TTWU_CNT] != $diff[$TTWU_LOCAL]); 334 | if (!$opt_d) { 335 | # 336 | # try_to_wake_up() stats 337 | # 338 | printf " %7d(%6.2f%%) moved that task to the waking cpu because it was cache-cold\n", 339 | $domain_diff_all[$TTWU_MOVE_AFFINE], 340 | 100*$domain_diff_all[$TTWU_MOVE_AFFINE]/$domain_diff_all[$TTWU_WAKE_REMOTE] 341 | if ($domain_diff_all[$TTWU_MOVE_AFFINE]); 342 | printf " %7d(%6.2f%%) moved that task to the waking cpu because the cpu's queue was unbalanced\n", 343 | $domain_diff_all[$TTWU_MOVE_BALANCE], 344 | 100*$domain_diff_all[$TTWU_MOVE_BALANCE]/$domain_diff_all[$TTWU_WAKE_REMOTE] 345 | if ($domain_diff_all[$TTWU_MOVE_BALANCE]); 346 | printf " %7d(%6.2f%%) didn't move that task\n", 347 | $domain_diff_all[$TTWU_WAKE_REMOTE] - 348 | $domain_diff_all[$TTWU_MOVE_AFFINE] - $domain_diff_all[$TTWU_MOVE_BALANCE], 349 | 100*($domain_diff_all[$TTWU_WAKE_REMOTE] - 350 | $domain_diff_all[$TTWU_MOVE_AFFINE] - $domain_diff_all[$TTWU_MOVE_BALANCE]) 351 | / $domain_diff_all[$TTWU_WAKE_REMOTE] 352 | if ($domain_diff_all[$TTWU_WAKE_REMOTE] - 353 | $domain_diff_all[$TTWU_MOVE_AFFINE] - 354 | $domain_diff_all[$TTWU_MOVE_BALANCE]); 355 | } 356 | 357 | print "\n" if ($diff[TTWU_CNT]); 358 | 359 | # 360 | # latency stats 361 | # 362 | $totalcpu = $totalslicecnt = $totalrundelay = 0; 363 | for ($cpu = 0; $cpu <= $max_cpu; $cpu++) { 364 | @arr = @{$per_cpu_diff[$cpu]}; 365 | if ($arr[$CPU_SLICE_CNT] && ($arr[$CPU_CPUTIME] || $arr[$CPU_RUNDELAY])) { 366 | $totalcpu += $arr[$CPU_CPUTIME]; 367 | $totalslicecnt += $arr[$CPU_SLICE_CNT]; 368 | $totalrundelay += $arr[$CPU_RUNDELAY]; 369 | if ($opt_c) { 370 | printf " %6.2f/%-6.2f avg runtime/latency on cpu %d (ns)\n", 371 | $arr[$CPU_CPUTIME]/$arr[$CPU_SLICE_CNT], 372 | $arr[$CPU_RUNDELAY]/$arr[$CPU_SLICE_CNT], $cpu; 373 | } 374 | } 375 | } 376 | printf " %6.2f/%-6.2f avg runtime/latency over all cpus (ns)\n", 377 | $totalcpu/$totalslicecnt, $totalrundelay/$totalslicecnt; 378 | 379 | printf("\n"); 380 | 381 | # 382 | # domain info 383 | # 384 | if ($opt_d) { 385 | foreach $domain (0..$max_domain) { 386 | $domain_diff = $diff[13+$domain]; 387 | #print " domain$domain @{$domain_diff}\n"; 388 | print "[scheduler domain #$domain]\n"; 389 | 390 | $pt_cnt_total = $domain_diff->[$PT_CNT_IDLE] + 391 | $domain_diff->[$PT_CNT_NEWIDLE] + $domain_diff->[$PT_CNT_NOIDLE]; 392 | printf " %7d tasks pulled by pull_task()\n", $pt_cnt_total; 393 | printf " %7d(%6.2f%%) pulled from hot cpu while still cache-hot and idle\n", 394 | $domain_diff->[$PT_HOT_IDLE], 395 | 100*$domain_diff->[$PT_HOT_IDLE]/$pt_cnt_total 396 | if ($domain_diff->[$PT_HOT_IDLE]); 397 | printf " %7d(%6.2f%%) pulled from cold cpu while idle\n", 398 | $domain_diff->[$PT_CNT_IDLE] - $domain_diff->[$PT_HOT_IDLE], 399 | 100*($domain_diff->[$PT_CNT_IDLE] - $domain_diff->[$PT_HOT_IDLE])/$pt_cnt_total 400 | if ($domain_diff->[$PT_CNT_IDLE] - $domain_diff->[$PT_HOT_IDLE]); 401 | printf " %7d(%6.2f%%) pulled from hot cpu while still cache-hot and busy\n", 402 | $domain_diff->[$PT_HOT_NOIDLE], 403 | 100*$domain_diff->[$PT_HOT_NOIDLE]/$pt_cnt_total 404 | if ($domain_diff->[$PT_HOT_NOIDLE]); 405 | printf " %7d(%6.2f%%) pulled from cold cpu while busy\n", 406 | $domain_diff->[$PT_CNT_NOIDLE] - $domain_diff->[$PT_HOT_NOIDLE], 407 | 100*($domain_diff->[$PT_CNT_NOIDLE] - $domain_diff->[$PT_HOT_NOIDLE])/$pt_cnt_total 408 | if ($domain_diff->[$PT_CNT_NOIDLE] - $domain_diff->[$PT_HOT_NOIDLE]); 409 | printf " %7d(%6.2f%%) pulled from hot cpu while still cache-hot and newly idle\n", 410 | $domain_diff->[$PT_HOT_NEWIDLE], 411 | 100*$domain_diff->[$PT_HOT_NEWIDLE]/$pt_cnt_total 412 | if ($domain_diff->[$PT_HOT_NEWIDLE]); 413 | printf " %7d(%6.2f%%) pulled from cold cpu when newly idle\n", 414 | $domain_diff->[$PT_CNT_NEWIDLE] - $domain_diff->[$PT_HOT_NEWIDLE], 415 | 100*($domain_diff->[$PT_CNT_NEWIDLE] - $domain_diff->[$PT_HOT_NEWIDLE])/$pt_cnt_total 416 | if ($domain_diff->[$PT_CNT_NEWIDLE] - $domain_diff->[$PT_HOT_NEWIDLE]); 417 | 418 | # 419 | # load_balance() stats 420 | # 421 | $lb_cnt_total = $domain_diff->[$LB_CNT_IDLE] + 422 | $domain_diff->[$LB_CNT_NEWIDLE] + $domain_diff->[$LB_CNT_NOIDLE]; 423 | 424 | printf "\n %7d load_balance()\n", $lb_cnt_total; 425 | 426 | # 427 | # while idle 428 | # 429 | printf " %7d(%6.2f%%) called while idle\n", 430 | $domain_diff->[$LB_CNT_IDLE], 431 | $lb_cnt_total ? 100*$domain_diff->[$LB_CNT_IDLE]/$lb_cnt_total : 0; 432 | printf " %7d(%6.2f%%) tried but failed to move any tasks\n", 433 | $domain_diff->[$LB_FAILED_IDLE], 434 | $domain_diff->[$LB_CNT_IDLE] ? 435 | 100*$domain_diff->[$LB_FAILED_IDLE]/$domain_diff->[$LB_CNT_IDLE] : 436 | 0 437 | if ($domain_diff->[$LB_FAILED_IDLE]); 438 | printf " %7d(%6.2f%%) found no busier queue\n", 439 | $domain_diff->[$LB_NOBUSYQ_IDLE], 440 | $domain_diff->[$LB_CNT_IDLE] ? 441 | 100*$domain_diff->[$LB_NOBUSYQ_IDLE]/$domain_diff->[$LB_CNT_IDLE] : 442 | 0 443 | if ($domain_diff->[$LB_NOBUSYQ_IDLE]); 444 | printf " %7d(%6.2f%%) found no busier group\n", 445 | $domain_diff->[$LB_NOBUSYG_IDLE], 446 | $domain_diff->[$LB_CNT_IDLE] ? 447 | 100*$domain_diff->[$LB_NOBUSYG_IDLE]/$domain_diff->[$LB_CNT_IDLE] : 448 | 0 449 | if ($domain_diff->[$LB_NOBUSYG_IDLE]); 450 | $tmp = $domain_diff->[$LB_CNT_IDLE] - 451 | ($domain_diff->[$LB_NOBUSYG_IDLE] + $domain_diff->[$LB_NOBUSYQ_IDLE] + 452 | $domain_diff->[$LB_FAILED_IDLE]); 453 | if ($tmp) { 454 | printf " %7d(%6.2f%%) succeeded in moving " . 455 | "at least one task\n", 456 | $tmp, $tmp ? 100*$tmp/$domain_diff->[$LB_CNT_IDLE] : 0; 457 | $imbalance = $domain_diff->[$LB_IMBALANCE_IDLE] / 458 | ($tmp + $domain_diff->[$LB_FAILED_IDLE]); 459 | if ($imbalance < 10) { 460 | $fmt = "%7.3f"; 461 | } elsif ($imbalance < 100) { 462 | $fmt = "%7.2f"; 463 | } else { 464 | $fmt = "%7.1f"; 465 | } 466 | printf " (average imbalance: $fmt)\n", 467 | $imbalance; 468 | } 469 | 470 | # 471 | # while busy 472 | # 473 | printf " %7d(%6.2f%%) called while busy\n", 474 | $domain_diff->[$LB_CNT_NOIDLE], 475 | $lb_cnt_total ? 100*$domain_diff->[$LB_CNT_NOIDLE]/$lb_cnt_total : 0; 476 | printf " %7d(%6.2f%%) tried but failed to move any tasks\n", 477 | $domain_diff->[$LB_FAILED_NOIDLE], 478 | $domain_diff->[$LB_CNT_NOIDLE] ? 479 | 100*$domain_diff->[$LB_FAILED_NOIDLE]/$domain_diff->[$LB_CNT_NOIDLE] : 480 | 0 481 | if ($domain_diff->[$LB_FAILED_NOIDLE]); 482 | printf " %7d(%6.2f%%) found no busier queue\n", 483 | $domain_diff->[$LB_NOBUSYQ_NOIDLE], 484 | $domain_diff->[$LB_CNT_NOIDLE] ? 485 | 100*$domain_diff->[$LB_NOBUSYQ_NOIDLE]/$domain_diff->[$LB_CNT_NOIDLE] : 486 | 0 487 | if ($domain_diff->[$LB_NOBUSYQ_NOIDLE]); 488 | printf " %7d(%6.2f%%) found no busier group\n", 489 | $domain_diff->[$LB_NOBUSYG_NOIDLE], 490 | $domain_diff->[$LB_CNT_NOIDLE] ? 491 | 100*$domain_diff->[$LB_NOBUSYG_NOIDLE]/$domain_diff->[$LB_CNT_NOIDLE] : 492 | 0 493 | if ($domain_diff->[$LB_NOBUSYG_NOIDLE]); 494 | $tmp = $domain_diff->[$LB_CNT_NOIDLE] - 495 | ($domain_diff->[$LB_NOBUSYG_NOIDLE] + 496 | $domain_diff->[$LB_NOBUSYQ_NOIDLE] + 497 | $domain_diff->[$LB_FAILED_NOIDLE]); 498 | if ($tmp) { 499 | printf " %7d(%6.2f%%) succeeded in moving " . 500 | "at least one task\n", 501 | $tmp, $tmp ? 100*$tmp/$domain_diff->[$LB_CNT_NOIDLE] : 0; 502 | $imbalance = $domain_diff->[$LB_IMBALANCE_NOIDLE] / 503 | ($tmp + $domain_diff->[$LB_FAILED_NOIDLE]); 504 | if ($imbalance < 10) { 505 | $fmt = "%7.3f"; 506 | } elsif ($imbalance < 100) { 507 | $fmt = "%7.2f"; 508 | } else { 509 | $fmt = "%7.1f"; 510 | } 511 | printf " (average imbalance: $fmt)\n", 512 | $imbalance; 513 | } 514 | 515 | 516 | # 517 | # when newly idle 518 | # 519 | printf " %7d(%6.2f%%) called when newly idle\n", 520 | $domain_diff->[$LB_CNT_NEWIDLE], 521 | $lb_cnt_total ? 100*$domain_diff->[$LB_CNT_NEWIDLE]/$lb_cnt_total 522 | : 0; 523 | printf " %7d(%6.2f%%) tried but failed to move any tasks\n", 524 | $domain_diff->[$LB_FAILED_NEWIDLE], 525 | $domain_diff->[$LB_CNT_NEWIDLE] ? 526 | 100*$domain_diff->[$LB_FAILED_NEWIDLE]/$domain_diff->[$LB_CNT_NEWIDLE] : 527 | 0 528 | if ($domain_diff->[$LB_FAILED_NEWIDLE]); 529 | printf " %7d(%6.2f%%) found no busier queue\n", 530 | $domain_diff->[$LB_NOBUSYQ_NEWIDLE], 531 | $domain_diff->[$LB_CNT_NEWIDLE] ? 532 | 100*$domain_diff->[$LB_NOBUSYQ_NEWIDLE]/$domain_diff->[$LB_CNT_NEWIDLE] : 533 | 0 534 | if ($domain_diff->[$LB_NOBUSYQ_NEWIDLE]); 535 | printf " %7d(%6.2f%%) found no busier group\n", 536 | $domain_diff->[$LB_NOBUSYG_NEWIDLE], 537 | $domain_diff->[$LB_CNT_NEWIDLE] ? 538 | 100*$domain_diff->[$LB_NOBUSYG_NEWIDLE]/$domain_diff->[$LB_CNT_NEWIDLE] : 539 | 0 540 | if ($domain_diff->[$LB_NOBUSYG_NEWIDLE]); 541 | $tmp = $domain_diff->[$LB_CNT_NEWIDLE] - 542 | ($domain_diff->[$LB_NOBUSYG_NEWIDLE] + 543 | $domain_diff->[$LB_NOBUSYQ_NEWIDLE] + 544 | $domain_diff->[$LB_FAILED_NEWIDLE]); 545 | if ($tmp) { 546 | printf " %7d(%6.2f%%) succeeded in moving " . 547 | "at least one task\n", 548 | $tmp, $tmp ? 100*$tmp/$domain_diff->[$LB_CNT_NEWIDLE] : 0; 549 | $imbalance = $domain_diff->[$LB_IMBALANCE_NEWIDLE] / 550 | ($tmp + $domain_diff->[$LB_FAILED_NEWIDLE]); 551 | if ($imbalance < 10) { 552 | $fmt = "%7.3f"; 553 | } elsif ($imbalance < 100) { 554 | $fmt = "%7.2f"; 555 | } else { 556 | $fmt = "%7.1f"; 557 | } 558 | printf " (average imbalance: $fmt)\n", 559 | $imbalance; 560 | } 561 | 562 | # 563 | # active_load_balance() stats 564 | # 565 | printf "\n %7d active_load_balance() was called\n", 566 | $domain_diff->[$ALB_CNT]; 567 | printf " %7d active_load_balance() tried to push a task\n", 568 | $domain_diff->[$ALB_PUSHED] + $domain_diff->[$ALB_FAILED] 569 | if ($domain_diff->[$ALB_PUSHED] || $domain_diff->[$ALB_FAILED]); 570 | printf " %7d active_load_balance() succeeded in pushing a task\n", 571 | $domain_diff->[$ALB_PUSHED] if ($domain_diff->[$ALB_PUSHED]); 572 | 573 | # 574 | # try_to_wake_up() stats 575 | # 576 | printf "\n try_to_wake_up() ...\n" 577 | if ($domain_diff->[$TTWU_WAKE_REMOTE]); 578 | printf " %7d ... found that the task being awakened was last on different cpu than waker\n", 579 | $domain_diff->[$TTWU_WAKE_REMOTE] 580 | if ($domain_diff->[$TTWU_WAKE_REMOTE]); 581 | printf " %7d(%6.2f%%) ... moved that task to the waking cpu because it was cache-cold\n", 582 | $domain_diff->[$TTWU_MOVE_AFFINE], 583 | 100*$domain_diff->[$TTWU_MOVE_AFFINE]/$domain_diff->[$TTWU_WAKE_REMOTE] 584 | if ($domain_diff->[$TTWU_MOVE_AFFINE]); 585 | printf " %7d(%6.2f%%) ... moved that task to the waking cpu because the cpu's queue was unbalanced\n", 586 | $domain_diff->[$TTWU_MOVE_BALANCE], 587 | 100*$domain_diff->[$TTWU_MOVE_BALANCE]/$domain_diff->[$TTWU_WAKE_REMOTE] 588 | if ($domain_diff->[$TTWU_MOVE_BALANCE]); 589 | printf " %7d(%6.2f%%) ... didn't move that task\n", 590 | $domain_diff->[$TTWU_WAKE_REMOTE] - 591 | $domain_diff->[$TTWU_MOVE_AFFINE] - $domain_diff->[$TTWU_MOVE_BALANCE], 592 | 100*($domain_diff->[$TTWU_WAKE_REMOTE] - 593 | $domain_diff->[$TTWU_MOVE_AFFINE] - $domain_diff->[$TTWU_MOVE_BALANCE]) 594 | / $domain_diff->[$TTWU_WAKE_REMOTE] 595 | if ($domain_diff->[$TTWU_WAKE_REMOTE] - 596 | $domain_diff->[$TTWU_MOVE_AFFINE] - 597 | $domain_diff->[$TTWU_MOVE_BALANCE]); 598 | print "\n"; 599 | } 600 | } else { 601 | # 602 | # pull_task() stats 603 | # 604 | $pt_cnt_total = $domain_diff_all[$PT_CNT_IDLE] + 605 | $domain_diff_all[$PT_CNT_NEWIDLE] + $domain_diff_all[$PT_CNT_NOIDLE]; 606 | printf " %7d tasks pulled by pull_task()\n", $pt_cnt_total; 607 | printf " %7d(%6.2f%%) pulled from hot cpu while still cache-hot and idle\n", 608 | $domain_diff_all[$PT_HOT_IDLE], 609 | 100*$domain_diff_all[$PT_HOT_IDLE]/$pt_cnt_total 610 | if ($domain_diff_all[$PT_HOT_IDLE]); 611 | printf " %7d(%6.2f%%) pulled from cold cpu while idle\n", 612 | $domain_diff_all[$PT_CNT_IDLE] - $domain_diff_all[$PT_HOT_IDLE], 613 | 100*($domain_diff_all[$PT_CNT_IDLE] - $domain_diff_all[$PT_HOT_IDLE])/$pt_cnt_total 614 | if ($domain_diff_all[$PT_CNT_IDLE] - $domain_diff_all[$PT_HOT_IDLE]); 615 | printf " %7d(%6.2f%%) pulled from hot cpu while still cache-hot and busy\n", 616 | $domain_diff_all[$PT_HOT_NOIDLE], 617 | 100*$domain_diff_all[$PT_HOT_NOIDLE]/$pt_cnt_total 618 | if ($domain_diff_all[$PT_HOT_NOIDLE]); 619 | printf " %7d(%6.2f%%) pulled from cold cpu while busy\n", 620 | $domain_diff_all[$PT_CNT_NOIDLE] - $domain_diff_all[$PT_HOT_NOIDLE], 621 | 100*($domain_diff_all[$PT_CNT_NOIDLE] - $domain_diff_all[$PT_HOT_NOIDLE])/$pt_cnt_total 622 | if ($domain_diff_all[$PT_CNT_NOIDLE] - $domain_diff_all[$PT_HOT_NOIDLE]); 623 | printf " %7d(%6.2f%%) pulled from hot cpu while still cache-hot and newly idle\n", 624 | $domain_diff_all[$PT_HOT_NEWIDLE], 625 | 100*$domain_diff_all[$PT_HOT_NEWIDLE]/$pt_cnt_total 626 | if ($domain_diff_all[$PT_HOT_NEWIDLE]); 627 | printf " %7d(%6.2f%%) pulled from cold cpu when newly idle\n", 628 | $domain_diff_all[$PT_CNT_NEWIDLE] - $domain_diff_all[$PT_HOT_NEWIDLE], 629 | 100*($domain_diff_all[$PT_CNT_NEWIDLE] - $domain_diff_all[$PT_HOT_NEWIDLE])/$pt_cnt_total 630 | if ($domain_diff_all[$PT_CNT_NEWIDLE] - $domain_diff_all[$PT_HOT_NEWIDLE]); 631 | 632 | # 633 | # load_balance() stats 634 | # 635 | $lb_cnt_total = $domain_diff_all[$LB_CNT_IDLE] + 636 | $domain_diff_all[$LB_CNT_NEWIDLE] + 637 | $domain_diff_all[$LB_CNT_NOIDLE]; 638 | printf "\n %7d load_balance()\n", $lb_cnt_total; 639 | 640 | # 641 | # while idle 642 | # 643 | printf " %7d(%6.2f%%) called while idle\n", 644 | $domain_diff_all[$LB_CNT_IDLE], 645 | $lb_cnt_total ? 646 | 100*$domain_diff_all[$LB_CNT_IDLE]/$lb_cnt_total : 0; 647 | printf " %7d(%6.2f%%) tried but failed to move any tasks\n", 648 | $domain_diff_all[$LB_FAILED_IDLE], 649 | $domain_diff_all[$LB_CNT_IDLE] ? 650 | 100*$domain_diff_all[$LB_FAILED_IDLE]/$domain_diff_all[$LB_CNT_IDLE] : 651 | 0 652 | if ($domain_diff_all[$LB_FAILED_IDLE]); 653 | printf " %7d(%6.2f%%) found no busier queue\n", 654 | $domain_diff_all[$LB_NOBUSYQ_IDLE], 655 | $domain_diff_all[$LB_CNT_IDLE] ? 656 | 100*$domain_diff_all[$LB_NOBUSYQ_IDLE]/$domain_diff_all[$LB_CNT_IDLE] : 657 | 0 658 | if ($domain_diff_all[$LB_NOBUSYQ_IDLE]); 659 | printf " %7d(%6.2f%%) found no busier group\n", 660 | $domain_diff_all[$LB_NOBUSYG_IDLE], 661 | $domain_diff_all[$LB_CNT_IDLE] ? 662 | 100*$domain_diff_all[$LB_NOBUSYG_IDLE]/$domain_diff_all[$LB_CNT_IDLE] : 663 | 0 664 | if ($domain_diff_all[$LB_NOBUSYG_IDLE]); 665 | $tmp = $domain_diff_all[$LB_CNT_IDLE] - 666 | ($domain_diff_all[$LB_NOBUSYG_IDLE] + $domain_diff_all[$LB_NOBUSYQ_IDLE] + 667 | $domain_diff_all[$LB_FAILED_IDLE]); 668 | if ($tmp) { 669 | printf " %7d(%6.2f%%) succeeded in moving " . 670 | "at least one task\n", 671 | $tmp, $tmp ? 100*$tmp/$domain_diff_all[$LB_CNT_IDLE] : 0; 672 | $imbalance = $domain_diff_all[$LB_IMBALANCE_IDLE] / 673 | ($tmp + $domain_diff_all[$LB_FAILED_IDLE]); 674 | if ($imbalance < 10) { 675 | $fmt = "%7.3f"; 676 | } elsif ($imbalance < 100) { 677 | $fmt = "%7.2f"; 678 | } else { 679 | $fmt = "%7.1f"; 680 | } 681 | printf " (average imbalance: $fmt)\n", 682 | $imbalance; 683 | } 684 | 685 | # 686 | # while busy 687 | # 688 | printf " %7d(%6.2f%%) called while busy\n", 689 | $domain_diff_all[$LB_CNT_NOIDLE], 690 | $lb_cnt_total ? 100*$domain_diff_all[$LB_CNT_NOIDLE]/$lb_cnt_total : 0; 691 | printf " %7d(%6.2f%%) tried but failed to move any tasks\n", 692 | $domain_diff_all[$LB_FAILED_NOIDLE], 693 | $domain_diff_all[$LB_CNT_NOIDLE] ? 694 | 100*$domain_diff_all[$LB_FAILED_NOIDLE]/$domain_diff_all[$LB_CNT_NOIDLE] : 695 | 0 696 | if ($domain_diff_all[$LB_FAILED_NOIDLE]); 697 | printf " %7d(%6.2f%%) found no busier queue\n", 698 | $domain_diff_all[$LB_NOBUSYQ_NOIDLE], 699 | $domain_diff_all[$LB_CNT_NOIDLE] ? 700 | 100*$domain_diff_all[$LB_NOBUSYQ_NOIDLE]/$domain_diff_all[$LB_CNT_NOIDLE] : 701 | 0 702 | if ($domain_diff_all[$LB_NOBUSYQ_NOIDLE]); 703 | printf " %7d(%6.2f%%) found no busier group\n", 704 | $domain_diff_all[$LB_NOBUSYG_NOIDLE], 705 | $domain_diff_all[$LB_CNT_NOIDLE] ? 706 | 100*$domain_diff_all[$LB_NOBUSYG_NOIDLE]/$domain_diff_all[$LB_CNT_NOIDLE] : 707 | 0 708 | if ($domain_diff_all[$LB_NOBUSYG_NOIDLE]); 709 | $tmp = $domain_diff_all[$LB_CNT_NOIDLE] - 710 | ($domain_diff_all[$LB_NOBUSYG_NOIDLE] + 711 | $domain_diff_all[$LB_NOBUSYQ_NOIDLE] + 712 | $domain_diff_all[$LB_FAILED_NOIDLE]); 713 | if ($tmp) { 714 | printf " %7d(%6.2f%%) succeeded in moving " . 715 | "at least one task\n", 716 | $tmp, $tmp ? 100*$tmp/$domain_diff_all[$LB_CNT_NOIDLE] : 0; 717 | $imbalance = $domain_diff_all[$LB_IMBALANCE_NOIDLE] / 718 | ($tmp + $domain_diff_all[$LB_FAILED_NOIDLE]); 719 | if ($imbalance < 10) { 720 | $fmt = "%7.3f"; 721 | } elsif ($imbalance < 100) { 722 | $fmt = "%7.2f"; 723 | } else { 724 | $fmt = "%7.1f"; 725 | } 726 | printf " (average imbalance: $fmt)\n", 727 | $imbalance; 728 | } 729 | 730 | 731 | # 732 | # when newly idle 733 | # 734 | printf " %7d(%6.2f%%) called when newly idle\n", 735 | $domain_diff_all[$LB_CNT_NEWIDLE], 736 | $lb_cnt_total ? 100*$domain_diff_all[$LB_CNT_NEWIDLE]/$lb_cnt_total 737 | : 0; 738 | printf " %7d(%6.2f%%) tried but failed to move any tasks\n", 739 | $domain_diff_all[$LB_FAILED_NEWIDLE], 740 | $domain_diff_all[$LB_CNT_NEWIDLE] ? 741 | 100*$domain_diff_all[$LB_FAILED_NEWIDLE]/$domain_diff_all[$LB_CNT_NEWIDLE] : 742 | 0 743 | if ($domain_diff_all[$LB_FAILED_NEWIDLE]); 744 | printf " %7d(%6.2f%%) found no busier queue\n", 745 | $domain_diff_all[$LB_NOBUSYQ_NEWIDLE], 746 | $domain_diff_all[$LB_CNT_NEWIDLE] ? 747 | 100*$domain_diff_all[$LB_NOBUSYQ_NEWIDLE]/$domain_diff_all[$LB_CNT_NEWIDLE] : 748 | 0 749 | if ($domain_diff_all[$LB_NOBUSYQ_NEWIDLE]); 750 | printf " %7d(%6.2f%%) found no busier group\n", 751 | $domain_diff_all[$LB_NOBUSYG_NEWIDLE], 752 | $domain_diff_all[$LB_CNT_NEWIDLE] ? 753 | 100*$domain_diff_all[$LB_NOBUSYG_NEWIDLE]/$domain_diff_all[$LB_CNT_NEWIDLE] : 754 | 0 755 | if ($domain_diff_all[$LB_NOBUSYG_NEWIDLE]); 756 | $tmp = $domain_diff_all[$LB_CNT_NEWIDLE] - 757 | ($domain_diff_all[$LB_NOBUSYG_NEWIDLE] + 758 | $domain_diff_all[$LB_NOBUSYQ_NEWIDLE] + 759 | $domain_diff_all[$LB_FAILED_NEWIDLE]); 760 | if ($tmp) { 761 | printf " %7d(%6.2f%%) succeeded in moving " . 762 | "at least one task\n", 763 | $tmp, $tmp ? 100*$tmp/$domain_diff_all[$LB_CNT_NEWIDLE] : 0; 764 | $imbalance = $domain_diff_all[$LB_IMBALANCE_NEWIDLE] / 765 | ($tmp + $domain_diff_all[$LB_FAILED_NEWIDLE]); 766 | if ($imbalance < 10) { 767 | $fmt = "%7.3f"; 768 | } elsif ($imbalance < 100) { 769 | $fmt = "%7.2f"; 770 | } else { 771 | $fmt = "%7.1f"; 772 | } 773 | printf " (average imbalance: $fmt)\n", 774 | $imbalance; 775 | } 776 | 777 | # 778 | # active_load_balance() stats 779 | # 780 | printf "\n %7d active_load_balance() was called\n", 781 | $domain_diff_all[$ALB_CNT]; 782 | printf " %7d active_load_balance() tried to push a task\n", 783 | $domain_diff_all[$ALB_PUSHED] + $domain_diff_all[$ALB_FAILED] 784 | if ($domain_diff_all[$ALB_PUSHED] || $domain_diff_all[$ALB_FAILED]); 785 | printf " %7d active_load_balance() succeeded in pushing a task\n", 786 | $domain_diff_all[$ALB_PUSHED] 787 | if ($domain_diff_all[$ALB_PUSHED]); 788 | 789 | print "\n"; 790 | } 791 | } 792 | -------------------------------------------------------------------------------- /debug/gdb/kgdb_start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The default setting is based on my macbook settings, need to be changed per new env 4 | CONSOLE_IP="172.16.124.1" 5 | CONSOLE_PORT="9999" 6 | 7 | # The default setting is based on my centos 7.2 VM, need to be changed per new env 8 | HOME=~ 9 | AGENT_HOME=${HOME}/agent-proxy 10 | AGENT_PROXY=${HOME}/agent-proxy/agent-proxy 11 | # For self build kernel 12 | # DEBUG_DIR=/lib/modules/`uname -r`/build 13 | # For RHEL/CentOS/Fedora by default 14 | DEBUG_DIR=/usr/lib/debug/lib/modules/`uname -r` 15 | VMLINUX=vmlinux 16 | DEBUG_KERNEL=${DEBUG_DIR}/${VMLINUX} 17 | GDB_PY=${DEBUG_DIR}/vmlinux-gdb.py 18 | 19 | if [ x$1 != x ] ;then 20 | DEBUG_KERNEL = $1 21 | fi 22 | 23 | if [ ! -f ${DEBUG_KERNEL} ]; then 24 | echo "Can not find debug kernel at ${DEBUG_KERNEL}" 25 | echo "Please specify debug kernel path or set DEBUG_KERNEL variable" 26 | exit 1 27 | fi 28 | 29 | # Generating .gdbinit file... 30 | if [ -f ${GDB_PY} ] && [ ! -f ~/.gdbinit ]; then 31 | echo "python gdb.COMPLETE_EXPRESSION = gdb.COMPLETE_SYMBOL" > ~/.gdbinit 32 | echo "add-auto-load-safe-path ${DEBUG_DIR}/vmlinux-gdb.py" >> ~/.gdbinit 33 | else 34 | echo "please add below two lines in ~/.gdbinit" 35 | echo "python gdb.COMPLETE_EXPRESSION = gdb.COMPLETE_SYMBOL" 36 | echo "add-auto-load-safe-path ${DEBUG_DIR}/vmlinux-gdb.py" 37 | fi 38 | 39 | echo "Please make sure your serial ports between two machines get connected correctly" 40 | echo "For VMs on Mac, run **socat1** command defined in your personal .bashrc file" 41 | 42 | if [ -f ${AGENT_PROXY} ]; then 43 | PID=`pidof agent-proxy` 44 | if [ $? -eq 0 ]; then 45 | kill -9 $PID 46 | fi 47 | ${AGENT_PROXY} 2223^2222 ${CONSOLE_IP} ${CONSOLE_PORT} & 48 | else 49 | echo "Download source code and build the tool first" 50 | cd ${HOME};git clone http://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git; 51 | cd ${AGENT_HOME};make all 52 | echo "Build complete...please run this tool again" 53 | exit 0 54 | fi 55 | 56 | echo "####Hints to use kgdb on target machine####" 57 | echo "echo 'kbd,ttyS0' > /sys/module/kgdboc/parameters/kgdboc" 58 | echo "echo g > /proc/sysrq-trigger" 59 | echo "" 60 | echo "####Hints to use kgdb on client####" 61 | echo "Please telnet 127.0.0.1 2223 for console access" 62 | echo "Start gdb client, please make sure you installed linux gdb" 63 | echo "Use this gdb command to connect: target remote 127.0.0.1:2222" 64 | echo "Dedailed information, see: http://oliveryang.net/2015/08/using-kgdb-debug-linux-kernel-2" 65 | 66 | # The vmlinux-gdb.py requires enter the debug dir first, then gdb vmlinux 67 | cd ${DEBUG_DIR}; gdb ${VMLINUX} 68 | 69 | exit 0 70 | -------------------------------------------------------------------------------- /debug/systemtap/bio_sectors.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap 2 | /* 3 | * bio_sectors.stp Measure storage (bio) I/O size distribution. 4 | * For Linux, uses SystemTap (non-debuginfo). 5 | * 6 | * USAGE: ./bio_sectors.stp 7 | * 8 | * This script uses the kernel tracepoint block_rq_insert. The output includes 9 | * the name of the process or thread that was on-CPU when the I/O request was 10 | * inserted on the issue queue. 11 | * 12 | * The code was based on below file, 13 | * 14 | * https://sourceware.org/systemtap/examples/lwtools/bitesize-nd.stp 15 | * 16 | * From systemtap-lwtools: https://github.com/brendangregg/systemtap-lwtools 17 | * 18 | * See the corresponding man page (in systemtap-lwtools) for more info. 19 | */ 20 | 21 | global sz; 22 | 23 | probe begin 24 | { 25 | printf("Tracing block I/O... Hit Ctrl-C to end.\n"); 26 | } 27 | 28 | probe kernel.trace("block_rq_insert") { 29 | /* 30 | * You aren't supposed to access __data_len directly as it is internal, 31 | * but I don't see another way... 32 | * Get number of sectors based on bytes 33 | */ 34 | sz[execname()] <<< $rq->__data_len >> 9; 35 | } 36 | 37 | probe end 38 | { 39 | printf("\nI/O size (sectors):\n\n"); 40 | foreach (name in sz+) { 41 | printf("process name: %s\n", name); 42 | print(@hist_log(sz[name])); 43 | } 44 | delete sz; 45 | } 46 | -------------------------------------------------------------------------------- /debug/systemtap/devmem_enable.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap -g 2 | 3 | probe kernel.function("devmem_is_allowed").return { 4 | $return = 1; 5 | } 6 | -------------------------------------------------------------------------------- /debug/systemtap/fiohist.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap 2 | global pid = 0, trace = 0 3 | global opens, reads, writes, totals 4 | 5 | probe begin { 6 | printf("starting probe\n") 7 | %( $# > 1 %? log("ERROR: argument can't be more than 1") exit() %) 8 | %( $# == 1 %? pid = $1 %: trace = 1 %) 9 | } 10 | 11 | probe syscall.open { 12 | if (trace || pid() == pid) { 13 | e=execname(); 14 | opens[e] <<< 1 # statistics array 15 | } 16 | } 17 | 18 | probe syscall.read.return { 19 | if (trace || pid() == pid) { 20 | count = $return 21 | if ( count >= 0 ) { 22 | e=execname(); 23 | reads[e] <<< count # statistics array 24 | totals[e] += count 25 | } 26 | } 27 | } 28 | 29 | probe syscall.write.return { 30 | if (trace || pid() == pid) { 31 | count = $return 32 | if (count >= 0 ) { 33 | e=execname(); 34 | writes[e] <<< count # statistics array 35 | totals[e] += count 36 | } 37 | } 38 | } 39 | 40 | probe end { 41 | header = 1 42 | foreach (name in totals- limit 10) { # sort by total io 43 | if (header) { 44 | printf("\nIO Summary:\n\n") 45 | printf("\n%16s %8s %8s %8s %8s %8s %8s %8s\n", 46 | "", "", "", "read", "read", "", "write", "write") 47 | printf("%16s %8s %8s %8s %8s %8s %8s %8s\n", 48 | "name", "open", "read", "KB tot", "B avg", "write", "KB tot", "B avg") 49 | header = 0 50 | } 51 | printf("%16s %8d %8d %8d %8d %8d %8d %8d\n", 52 | name, @count(opens[name]), 53 | @count(reads[name]), 54 | (@count(reads[name]) ? @sum(reads[name])>>10 : 0 ), 55 | (@count(reads[name]) ? @avg(reads[name]) : 0 ), 56 | @count(writes[name]), 57 | (@count(writes[name]) ? @sum(writes[name])>>10 : 0 ), 58 | (@count(writes[name]) ? @avg(writes[name]) : 0 )) 59 | } 60 | 61 | header = 1 62 | foreach (name in reads- limit 10) { # sort by reads 63 | if (header) { 64 | printf("\nRead I/O size (bytes):\n\n") 65 | header = 0 66 | } 67 | printf("process name: %s\n", name) 68 | print(@hist_log(reads[name])) 69 | } 70 | 71 | header = 1 72 | foreach (name in writes- limit 10) { # sort by writes 73 | if (header) { 74 | printf("\nWrite I/O size (bytes):\n\n") 75 | header = 0 76 | } 77 | printf("process name: %s\n", name) 78 | print(@hist_log(writes[name])) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /debug/systemtap/kgdb.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap -g 2 | 3 | %{ 4 | #include 5 | int once = 1; 6 | %} 7 | 8 | function kgdb_once() %{ 9 | /* guru */ 10 | if (once) { 11 | kgdb_breakpoint(); 12 | once = 0; 13 | } 14 | %} 15 | 16 | probe kernel.function("generic_make_request") { 17 | kgdb_once() 18 | print("Exit from kgdb\n") 19 | exit() 20 | } 21 | -------------------------------------------------------------------------------- /debug/systemtap/mdelay_inject.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap -g 2 | # 3 | 4 | %{ 5 | #include 6 | int once = 1; 7 | %} 8 | 9 | function mdelay_once(msec:long) %{ 10 | /* guru */ 11 | if (once) { 12 | mdelay(STAP_ARG_msec); 13 | once = 0; 14 | } 15 | %} 16 | 17 | probe kernel.function("sys_read") { 18 | if (execname() == "cat") { 19 | msec = $1 20 | mdelay_once(msec) 21 | exit() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /debug/systemtap/msleep_inject.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap -g 2 | # 3 | 4 | %{ 5 | int once = 1; 6 | %} 7 | 8 | function msleep_once(msec:long) %{ 9 | /* guru */ 10 | if (once) { 11 | msleep(STAP_ARG_msec); 12 | once = 0; 13 | } 14 | %} 15 | 16 | probe kernel.function("sys_read") { 17 | if (execname() == "cat") { 18 | msec = $1 19 | msleep_once(msec) 20 | exit() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /debug/systemtap/sysrq.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap -g 2 | # 3 | # Before using it, please boot kernel with sysrq_always_enabled=true 4 | # Or just run 'wr sysrq_always_enabled 1' in crash tool 5 | 6 | %{ 7 | #include 8 | int once = 1; 9 | %} 10 | 11 | function sysrq_once(key:long) %{ 12 | /* guru */ 13 | if (once) { 14 | handle_sysrq(STAP_ARG_key); 15 | once = 0; 16 | } 17 | %} 18 | 19 | probe kernel.function("generic_make_request") { 20 | sysrq_once(0x67) 21 | print("Sent a sysrq\n") 22 | exit() 23 | } 24 | -------------------------------------------------------------------------------- /github/github_merge_upstream.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LINE=$(git remote | grep "^upstream$" | wc -l) 4 | 5 | if (($LINE != 1)); then 6 | printf "Error: please setup upstream branch fist\n" 7 | fi 8 | 9 | git fetch upstream 10 | 11 | git merge upstream/master 12 | -------------------------------------------------------------------------------- /github/km2bdmap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | usage(){ 4 | echo "Usage: $0 [*.md]" 5 | exit 1 6 | } 7 | 8 | [[ $# -eq 0 ]] && usage 9 | 10 | if [ x$1 != x ] 11 | then 12 | FILE_MD=$1 13 | else 14 | echo "***Error: Need a device vector name" 15 | usage 16 | fi 17 | 18 | FILE_TXT="${FILE_MD}.txt" 19 | 20 | grep -E "^- |^ .*- " ${FILE_MD} | sed "s/- //g" | sed "s/ / /g" > ${FILE_TXT} 21 | 22 | echo "File has been converted into ${FILE_TXT}" 23 | -------------------------------------------------------------------------------- /github/spelling.txt: -------------------------------------------------------------------------------- 1 | # Originally from Debian's Lintian tool. Various false positives have been 2 | # removed, and various additions have been made as they've been discovered 3 | # in the kernel source. 4 | # 5 | # License: GPLv2 6 | # 7 | # The format of each line is: 8 | # mistake||correction 9 | # 10 | abandonning||abandoning 11 | abigious||ambiguous 12 | abitrate||arbitrate 13 | abov||above 14 | abreviated||abbreviated 15 | absense||absence 16 | absolut||absolute 17 | absoulte||absolute 18 | acccess||access 19 | acceleratoin||acceleration 20 | accelleration||acceleration 21 | accesing||accessing 22 | accesnt||accent 23 | accessable||accessible 24 | accesss||access 25 | accidentaly||accidentally 26 | accidentually||accidentally 27 | accoding||according 28 | accomodate||accommodate 29 | accomodates||accommodates 30 | accordign||according 31 | accoring||according 32 | accout||account 33 | accquire||acquire 34 | accquired||acquired 35 | acessable||accessible 36 | acess||access 37 | achitecture||architecture 38 | acient||ancient 39 | acitions||actions 40 | acitve||active 41 | acknowldegement||acknowldegement 42 | acknowledgement||acknowledgment 43 | ackowledge||acknowledge 44 | ackowledged||acknowledged 45 | acording||according 46 | activete||activate 47 | acumulating||accumulating 48 | adapater||adapter 49 | addional||additional 50 | additionaly||additionally 51 | addres||address 52 | addreses||addresses 53 | addresss||address 54 | aditional||additional 55 | aditionally||additionally 56 | aditionaly||additionally 57 | adminstrative||administrative 58 | adress||address 59 | adresses||addresses 60 | adviced||advised 61 | afecting||affecting 62 | agaist||against 63 | albumns||albums 64 | alegorical||allegorical 65 | algorith||algorithm 66 | algorithmical||algorithmically 67 | algoritm||algorithm 68 | algoritms||algorithms 69 | algorrithm||algorithm 70 | algorritm||algorithm 71 | allign||align 72 | allocatrd||allocated 73 | allocte||allocate 74 | allpication||application 75 | alocate||allocate 76 | alogirhtms||algorithms 77 | alogrithm||algorithm 78 | alot||a lot 79 | alow||allow 80 | alows||allows 81 | altough||although 82 | alue||value 83 | ambigious||ambiguous 84 | amoung||among 85 | amout||amount 86 | analysator||analyzer 87 | ang||and 88 | anniversery||anniversary 89 | annoucement||announcement 90 | anomolies||anomalies 91 | anomoly||anomaly 92 | anway||anyway 93 | aplication||application 94 | appearence||appearance 95 | applicaion||application 96 | appliction||application 97 | applictions||applications 98 | appplications||applications 99 | appropiate||appropriate 100 | appropriatly||appropriately 101 | approriate||appropriate 102 | approriately||appropriately 103 | aquainted||acquainted 104 | aquired||acquired 105 | arbitary||arbitrary 106 | architechture||architecture 107 | arguement||argument 108 | arguements||arguments 109 | aritmetic||arithmetic 110 | arne't||aren't 111 | arraival||arrival 112 | artifical||artificial 113 | artillary||artillery 114 | assiged||assigned 115 | assigment||assignment 116 | assigments||assignments 117 | assistent||assistant 118 | assocation||association 119 | associcated||associated 120 | assotiated||associated 121 | assum||assume 122 | assumtpion||assumption 123 | asuming||assuming 124 | asycronous||asynchronous 125 | asynchnous||asynchronous 126 | atomatically||automatically 127 | atomicly||atomically 128 | attachement||attachment 129 | attched||attached 130 | attemps||attempts 131 | attruibutes||attributes 132 | authentification||authentication 133 | automaticaly||automatically 134 | automaticly||automatically 135 | automatize||automate 136 | automatized||automated 137 | automatizes||automates 138 | autonymous||autonomous 139 | auxilliary||auxiliary 140 | avaiable||available 141 | avaible||available 142 | availabe||available 143 | availabled||available 144 | availablity||availability 145 | availale||available 146 | availavility||availability 147 | availble||available 148 | availiable||available 149 | avalable||available 150 | avaliable||available 151 | aysnc||async 152 | backgroud||background 153 | backword||backward 154 | backwords||backwards 155 | bahavior||behavior 156 | bakup||backup 157 | baloon||balloon 158 | baloons||balloons 159 | bandwith||bandwidth 160 | batery||battery 161 | beacuse||because 162 | becasue||because 163 | becomming||becoming 164 | becuase||because 165 | beeing||being 166 | befor||before 167 | begining||beginning 168 | beter||better 169 | betweeen||between 170 | bianries||binaries 171 | bitmast||bitmask 172 | boardcast||broadcast 173 | borad||board 174 | boundry||boundary 175 | brievely||briefly 176 | broadcat||broadcast 177 | cacluated||calculated 178 | caculation||calculation 179 | calender||calendar 180 | calle||called 181 | calucate||calculate 182 | calulate||calculate 183 | cancelation||cancellation 184 | capabilites||capabilities 185 | capabitilies||capabilities 186 | capatibilities||capabilities 187 | carefuly||carefully 188 | cariage||carriage 189 | catagory||category 190 | challange||challenge 191 | challanges||challenges 192 | chanell||channel 193 | changable||changeable 194 | channle||channel 195 | channnel||channel 196 | charachter||character 197 | charachters||characters 198 | charactor||character 199 | charater||character 200 | charaters||characters 201 | charcter||character 202 | checksuming||checksumming 203 | childern||children 204 | childs||children 205 | chiled||child 206 | chked||checked 207 | chnage||change 208 | chnages||changes 209 | chnnel||channel 210 | choosen||chosen 211 | chouse||chose 212 | circumvernt||circumvent 213 | claread||cleared 214 | clared||cleared 215 | closeing||closing 216 | clustred||clustered 217 | collapsable||collapsible 218 | colorfull||colorful 219 | comand||command 220 | comit||commit 221 | commerical||commercial 222 | comming||coming 223 | comminucation||communication 224 | commited||committed 225 | commiting||committing 226 | committ||commit 227 | commoditiy||commodity 228 | compability||compatibility 229 | compaibility||compatibility 230 | compatability||compatibility 231 | compatable||compatible 232 | compatibiliy||compatibility 233 | compatibilty||compatibility 234 | compilant||compliant 235 | compleatly||completely 236 | completly||completely 237 | complient||compliant 238 | componnents||components 239 | compres||compress 240 | compresion||compression 241 | comression||compression 242 | comunication||communication 243 | conbination||combination 244 | conditionaly||conditionally 245 | conected||connected 246 | configuratoin||configuration 247 | configuraton||configuration 248 | configuretion||configuration 249 | conider||consider 250 | conjuction||conjunction 251 | connectinos||connections 252 | connnection||connection 253 | connnections||connections 254 | consistancy||consistency 255 | consistant||consistent 256 | containes||contains 257 | containts||contains 258 | contaisn||contains 259 | contant||contact 260 | contence||contents 261 | continous||continuous 262 | continously||continuously 263 | continueing||continuing 264 | contraints||constraints 265 | controled||controlled 266 | controler||controller 267 | controll||control 268 | contruction||construction 269 | contry||country 270 | convertion||conversion 271 | convertor||converter 272 | convienient||convenient 273 | convinient||convenient 274 | corected||corrected 275 | correponding||corresponding 276 | correponds||corresponds 277 | correspoding||corresponding 278 | cotrol||control 279 | couter||counter 280 | coutner||counter 281 | cryptocraphic||cryptographic 282 | cunter||counter 283 | curently||currently 284 | dafault||default 285 | deafult||default 286 | deamon||daemon 287 | decompres||decompress 288 | decription||description 289 | defailt||default 290 | defferred||deferred 291 | definate||definite 292 | definately||definitely 293 | defintion||definition 294 | defualt||default 295 | defult||default 296 | deivce||device 297 | delared||declared 298 | delare||declare 299 | delares||declares 300 | delaring||declaring 301 | delemiter||delimiter 302 | dependancies||dependencies 303 | dependancy||dependency 304 | dependant||dependent 305 | depreacted||deprecated 306 | depreacte||deprecate 307 | desactivate||deactivate 308 | desciptors||descriptors 309 | descrition||description 310 | descritptor||descriptor 311 | desctiptor||descriptor 312 | desriptor||descriptor 313 | desriptors||descriptors 314 | destory||destroy 315 | destoryed||destroyed 316 | destorys||destroys 317 | destroied||destroyed 318 | detabase||database 319 | develope||develop 320 | developement||development 321 | developped||developed 322 | developpement||development 323 | developper||developer 324 | developpment||development 325 | deveolpment||development 326 | devided||divided 327 | deviece||device 328 | diable||disable 329 | dictionnary||dictionary 330 | diferent||different 331 | differrence||difference 332 | difinition||definition 333 | diplay||display 334 | direectly||directly 335 | disapear||disappear 336 | disapeared||disappeared 337 | disappared||disappeared 338 | disconnet||disconnect 339 | discontinous||discontinuous 340 | dispertion||dispersion 341 | dissapears||disappears 342 | distiction||distinction 343 | docuentation||documentation 344 | documantation||documentation 345 | documentaion||documentation 346 | documment||document 347 | dorp||drop 348 | dosen||doesn 349 | downlad||download 350 | downlads||downloads 351 | druing||during 352 | dynmaic||dynamic 353 | easilly||easily 354 | ecspecially||especially 355 | edditable||editable 356 | editting||editing 357 | efficently||efficiently 358 | ehther||ether 359 | eigth||eight 360 | eletronic||electronic 361 | enabledi||enabled 362 | enchanced||enhanced 363 | encorporating||incorporating 364 | encrupted||encrypted 365 | encrypiton||encryption 366 | endianess||endianness 367 | enhaced||enhanced 368 | enlightnment||enlightenment 369 | enocded||encoded 370 | enterily||entirely 371 | enviroiment||environment 372 | enviroment||environment 373 | environement||environment 374 | environent||environment 375 | eqivalent||equivalent 376 | equiped||equipped 377 | equivelant||equivalent 378 | equivilant||equivalent 379 | eror||error 380 | estbalishment||establishment 381 | etsablishment||establishment 382 | etsbalishment||establishment 383 | excecutable||executable 384 | exceded||exceeded 385 | excellant||excellent 386 | existance||existence 387 | existant||existent 388 | exixt||exist 389 | exlcude||exclude 390 | exlcusive||exclusive 391 | exmaple||example 392 | expecially||especially 393 | explicite||explicit 394 | explicitely||explicitly 395 | explict||explicit 396 | explictly||explicitly 397 | expresion||expression 398 | exprimental||experimental 399 | extened||extended 400 | extensability||extensibility 401 | extention||extension 402 | extracter||extractor 403 | faild||failed 404 | faill||fail 405 | failue||failure 406 | failuer||failure 407 | faireness||fairness 408 | faliure||failure 409 | familar||familiar 410 | fatser||faster 411 | feauture||feature 412 | feautures||features 413 | fetaure||feature 414 | fetaures||features 415 | fileystem||filesystem 416 | finanize||finalize 417 | findn||find 418 | finilizes||finalizes 419 | finsih||finish 420 | flusing||flushing 421 | folloing||following 422 | followign||following 423 | follwing||following 424 | forseeable||foreseeable 425 | forse||force 426 | fortan||fortran 427 | forwardig||forwarding 428 | framwork||framework 429 | frequncy||frequency 430 | frome||from 431 | fucntion||function 432 | fuction||function 433 | fuctions||functions 434 | funcion||function 435 | functionallity||functionality 436 | functionaly||functionally 437 | functionnality||functionality 438 | functonality||functionality 439 | funtion||function 440 | funtions||functions 441 | furthur||further 442 | futhermore||furthermore 443 | futrue||future 444 | gaurenteed||guaranteed 445 | generiously||generously 446 | genric||generic 447 | globel||global 448 | grabing||grabbing 449 | grahical||graphical 450 | grahpical||graphical 451 | grapic||graphic 452 | guage||gauge 453 | guarentee||guarantee 454 | halfs||halves 455 | hander||handler 456 | handfull||handful 457 | hanled||handled 458 | harware||hardware 459 | heirarchically||hierarchically 460 | helpfull||helpful 461 | hierachy||hierarchy 462 | hierarchie||hierarchy 463 | howver||however 464 | hsould||should 465 | hypter||hyper 466 | identidier||identifier 467 | imblance||imbalance 468 | immeadiately||immediately 469 | immedaite||immediate 470 | immediatelly||immediately 471 | immediatly||immediately 472 | immidiate||immediate 473 | impelentation||implementation 474 | impementated||implemented 475 | implemantation||implementation 476 | implemenation||implementation 477 | implementaiton||implementation 478 | implementated||implemented 479 | implemention||implementation 480 | implemetation||implementation 481 | implemntation||implementation 482 | implentation||implementation 483 | implmentation||implementation 484 | implmenting||implementing 485 | incomming||incoming 486 | incompatabilities||incompatibilities 487 | incompatable||incompatible 488 | inconsistant||inconsistent 489 | increas||increase 490 | incrment||increment 491 | indendation||indentation 492 | indended||intended 493 | independant||independent 494 | independantly||independently 495 | independed||independent 496 | indiate||indicate 497 | inexpect||inexpected 498 | infomation||information 499 | informatiom||information 500 | informations||information 501 | informtion||information 502 | infromation||information 503 | ingore||ignore 504 | inital||initial 505 | initalised||initialized 506 | initalise||initialize 507 | initalize||initialize 508 | initation||initiation 509 | initators||initiators 510 | initializiation||initialization 511 | initialzed||initialized 512 | initilization||initialization 513 | initilize||initialize 514 | inofficial||unofficial 515 | instal||install 516 | inteface||interface 517 | integreated||integrated 518 | integrety||integrity 519 | integrey||integrity 520 | intendet||intended 521 | intented||intended 522 | interanl||internal 523 | interchangable||interchangeable 524 | interferring||interfering 525 | interger||integer 526 | intermittant||intermittent 527 | internel||internal 528 | interoprability||interoperability 529 | interrface||interface 530 | interrrupt||interrupt 531 | interrup||interrupt 532 | interrups||interrupts 533 | interruptted||interrupted 534 | interupted||interrupted 535 | interupt||interrupt 536 | intial||initial 537 | intialized||initialized 538 | intialize||initialize 539 | intregral||integral 540 | intrrupt||interrupt 541 | intuative||intuitive 542 | invaid||invalid 543 | invalde||invald 544 | invalide||invalid 545 | invididual||individual 546 | invokation||invocation 547 | invokations||invocations 548 | irrelevent||irrelevant 549 | isssue||issue 550 | itslef||itself 551 | jave||java 552 | jeffies||jiffies 553 | juse||just 554 | jus||just 555 | kown||known 556 | langage||language 557 | langauage||language 558 | langauge||language 559 | langugage||language 560 | lauch||launch 561 | leightweight||lightweight 562 | lengh||length 563 | lenght||length 564 | lenth||length 565 | lesstiff||lesstif 566 | libaries||libraries 567 | libary||library 568 | librairies||libraries 569 | libraris||libraries 570 | licenceing||licencing 571 | loggging||logging 572 | loggin||login 573 | logile||logfile 574 | loosing||losing 575 | losted||lost 576 | machinary||machinery 577 | maintainance||maintenance 578 | maintainence||maintenance 579 | maintan||maintain 580 | makeing||making 581 | malplaced||misplaced 582 | malplace||misplace 583 | managable||manageable 584 | managment||management 585 | mangement||management 586 | manoeuvering||maneuvering 587 | mappping||mapping 588 | mathimatical||mathematical 589 | mathimatic||mathematic 590 | mathimatics||mathematics 591 | maxium||maximum 592 | mechamism||mechanism 593 | meetign||meeting 594 | ment||meant 595 | mergable||mergeable 596 | mesage||message 597 | messags||messages 598 | messgaes||messages 599 | messsage||message 600 | messsages||messages 601 | microprocesspr||microprocessor 602 | milliseonds||milliseconds 603 | minumum||minimum 604 | miscelleneous||miscellaneous 605 | misformed||malformed 606 | mispelled||misspelled 607 | mispelt||misspelt 608 | miximum||maximum 609 | mmnemonic||mnemonic 610 | mnay||many 611 | modeled||modelled 612 | modulues||modules 613 | monochorome||monochrome 614 | monochromo||monochrome 615 | monocrome||monochrome 616 | mopdule||module 617 | mroe||more 618 | mulitplied||multiplied 619 | multidimensionnal||multidimensional 620 | multple||multiple 621 | mumber||number 622 | muticast||multicast 623 | mutiple||multiple 624 | mutli||multi 625 | nams||names 626 | navagating||navigating 627 | nead||need 628 | neccecary||necessary 629 | neccesary||necessary 630 | neccessary||necessary 631 | necesary||necessary 632 | negaive||negative 633 | negoitation||negotiation 634 | negotation||negotiation 635 | nerver||never 636 | nescessary||necessary 637 | nessessary||necessary 638 | noticable||noticeable 639 | notications||notifications 640 | notifed||notified 641 | numebr||number 642 | numner||number 643 | obtaion||obtain 644 | occassionally||occasionally 645 | occationally||occasionally 646 | occurance||occurrence 647 | occurances||occurrences 648 | occured||occurred 649 | occurence||occurrence 650 | occure||occurred 651 | occuring||occurring 652 | offet||offset 653 | omitt||omit 654 | ommiting||omitting 655 | ommitted||omitted 656 | onself||oneself 657 | ony||only 658 | operatione||operation 659 | opertaions||operations 660 | optionnal||optional 661 | optmizations||optimizations 662 | orientatied||orientated 663 | orientied||oriented 664 | otherise||otherwise 665 | ouput||output 666 | overaall||overall 667 | overhread||overhead 668 | overlaping||overlapping 669 | overriden||overridden 670 | overun||overrun 671 | pacakge||package 672 | pachage||package 673 | packacge||package 674 | packege||package 675 | packge||package 676 | packtes||packets 677 | pakage||package 678 | pallette||palette 679 | paln||plan 680 | paramameters||parameters 681 | paramater||parameter 682 | parametes||parameters 683 | parametised||parametrised 684 | paramter||parameter 685 | paramters||parameters 686 | particuarly||particularly 687 | particularily||particularly 688 | pased||passed 689 | passin||passing 690 | pathes||paths 691 | pecularities||peculiarities 692 | peformance||performance 693 | peice||piece 694 | pendantic||pedantic 695 | peprocessor||preprocessor 696 | perfoming||performing 697 | permissons||permissions 698 | peroid||period 699 | persistance||persistence 700 | persistant||persistent 701 | platfrom||platform 702 | plattform||platform 703 | pleaes||please 704 | ploting||plotting 705 | plugable||pluggable 706 | poinnter||pointer 707 | poiter||pointer 708 | posible||possible 709 | positon||position 710 | possibilites||possibilities 711 | powerfull||powerful 712 | preceeded||preceded 713 | preceeding||preceding 714 | preceed||precede 715 | precendence||precedence 716 | precission||precision 717 | prefered||preferred 718 | prefferably||preferably 719 | premption||preemption 720 | prepaired||prepared 721 | pressre||pressure 722 | primative||primitive 723 | princliple||principle 724 | priorty||priority 725 | privilaged||privileged 726 | privilage||privilege 727 | priviledge||privilege 728 | priviledges||privileges 729 | probaly||probably 730 | procceed||proceed 731 | proccesors||processors 732 | procesed||processed 733 | proces||process 734 | processessing||processing 735 | processess||processes 736 | processpr||processor 737 | processsed||processed 738 | processsing||processing 739 | procteted||protected 740 | prodecure||procedure 741 | progams||programs 742 | progess||progress 743 | programers||programmers 744 | programm||program 745 | programms||programs 746 | progresss||progress 747 | promps||prompts 748 | pronnounced||pronounced 749 | prononciation||pronunciation 750 | pronouce||pronounce 751 | pronunce||pronounce 752 | propery||property 753 | propigate||propagate 754 | propigation||propagation 755 | propogate||propagate 756 | prosess||process 757 | protable||portable 758 | protcol||protocol 759 | protecion||protection 760 | protocoll||protocol 761 | psudo||pseudo 762 | psuedo||pseudo 763 | psychadelic||psychedelic 764 | pwoer||power 765 | quering||querying 766 | raoming||roaming 767 | reasearcher||researcher 768 | reasearchers||researchers 769 | reasearch||research 770 | recepient||recipient 771 | receving||receiving 772 | recieved||received 773 | recieve||receive 774 | reciever||receiver 775 | recieves||receives 776 | recogniced||recognised 777 | recognizeable||recognizable 778 | recommanded||recommended 779 | recyle||recycle 780 | redircet||redirect 781 | redirectrion||redirection 782 | refcounf||refcount 783 | refence||reference 784 | refered||referred 785 | referenace||reference 786 | refering||referring 787 | refernces||references 788 | refernnce||reference 789 | refrence||reference 790 | registerd||registered 791 | registeresd||registered 792 | registes||registers 793 | registraration||registration 794 | regster||register 795 | regualar||regular 796 | reguator||regulator 797 | regulamentations||regulations 798 | reigstration||registration 799 | releated||related 800 | relevent||relevant 801 | remoote||remote 802 | remore||remote 803 | removeable||removable 804 | repectively||respectively 805 | replacable||replaceable 806 | replacments||replacements 807 | replys||replies 808 | reponse||response 809 | representaion||representation 810 | reqeust||request 811 | requiere||require 812 | requirment||requirement 813 | requred||required 814 | requried||required 815 | requst||request 816 | reseting||resetting 817 | resizeable||resizable 818 | resouces||resources 819 | resoures||resources 820 | ressizes||resizes 821 | ressource||resource 822 | ressources||resources 823 | retransmited||retransmitted 824 | retreived||retrieved 825 | retreive||retrieve 826 | retrive||retrieve 827 | retuned||returned 828 | reuest||request 829 | reuqest||request 830 | reutnred||returned 831 | rmeoved||removed 832 | rmeove||remove 833 | rmeoves||removes 834 | rountine||routine 835 | routins||routines 836 | rquest||request 837 | runing||running 838 | runned||ran 839 | runnning||running 840 | runtine||runtime 841 | sacrifying||sacrificing 842 | safly||safely 843 | safty||safety 844 | savable||saveable 845 | scaned||scanned 846 | scaning||scanning 847 | scarch||search 848 | seach||search 849 | searchs||searches 850 | secquence||sequence 851 | secund||second 852 | segement||segment 853 | senarios||scenarios 854 | sentivite||sensitive 855 | separatly||separately 856 | sepcify||specify 857 | sepc||spec 858 | seperated||separated 859 | seperately||separately 860 | seperate||separate 861 | seperatly||separately 862 | seperator||separator 863 | sepperate||separate 864 | sequece||sequence 865 | sequencial||sequential 866 | serveral||several 867 | setts||sets 868 | settting||setting 869 | shotdown||shutdown 870 | shoud||should 871 | shoule||should 872 | shrinked||shrunk 873 | siginificantly||significantly 874 | signabl||signal 875 | similary||similarly 876 | similiar||similar 877 | simlar||similar 878 | simliar||similar 879 | simpified||simplified 880 | singaled||signaled 881 | singal||signal 882 | singed||signed 883 | sleeped||slept 884 | softwares||software 885 | speach||speech 886 | specfic||specific 887 | speciefied||specified 888 | specifc||specific 889 | specifed||specified 890 | specificatin||specification 891 | specificaton||specification 892 | specifing||specifying 893 | specifiying||specifying 894 | speficied||specified 895 | speicify||specify 896 | speling||spelling 897 | spinlcok||spinlock 898 | spinock||spinlock 899 | splitted||split 900 | spreaded||spread 901 | sructure||structure 902 | stablilization||stabilization 903 | staically||statically 904 | staion||station 905 | standardss||standards 906 | standartization||standardization 907 | standart||standard 908 | staticly||statically 909 | stoped||stopped 910 | stoppped||stopped 911 | straming||streaming 912 | struc||struct 913 | structres||structures 914 | stuct||struct 915 | sturcture||structure 916 | subdirectoires||subdirectories 917 | suble||subtle 918 | succesfully||successfully 919 | succesful||successful 920 | successfull||successful 921 | sucessfully||successfully 922 | sucess||success 923 | superflous||superfluous 924 | superseeded||superseded 925 | suplied||supplied 926 | suported||supported 927 | suport||support 928 | suppored||supported 929 | supportin||supporting 930 | suppoted||supported 931 | suppported||supported 932 | suppport||support 933 | supress||suppress 934 | surpresses||suppresses 935 | susbsystem||subsystem 936 | suspicously||suspiciously 937 | swaping||swapping 938 | switchs||switches 939 | symetric||symmetric 940 | synax||syntax 941 | synchonized||synchronized 942 | syncronize||synchronize 943 | syncronizing||synchronizing 944 | syncronus||synchronous 945 | syste||system 946 | sytem||system 947 | sythesis||synthesis 948 | taht||that 949 | targetted||targeted 950 | targetting||targeting 951 | teh||the 952 | temorary||temporary 953 | temproarily||temporarily 954 | thier||their 955 | threds||threads 956 | threshhold||threshold 957 | throught||through 958 | thses||these 959 | tiggered||triggered 960 | tipically||typically 961 | tmis||this 962 | torerable||tolerable 963 | tramsmitted||transmitted 964 | tramsmit||transmit 965 | tranfer||transfer 966 | transciever||transceiver 967 | transferd||transferrd 968 | transfered||transferred 969 | transfering||transferring 970 | transision||transition 971 | transmittd||transmitted 972 | transormed||transformed 973 | trasmission||transmission 974 | treshold||threshold 975 | trigerring||triggering 976 | trun||turn 977 | ture||true 978 | tyep||type 979 | udpate||update 980 | uesd||used 981 | unconditionaly||unconditionally 982 | underun||underrun 983 | unecessary||unnecessary 984 | unexecpted||unexpected 985 | unexpectd||unexpected 986 | unexpeted||unexpected 987 | unfortunatelly||unfortunately 988 | unifiy||unify 989 | unknonw||unknown 990 | unknow||unknown 991 | unkown||unknown 992 | unneedingly||unnecessarily 993 | unresgister||unregister 994 | unsinged||unsigned 995 | unstabel||unstable 996 | unsuccessfull||unsuccessful 997 | unsuported||unsupported 998 | untill||until 999 | unuseful||useless 1000 | upate||update 1001 | usefule||useful 1002 | usefull||useful 1003 | usege||usage 1004 | usera||users 1005 | usualy||usually 1006 | utilites||utilities 1007 | utillities||utilities 1008 | utilties||utilities 1009 | utiltity||utility 1010 | utitity||utility 1011 | utitlty||utility 1012 | vaid||valid 1013 | vaild||valid 1014 | valide||valid 1015 | variantions||variations 1016 | varient||variant 1017 | vaule||value 1018 | verbse||verbose 1019 | verisons||versions 1020 | verison||version 1021 | verson||version 1022 | vicefersa||vice-versa 1023 | virtal||virtual 1024 | virtaul||virtual 1025 | virtiual||virtual 1026 | visiters||visitors 1027 | vitual||virtual 1028 | wating||waiting 1029 | whataver||whatever 1030 | whenver||whenever 1031 | wheter||whether 1032 | whe||when 1033 | wierd||weird 1034 | wiil||will 1035 | wirte||write 1036 | withing||within 1037 | wnat||want 1038 | workarould||workaround 1039 | writeing||writing 1040 | writting||writing 1041 | zombe||zombie 1042 | zomebie||zombie 1043 | -------------------------------------------------------------------------------- /interrupt/chk_intr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILE=/proc/interrupts 4 | 5 | usage(){ 6 | echo "Usage: $0 vector_name [interrupts file]" 7 | exit 1 8 | } 9 | 10 | [[ $# -eq 0 ]] && usage 11 | 12 | 13 | if [ x$1 != x ] 14 | then 15 | DEV=$1 16 | else 17 | echo "***Error: Need a device vector name" 18 | usage 19 | fi 20 | 21 | if [ x$2 != x ] 22 | then 23 | FILE=$2 24 | else 25 | echo "No file specified, will use $FILE by default" 26 | fi 27 | 28 | output=$(awk 'NR==1 { 29 | dev_count = 0 30 | 31 | if ( $1 == "CPU0") { 32 | core_count = NF 33 | for (i = 1; i <= core_count; i++) 34 | names[i-1] = $i 35 | next 36 | } else { 37 | core_count = NF-3 38 | for (i = 0; i <= core_count; i++) 39 | names[i] = "CPU"i 40 | } 41 | } 42 | /'"$DEV"'/ { 43 | if (NF-core_count>3) { 44 | dev[dev_count++] = $(NF-1) $NF 45 | } else { 46 | dev[dev_count++] = $NF 47 | } 48 | 49 | for (i = 2; i <= 2+core_count; i++) 50 | totals[i-2] += $i 51 | } 52 | 53 | END { 54 | if (dev_count == 0) { 55 | printf("The device vector (%s) is not found\n", '"$DEV"') 56 | exit 1 57 | } 58 | 59 | printf("DEVICES:") 60 | for (i = 0; i < dev_count; i++) 61 | printf("%s ", dev[i]) 62 | printf("[begin]\n") 63 | for (i = 0; i < core_count; i++) 64 | printf("%s=%d\n", names[i], totals[i]) 65 | printf("DEVICES:") 66 | for (i = 0; i < dev_count; i++) 67 | printf("%s ", dev[i]) 68 | printf("[end]\n") 69 | } 70 | ' ${FILE}) 71 | 72 | echo "${output}" 73 | -------------------------------------------------------------------------------- /interrupt/chk_irq_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | usage(){ 4 | echo "Usage: $0 vector_name" 5 | exit 1 6 | } 7 | 8 | [[ $# -eq 0 ]] && usage 9 | 10 | if [ x$1 != x ] 11 | then 12 | VECT=$1 13 | else 14 | echo "***Error: Need a device vector name" 15 | usage 16 | fi 17 | 18 | cpu_num=`grep processor /proc/cpuinfo| wc -l` 19 | irqlist=`grep $VECT /proc/interrupts | awk -F: '{print $1}'` 20 | 21 | function get_vect_name { 22 | 23 | grep "$1:" /proc/interrupts | awk -F" " \ 24 | '{if (NF-'"$cpu_num"'>3){print $1$(NF-1)$NF}else{print $1$NF}}' 25 | } 26 | 27 | function dump_irq_smp_affinity { 28 | 29 | printf "Dump /proc/irq//smp_affinity for each irq\n" 30 | for irq in $irqlist 31 | do 32 | name=`get_vect_name $irq` 33 | value=`cat /proc/irq/$irq/smp_affinity` 34 | 35 | if [ -f /proc/irq/$irq/smp_affinity_list ] 36 | then 37 | cpu_list=`cat /proc/irq/$irq/smp_affinity_list` 38 | printf "%30s %40s CPU %s\n" $name $value $cpu_list 39 | else 40 | printf "%30s %40s\n" $name $value 41 | fi 42 | done; 43 | } 44 | 45 | function dump_nzero_irq_affinity_hint { 46 | 47 | printf "Dump non-zero /proc/irq//affinity_hint for each irq\n" 48 | for irq in $irqlist 49 | do 50 | hint_list=`cat /proc/irq/$irq/affinity_hint | \ 51 | awk -F"," '{for(i=1;i<=NF;i++){printf ("%d\n",$i)}}'` 52 | for hint in $hint_list 53 | do 54 | if [ $hint -gt 0 ] 55 | then 56 | name=`get_vect_name $irq` 57 | value=`cat /proc/irq/$irq/affinity_hint` 58 | 59 | printf "%30s %40s\n" $name $value 60 | break 61 | fi 62 | done 63 | done; 64 | } 65 | 66 | function dump_irq_numa_node { 67 | 68 | printf "Dump /proc/irq//node for each irq\n" 69 | for irq in $irqlist 70 | do 71 | name=`get_vect_name $irq` 72 | value=`cat /proc/irq/$irq/node` 73 | 74 | printf "%30s %40s\n" $name $value 75 | done; 76 | } 77 | 78 | dump_irq_smp_affinity 79 | dump_nzero_irq_affinity_hint 80 | dump_irq_numa_node 81 | -------------------------------------------------------------------------------- /interrupt/dump_intr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FILE=/proc/interrupts 4 | 5 | usage(){ 6 | echo "Usage: $0 cpu_id [interrupts file]" 7 | exit 1 8 | } 9 | 10 | [[ $# -eq 0 ]] && usage 11 | 12 | if [ x$1 != x ] 13 | then 14 | CPU_ID=$1 15 | else 16 | echo "***Error: Need a valid core number" 17 | usage 18 | fi 19 | 20 | if [ x$2 != x ] 21 | then 22 | FILE=$2 23 | else 24 | echo "No file specified, will use $FILE by default" 25 | fi 26 | 27 | output=$(awk 'NR==1 { 28 | vec_count = 0 29 | 30 | A 31 | if ( $1 == "CPU0") { 32 | core_count = NF 33 | field_num = '"$CPU_ID"'+2 34 | vec_field = NF+3; 35 | } else { 36 | core_count = NF-3 37 | field_num = '"$CPU_ID"'+2 38 | vec_field = NF; 39 | } 40 | 41 | if ('"$CPU_ID"' > core_count) { 42 | printf("The cpu core number is not correct,it should be less than %d\n", core_count) 43 | exit 1 44 | } 45 | 46 | printf("%5s%20sCPU%d%22s\n","IRQ",CPU,'"$CPU_ID"',"Vector Name") 47 | printf("------------------------------------------------------------\n") 48 | 49 | if ( $1 == "CPU0") { 50 | next 51 | } 52 | } 53 | { 54 | vec_count++; 55 | printf("%5s%30d\t\t",$1,$field_num) 56 | for (i=vec_field;i<=NF;i++) { 57 | printf("%10s",$i) 58 | } 59 | printf("\n"); 60 | } 61 | END { 62 | if (vec_count == 0) { 63 | printf("No records found, please check file:%s\n", '"$FILE"') 64 | exit 1 65 | } 66 | } 67 | ' ${FILE}) 68 | 69 | echo "${output}" 70 | -------------------------------------------------------------------------------- /interrupt/intr_diff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASE_DIR=`dirname $0` 4 | CHK_INTR=${BASE_DIR}/chk_intr.sh 5 | DUMP_INTR=${BASE_DIR}/dump_intr.sh 6 | 7 | DELTA_THRES=10000 8 | INTERVAL=5 9 | 10 | usage(){ 11 | echo -n "Usage: $0 vector file_interrupts_before file_interrupts_after" 12 | echo " [threshold] [interval]" 13 | exit 1 14 | } 15 | 16 | [[ $# -eq 0 ]] && usage 17 | 18 | if [ x$1 != x ] 19 | then 20 | VECT=$1 21 | else 22 | usage 23 | fi 24 | 25 | if [ x$2 != x ] 26 | then 27 | if [ x"$2" == x"/proc/interrupts" ] 28 | then 29 | cp /proc/interrupts /tmp/interrupts_before 30 | FILE1="/tmp/interrupts_before" 31 | else 32 | FILE1=$2 33 | fi 34 | else 35 | usage 36 | fi 37 | 38 | if [ x$5 != x ] 39 | then 40 | INTERVAL=$5 41 | fi 42 | 43 | if [ x$3 != x ] 44 | then 45 | if [ x"$2" == x"/proc/interrupts" ] 46 | then 47 | sleep $INTERVAL 48 | cp /proc/interrupts /tmp/interrupts_after 49 | FILE2="/tmp/interrupts_after" 50 | else 51 | FILE2=$3 52 | fi 53 | else 54 | usage 55 | fi 56 | 57 | if [ x$4 != x ] 58 | then 59 | DELTA_THRES=$4 60 | else 61 | echo "Calculate the interrupt diffs greater than $DELTA_THRES" 62 | fi 63 | 64 | 65 | array_before=(`$CHK_INTR $VECT $FILE1 | grep CPU| awk -F"=" '{print $2}'`) 66 | array_after=(`$CHK_INTR $VECT $FILE2 | grep CPU | awk -F"=" '{print $2}'`) 67 | array_cpu=() 68 | intr_total=0 69 | 70 | for ((i=0;i<${#array_before[@]};i++)) 71 | do 72 | 73 | if [ ${array_after[$i]} -lt ${array_before[$i]} ] 74 | then 75 | printf "\n\n\n" 76 | echo "***Error: the $FILE2 should be the interrupts_after file\n" 77 | printf "\n\n\n" 78 | usage 79 | fi 80 | 81 | delta=$((${array_after[$i]}-${array_before[$i]})) 82 | 83 | intr_total=$(($intr_total+$delta)) 84 | 85 | printf "CPU%2d intr diff=%d\n" $i $delta 86 | 87 | if [ $delta -gt $DELTA_THRES ] 88 | then 89 | array_cpu[${#array_cpu[*]}]=$i 90 | fi 91 | 92 | done 93 | 94 | echo "Totoal interrupts deltas on all CPUs is $intr_total" 95 | 96 | echo "CPU ${array_cpu[@]} has the significant interrupts number" 97 | 98 | for ((i=0;i<${#array_cpu[@]};i++)) 99 | do 100 | 101 | array_cpu_vect=(`$DUMP_INTR ${array_cpu[$i]} $FILE1 | grep $VECT | \ 102 | awk -F" " '/[:]/{print $1$3}'`) 103 | array_cpu_before=(`$DUMP_INTR ${array_cpu[$i]} $FILE1 | grep $VECT | \ 104 | awk -F" " '/[:]/{print $2}'`) 105 | array_cpu_after=(`$DUMP_INTR ${array_cpu[$i]} $FILE2 | grep $VECT | \ 106 | awk -F" " '/[:]/{print $2}'`) 107 | 108 | #echo "+++++++++++++++++++++++++++" 109 | #echo ${array_cpu_vect[@]} 110 | #echo ${array_cpu_before[@]} 111 | #echo ${array_cpu_after[@]} 112 | #echo "+++++++++++++++++++++++++++" 113 | 114 | for ((j=0;j<${#array_cpu_before[@]};j++)) 115 | do 116 | 117 | #echo ${array_cpu_after[$j]}-${array_cpu_before[$j]} 118 | 119 | delta=$((${array_cpu_after[$j]}-${array_cpu_before[$j]})) 120 | 121 | if [ $delta -gt $DELTA_THRES ] 122 | then 123 | printf "On CPU%s %10s intr diff is=%d\n" \ 124 | ${array_cpu[$i]} ${array_cpu_vect[$j]} $delta 125 | fi 126 | 127 | done 128 | 129 | done 130 | -------------------------------------------------------------------------------- /interrupt/show_smp_affi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | usage(){ 4 | echo "Usage: $0 vector_name [interval]" 5 | exit 1 6 | } 7 | 8 | [[ $# -eq 0 ]] && usage 9 | 10 | if [ x$1 != x ] 11 | then 12 | VECT=$1 13 | else 14 | echo "***Error: Need a device vector name" 15 | usage 16 | fi 17 | 18 | if [ x$2 != x ] 19 | then 20 | INTERVAL=$2 21 | else 22 | INTERVAL=5 23 | fi 24 | 25 | vect_num=`echo $VECT | awk -F":" '{print NF}'` 26 | 27 | if [ $vect_num -gt 1 ] 28 | then 29 | vect_array=(`echo $VECT | awk -F":" '{for(i=1;i<=NF;i++){print $i}}'`) 30 | else 31 | vect_array=($VECT) 32 | fi 33 | 34 | cpu_num=`grep processor /proc/cpuinfo| wc -l` 35 | 36 | 37 | function get_vect_name { 38 | 39 | grep "$1:" /proc/interrupts | awk -F" " \ 40 | '{if (NF-'"$cpu_num"'>3){print $1$(NF-1)$NF}else{print $1$NF}}' 41 | } 42 | 43 | function dump_irq_smp_affinity { 44 | 45 | irqlist=`grep $1 /proc/interrupts | awk -F: '{print $1}'` 46 | printf "\n" 47 | for irq in $irqlist 48 | do 49 | name=`get_vect_name $irq` 50 | value=`cat /proc/irq/$irq/smp_affinity` 51 | 52 | if [ -f /proc/irq/$irq/smp_affinity_list ] 53 | then 54 | cpu_list=`cat /proc/irq/$irq/smp_affinity_list` 55 | printf "%30s %40s CPU %s\n" $name $value $cpu_list 56 | else 57 | printf "%30s %40s\n" $name $value 58 | fi 59 | done; 60 | } 61 | 62 | echo "Current vector filter is "${vect_array[@]}"" 63 | echo "Interval is $INTERVAL, use CTRL+C to quit..." 64 | 65 | while (true) 66 | do 67 | for ((i=0;i<${#vect_array[@]};i++)) 68 | do 69 | dump_irq_smp_affinity ${vect_array[$i]} 70 | done 71 | 72 | sleep $INTERVAL 73 | done; 74 | -------------------------------------------------------------------------------- /test/fio/fs_seq_write_sync_001: -------------------------------------------------------------------------------- 1 | ; -- start job file -- 2 | [global] ; global shared parameters 3 | filename=/mnt/test ; location of file in file system 4 | rw=write ; sequential write only, no read 5 | ioengine=sync ; synchronized, write(2) system call 6 | bs=,4k ; fio iounit size, write=4k, read and trim are default(4k) 7 | iodepth=1 ; how many in-flight io unit 8 | size=2M ; total size of file io in one job 9 | loops=1000000 ; number of iterations of one job 10 | 11 | [job1] ; job1 specific parameters 12 | 13 | [job2] ; job2 specific parameters 14 | 15 | ; -- end job file -- 16 | -------------------------------------------------------------------------------- /usb/ls_usbdisk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Declaration of *array* 'USBKEYS' 4 | USBKEYS=($( 5 | grep -Hv ^0$ /sys/block/*/removable | # search for *not 0* in `removable` flag of all devices 6 | sed s/removable:.*$/device\\/uevent/ | # replace `removable` by `device/uevent` on each line of previous answer 7 | xargs grep -H ^DRIVER=sd | # search for devices drived by `SD` 8 | sed s/device.uevent.*$/size/ | # replace `device/uevent` by 'size' 9 | xargs grep -Hv ^0$ | # search for devices having NOT 0 size 10 | cut -d / -f 4 # return only 4th part `/` separated 11 | )) 12 | 13 | # Print header 14 | printf "DISK NAME\tMODEL\n" 15 | 16 | # Print each usb disks 17 | for dev in ${USBKEYS[@]} ;do # for each devices in USBKEY... 18 | model=$(sed -e s/\ *$//g