zoukankan      html  css  js  c++  java
  • linux系统调优用命令

    chrt

    Set policy:
    chrt [options] <priority> <command> [<arg>...]
    chrt [options] --pid <priority> <pid>

    Get policy:
    chrt [options] -p <pid>

    Policy options:
    -b, --batch set policy to SCHED_BATCH  min/max priority : 0/0
    -d, --deadline set policy to SCHED_DEADLINE min/max priority : 0/0
    -f, --fifo set policy to SCHED_FIFO  min/max priority : 1/99
    -i, --idle set policy to SCHED_IDLE  min/max priority : 0/0
    -o, --other set policy to SCHED_OTHER  min/max priority : 0/0
    -r, --rr set policy to SCHED_RR (default) min/max priority : 1/99

    Scheduling options:
    -R, --reset-on-fork set SCHED_RESET_ON_FORK for FIFO or RR
    -T, --sched-runtime <ns> runtime parameter for DEADLINE
    -P, --sched-period <ns> period parameter for DEADLINE
    -D, --sched-deadline <ns> deadline parameter for DEADLINE

    Other options:
    -a, --all-tasks operate on all the tasks (threads) for a given pid
    -m, --max show min and max valid priorities
    -p, --pid operate on existing given pid
    -v, --verbose display status information

    -h, --help display this help and exit
    -V, --version output version information and exit

    strace [-CdffhiqrtttTvVwxxy] [-I n] [-e expr]...

    [-a column] [-o file] [-s strsize] [-P path]...
    -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]
    or: strace -c[dfw] [-I n] [-e expr]... [-O overhead] [-S sortby]
    -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]

    Output format:
    -a column alignment COLUMN for printing syscall results (default 40)
    -i print instruction pointer at time of syscall
    -o file send trace output to FILE instead of stderr
    -q suppress messages about attaching, detaching, etc.
    -r print relative timestamp
    -s strsize limit length of print strings to STRSIZE chars (default 32)
    -t print absolute timestamp
    -tt print absolute timestamp with usecs
    -T print time spent in each syscall
    -x print non-ascii strings in hex
    -xx print all strings in hex
    -y print paths associated with file descriptor arguments
    -yy print protocol specific information associated with socket file descriptors

    Statistics:
    -c count time, calls, and errors for each syscall and report summary
    -C like -c but also print regular output
    -O overhead set overhead for tracing syscalls to OVERHEAD usecs
    -S sortby sort syscall counts by: time, calls, name, nothing (default time)
    -w summarise syscall latency (default is system time)

    Filtering:
    -e expr a qualifying expression: option=[!]all or option=[!]val1[,val2]...
    options: trace, abbrev, verbose, raw, signal, read, write
    -P path trace accesses to path

    Tracing:
    -b execve detach on execve syscall
    -D run tracer process as a detached grandchild, not as parent
    -f follow forks
    -ff follow forks with output into separate files
    -I interruptible
    1: no signals are blocked
    2: fatal signals are blocked while decoding syscall (default)
    3: fatal signals are always blocked (default if '-o FILE PROG')
    4: fatal signals and SIGTSTP (^Z) are always blocked
    (useful to make 'strace -o FILE PROG' not stop on ^Z)

    Startup:
    -E var remove var from the environment for command
    -E var=val put var=val in the environment for command
    -p pid trace process with process id PID, may be repeated
    -u username run command as username handling setuid and/or setgid

    Miscellaneous:
    -d enable debug output to stderr
    -v verbose mode: print unabbreviated argv, stat, termios, etc. args
    -h print help message
    -V print version

    getconf 本身是个ELF可执行文件,用于获取系统信息
    用法
    getconf -a可以获取全部系统信息
    对于这个命令,记住几个常用的信息获取方法就行
    getconf PAGE_SIZE 查看系统内存分页大小
    getconf LONG_BIT 看linux是32位还是64位最简单的方法
    _CS_PATH Value for the PATH environment variable used to find commands.
    ARG_MAX Maximum length, in bytes, of the arguments for one of the exec subroutines, including environment data.
    BC_BASE_MAX Maximum value allowed for the obase variable with the bc command.
    BC_DIM_MAX Maximum number of elements permitted in an array by the bc command.
    BC_SCALE_MAX Maximum value allowed for the scale variable with the bc command.
    BC_STRING_MAX Maximum length of a string constant accepted by the bc command.
    CHARCLASS_NAME_MAX Maximum number of bytes in a character class name.
    CHAR_BIT Number of bits in a type character.
    CHAR_MAX Maximum value of a type character.
    CHAR_MIN Minimum value of a type character.
    CHILD_MAX Maximum number of simultaneous processes for each real user ID.
    CLK_TCK Number of clock ticks per second returned by the time subroutine.
    COLL_WEIGHTS_MAX Maximum number of weights that can be assigned to an entry in the LC_COLLATE locale stanza in a locale-definition file.
    CS_PATH Value of the PATH environment variable used to find commands.
    EXPR_NEST_MAX Maximum number of expressions that can be nested within parentheses by the expr command.
    INT_MAX Maximum value of a type int.
    INT_MIN Minimum value of a type int.
    LINE_MAX Maximum length, in bytes, of a command's input line (either standard input or another file) when the utility is described as processing text files. The length includes room for the trailing new-line character.
    LONG_BIT Number of bits in a type long int.
    LONG_MAX Maximum value of a type long int.
    LONG_MIN Minimum value of a type long int.
    MB_LEN_MAX Maximum number of bytes in a character for any supported locale.
    NGROUPS_MAX Maximum number of simultaneous supplementary group IDs for each process.
    NL_ARGMAX Maximum value of digit in calls to the printf and scanf subroutines.
    NL_LANGMAX Maximum number of bytes in a LANG name.
    NL_MSGMAX Maximum message number.
    NL_NMAX Maximum number of bytes in an N-to-1 collation mapping.
    NL_SETMAX Maximum set number.
    NL_TEXTMAX Maximum number of bytes in a message string.
    NZERO Default process priority.
    OPEN_MAX Maximum number of files that one process can have open at one time.
    PATH Sequence of colon-separated path prefixes used to find commands.
    RE_DUP_MAX Maximum number of repeated occurrences of a regular expression permitted when using the interval-notation parameters, such as the m and n parameters with the ed command.
    SCHAR_MAX Maximum value of a type signed char.
    SCHAR_MIN Minimum value of a type signed char.
    SHRT_MAX Maximum value of a type short.
    SHRT_MIN Minimum value of a type short.
    SSIZE_MAX Maximum value of an object of type ssize_t.
    STREAM_MAX Number of streams that one process can have open at one time.
    TMP_MAX Minimum number of unique path names generated by the tmpnam subroutine. Maximum number of times an application can reliably call the tmpnam subroutine.
    TZNAME_MAX Maximum number of bytes supported for the name of a time zone (not the length of the TZ environment variable).
    UCHAR_MAX Maximum value of a type unsigned char.
    UINT_MAX Maximum value of a type unsigned int.
    ULONG_MAX Maximum value of a type unsigned long int.
    USHRT_MAX Maximum value of a type unsigned short int.
    WORD_BIT Number of bits in a word or type int

    ltrace [option ...] [command [arg ...]]

    Trace library calls of a given program.

    -a, --align=COLUMN align return values in a secific column.
    -A MAXELTS maximum number of array elements to print.
    -b, --no-signals don't print signals.
    -c count time and calls, and report a summary on exit.
    -C, --demangle decode low-level symbol names into user-level names.
    -D, --debug=MASK enable debugging (see -Dh or --debug=help).
    -Dh, --debug=help show help on debugging.
    -e FILTER modify which library calls to trace.
    -f trace children (fork() and clone()).
    -F, --config=FILE load alternate configuration file (may be repeated).
    -h, --help display this help and exit.
    -i print instruction pointer at time of library call.
    -l, --library=LIBRARY_PATTERN only trace symbols implemented by this library.
    -L do NOT display library calls.
    -n, --indent=NR indent output by NR spaces for each call level nesting.
    -o, --output=FILENAME write the trace output to file with given name.
    -p PID attach to the process with the process ID pid.
    -r print relative timestamps.
    -s STRSIZE specify the maximum string size to print.
    -S trace system calls as well as library calls.
    -t, -tt, -ttt print absolute timestamps.
    -T show the time spent inside each call.
    -u USERNAME run command with the userid, groupid of username.
    -V, --version output version information and exit.
    -w, --where=NR print backtrace showing NR stack frames at most.
    -x FILTER modify which static functions to trace.

  • 相关阅读:
    为什么使用enable_shared_from_this——shared_ptr两类错误
    More Effective C++ Item14:明智运用exception specifications
    用“双优先队列”方法解决双/多指标的规划问题
    彻底理解AC多模式匹配算法
    CentOS7安装MySQL
    CentOS7配置本地Yum源
    数组
    比较运算符
    申明变量
    相等运算符==与等同运算符===
  • 原文地址:https://www.cnblogs.com/josn1984/p/12023357.html
Copyright © 2011-2022 走看看