Linux Performance Optimization Chapter fourth performance tools: specific process CPUs

Source: Internet
Author: User
Tags types of functions

4.1Process Performance Statistics4.1.1.Kernel TimeVsUser Time

The most basic partitioning of an application's time is the kernel time and user time. Kernel time is spent on the Linux kernel, while user time is spent on the application or library code. Linux has tools, such as time and PS, that can (roughly) indicate whether the application spends its hours on the application code or on the kernel code.

4.1.2Library TimeVsApplication Time

any application, even if its complexity is very low, relies on the system library to perform complex operations. These libraries can cause performance problems, so it's important to be able to see how much time your application spends in a library. the Ltrace command and oprofile Toolkit provide a way to analyze library performance when libraries are used by applications. The built-in tools of the Linux loader LD help you determine whether the number of libraries used slows down the application startup time.

4.2Tools4.2.1 Time

The time command completes a basic function that is typically run first when it is necessary to test the performance of a command. the time command, like a stopwatch, can measure when a command executes.

4.2.2 Strace

Starce is the system invoke tool that is traced when the program executes. A system call is a Linux kernel function call made by or on behalf of an application . Strace can demonstrate an accurate system call, which is useful in determining how the application uses the Linux kernel. Tracking the frequency and length of system calls is particularly valuable when analyzing large programs or programs that you don't understand at all. By looking at the output of the strace, you can see how the application uses the kernel and what types of functions it relies on.

Grammar

Strace [-c] [-p PID] [-O file] [--help] [command [ARG ...]]

Strace command-line Options

options

description

-C

Print a summary of the statistics, not a standalone list of all system calls

-P PID

will be given pid add to the process and start tracking

-O File

output saved to file

with the CPU -dependent strace output

%time

for the total time of all system calls, this is the percentage of time spent on this system call

Second

The total number of seconds this system call took

Calls

The total number of all calls of this type

4.2.3 Ltrace

Ltrace is similar to the concept of strace, but it tracks the application's call to the library instead of the kernel. Although Ltrace is primarily used to provide precise tracking of parameters and return values for library calls, you can also use it to summarize the time spent on each call. This allows you to find out what calls the application has and how long each call takes.

4.2.4 PS(process status)

PS can give detailed static and dynamic statistics of the running process. PS provides static information including command name and PID, dynamic information to save memory and current usage of CPU.

PS command line Options

ETime

Statistics: Elapsed time refers to the total time that is spent from the execution of the program

time

statistics: cpu time refers to the process running on Cpu

pcpu

statistics: The process is currently consuming cpu percent

Cmd

Statistical information: command name


Linux Performance Optimization Chapter fourth performance tools: specific process CPUs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.