Creating a Lock and Wait Analysis Task
Function
The tool analyzes the lock and wait functions (including sleep, usleep, mutex, cond, spinlock, rwlock, and semaphore) of glibc and open source software, such as MySQL and OpenMP based on the sampling data of the Linux Perf, identifies the processes and functions called, and provides tuning suggestions.
Prerequisites
- At least one node has been installed successfully.
- The nodes must support the eBPF environment requirements. For details, see Checking the eBPF Environment.
Procedure
- Click
next to System Profiler.Choose General Analysis from the drop-down list. The page for creating a task is displayed.
- Set task parameters by referring to "Task Management" and Table 1.See Figure 1.
Table 1 Parameters for creating a lock and wait analysis task Parameter
Description
Task Name
Name of the task. The name must meet the following requirements:
- Contain only letters, digits, and underscores (_).
- Contain 1 to 64 characters.
Analysis Type
Select Locks and Waits.
Select Nodes
Node to be analyzed. Only a single node can be selected.
Analysis Object
Only Application is supported.
Mode
Only Attach to process is supported.
PID
ID of the process to be analyzed. Only one PID can be entered. You can click the text box or input a keyword of the process to be analyzed and then select the required PID.
Lock Analysis Type
Lock analysis type. By default, all options are selected, including Histogram statistics and Lock variables.
Predefined Lock Type
Type of the lock based on which the corresponding methods are to be analyzed. By default, all options are selected. The options are pthread mutex, pthread condition, and pthread spin lock.
Sampling Duration (s)
Sampling duration, in seconds. The default value is 20. The value range is 1 to 300.
As the sampling duration increases, the collection may stop because the size of collected data may exceed the specified value.
Max. Collected Data (MiB)
Maximum file size of collected raw data. The default value is 1024. The value range is 1 to 1024.
NOTE:You can set the size of the file to be collected to prevent long analysis time caused by large file size.
(Optional) Stack Analysis
Indicates whether to analyze the call stack. This function is disabled by default.
Max. Stack Depth
Maximum depth of the call stack for analysis. The default value is 50. The value range is 1 to 100. This parameter is mandatory when Stack Analysis is enabled.
Min. Lock Wait Duration (μs)
Collect only events that wait for locks longer than Min. Lock Wait Duration. The default value is 0. The value range is 0 to 10,000,000. This parameter can be set in Advanced Settings when Lock Analysis Type is set to Lock variables.
Min. Lock Holding Duration (μs)
Collect only events that hold locks longer than Min. Lock Holding Duration. The default value is 0. The value range is 0 to 10,000,000. This parameter can be set in Advanced Settings when Lock Analysis Type is set to Lock variables.
If there are a large number of program processes or a large amount of data to be analyzed, task timeout may occur. To prevent this problem, you can reduce the value of Sampling Duration.
- Click OK.
You can click the icons next to the task name to perform the following operations:
: cancels the analysis task. After an analysis task is canceled, the collected information will be deleted.
: restarts the analysis task. You can modify task parameter settings and restart an analysis task. This button is available when a task is canceled or fails.
: deletes the analysis task. After a task is deleted, all data of this task will be deleted. Exercise caution when performing this operation.
: performs the analysis again. The analysis task is renamed and restarted.
: changes the task or report name. The report naming rule is the same as that of a task.
