我要评分
获取效率
正确性
完整性
易理解

record

Command Function

Collects data for a specified process, including CPU microarchitecture performance events, function call trace information, and memory access data, and generates data files.

Syntax

./devopt.sh record [-h] -p/--pid PID [-d <sec>] [-I <msec>] [-f <freq>] [-o OUTPUT] [-t <sec>] [-m] [-i INPUT]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

(Optional) Obtains help information.

-p/--pid

-

(Mandatory) ID of the process whose information is to be collected.

-d/--duration

-

(Optional) Collection duration, in seconds. The value ranges from 1 to 2,147,483,647. The default value is 10 seconds.

-f/--frequency

-

(Optional) Sampling frequency, in Hz. The value ranges from 1 to 2,147,483,647. The default value is 1,000 Hz.

-I/--interval

-

(Optional) Interval for reading sampled data, in ms. The value ranges from 1 to 2,147,483,647. The default value is 1,000 ms.

-o/--output

-

(Optional) Directory for storing data files. By default, the current working directory (where the command is executed) is used.

-t/--trace

-

(Optional) Duration for function call trace collection, in seconds. The value ranges from 1 to 2,147,483,647. The default value is 1 second.

-m/--memory

-

(Optional) Enables the refined memory collection mode for false sharing detection.

NOTE:

When refined memory collection is enabled, the -i parameter must be specified, while the -f and -o parameters are not supported.

-i/--input

-

(Optional) Input data file for enabling the refined memory collection mode.

Example

  1. View information about the record command.
    ./devopt.sh record -h

    Command output:

    USAGE
      devopt.sh record [-h] -p/--pid PID [-d <sec>] [-I <msec>] [-f <freq>] [-o OUTPUT] [-t <sec>] [-m] [-i INPUT]
    
    DESCRIPTION
      Collects data of a specified process and generates a data file.
    
    OPTIONS
      -h, --help              
      Displays help information and exits.
    
      -p PID, --pid PID       
      Specifies the process ID.
    
      -d <sec>, --duration <sec>
      Specifies the collection duration, in seconds. The default value is 10s.
    
      -f <freq>, --frequency <freq>
      Specifies the sampling frequency. The default value is 1,000.
    
      -I <msec>, --interval <msec>
      Specifies the interval for reading sampled data, in milliseconds. The default value is 1,000.
    
      -o OUTPUT, --output OUTPUT
      Specifies the data file output directory. It defaults to the current directory.
    
      -t <sec>, --trace <sec> 
      Specifies the function tracing duration, in seconds. The default value is 1s.
    
      -m, --memory            
      Enables the refined memory collection mode.
    
      -i INPUT, --input INPUT 
      Specifies the original data file. This parameter is mandatory for the refined memory collection mode.
    
    EXAMPLES
      # Collect the function-level top-down data, time consumption, and tracing information of a specified process.
      devopt.sh record -p pid -d 1 -f 4000 -o /home/output
      # Enable the refined memory collection mode to collect data and detect false cache sharing.
      devopt.sh record -p pid -d 1 -m -i /home/output/devopt_pid_timestamp.rawdata
    
    NOTES
      # If false-sharing results in memory collection mode are unexpectedly low and cpuidle driver is not none,
      # temporarily disable CPU deep idle before ARM SPE collection to avoid possible SPE data loss:
      #   for f in $(find /sys/devices/system/cpu -path "*/cpuidle/state*/disable" ! -path "*/state0/*"); do echo 1 > "$f"; done
      # Restore after collection by replacing `echo 1` with `echo 0` in the command above. BIOS LPI settings can also be modified; see the FAQ for details.
  2. Collect the basic performance data of a specified process.
    1
    ./devopt.sh record -p 3315674 -f 4000 -d 5 -o /home/output
    

    The process ID is 3315674, the sampling frequency is 4,000 Hz, and the collection time is 5s. A data file is generated in /home/output.

    Command output:

    Saved the record data to /home/output/devopt_3315674_20260513155321.rawdata
  3. Enable the refined memory collection mode to perform refined memory analysis based on the data file.
    ./devopt.sh record -p 3315674 -d 5 -m -i /home/output/devopt_3315674_20260513155321.rawdata

    After the preceding command is executed, the basic performance data in the data file is read, the false sharing detection tool is started to collect refined memory data, analyze and detect false sharing, and add the detection result to the raw data file.

    Command output:

    Possible false sharing detected

    The result information indicates that the analysis is successful and a possible false sharing issue is detected.