Analyzer

Introduction

An analyzer is a scripting tool used to solve and analyze various program problems.

Each analyzer has its own purpose.

This command can be used to list, search, create and run analysis tools.

Usage

Usage: orxray analyzer command [OPTIONS]

COMMAND:
    create
    run
    list
    search

GLOBAL OPTIONS:
    --help
    --config                           specify config file, default is ~/.orxray/config.

Create Analyzer

This subcommand used to create a new analyzer.

Usage: orxray analyzer create <name> [OPTIONS]

OPTIONS:
    --desc                             description.
    --ysql                             ysql.
    --ylang                            ylang.
    --ylua                             ylua.
    --opslang                          opslang.


GLOBAL OPTIONS:
    --help
    --config                           specify config file, default is ~/.orxray/config.

<name>

each analyzer has its own name

--desc "Description"

description of this analyzer

--ysql 'YSQL code'

specify YSQL code of this analyzer

--ylang 'Ylang code'

specify Ylang code of this analyzer

--ylua 'Ylua code'

specify Ylua code of this analyzer

--opslang 'Opslang code'

specify Opslang code of this analyzer

example

Create an analyzer use YSQL to print memory information of the process.

$ orxray analyzer create cli-test --ysql 'select res_mem from proc'
ID: 10075

Run analyzer by given tool name

Run the analyzer by name you specify

Usage: orxray analyzer run tool [OPTIONS]

OPTIONS:
    -a, --agent integer                agent id, please use agent default command to set default agent.
    -x, --pid integer                  pid. If pid is negative, will auto find the pgid of the -pid.
    -c, --exe string                   command.

GLOBAL OPTIONS:
    --help
    --config                           specify config file, default is ~/.orxray/config.

example

The command analyze process 4502 on the default agent. The tool will analyze and get the flame graph. After the task finished, you can goto the URI printed to show the flame graph.

$ orxray analyzer run c-on-cpu -x 4502
Goto https://xxx.xx.xx.com.cn/targets/27/history/8885766 for charts

The command analyze process group to which process 4502 belongs on the default agent. Be careful, we pass -4502 as the argument of -p.

$ orxray analyzer run c-on-cpu -p -4502
Goto https://xxx.xx.xx.com.cn/targets/27/history/8885767 for charts

List all analyzers

This subcommand list all the analyzers.

Usage: orxray analyzer list

OPTIONS:
    -s, --page-size integer            page size, 10(default).

GLOBAL OPTIONS:
    --help
    --config                           specify config file, default is ~/.orxray/config.

-s, --page-size integer

Specify the size of list returned.

example

$ orxray analyzer list
ID      NAME                    DESCRIPTION
1       count-on-cpu-frames     count on cpu frames
2       count-off-cpu-frames    count off cpu frames
3       lj-c-on-cpu             C-land CPU Flame Graph
7       c-on-cpu                C-land CPU Flame Graph
8       c-off-cpu               C-land off-CPU Flame Graph
9       kernel-on-cpu           kernel-land on-CPU Flame Graph
11      resty-memory            Application-Level Memory Usage Breakdown
12      count-lj-newgco-frames  count LuaJIT new GC objects frames
14      glibc-chunks            Distributions of Memory Chunk Sizes in Glibc Allocator
15      lj-gco-stat             Statistics for LuaJIT GC Objects

Search analyzer

This subcommand search analyzers by keyword.

Usage: orxray tool search WORD [OPTIONS]

OPTIONS:
    -s, --page-size integer            page size, 10(default).

GLOBAL OPTIONS:
    --help
    --config                           specify config file, default is ~/.orxray/config.

-s, --page-size integer

Specify the size of list returned.

example

$ orxray analyzer search cpu
count-on-cpu-frames
count-off-cpu-frames
lj-c-on-cpu
lj-lua-on-cpu
lj-c-off-cpu
lj-lua-off-cpu
c-on-cpu
c-off-cpu
kernel-on-cpu
count-lj-c-on-cpu