# xSQL xtop Utility

> The client-side utility `xtop` can be used to display runtime statistics collected by xSQL on Unix/-Linux systems. (As it uses the Unix-based curses library, there is no Windows version of the utility.) The utility is run from the `xtop.sh` shell script as follows:

>         ./xtop.sh args

> where `args` specifies the `host:port` addresses of the xSQL server and clients. For example, the following invokes `xtop` to display statistics accumulated on the local xSQL server on port `5501` for the local xSQL client on port `5502`:

>         /xtop.sh @localhost:5501 @localhost:5502

>         Used memory   0
>         Free memory   0               Data file      0              Engine heap    0
>         Total memory  0               Log file       0              Total heap     0

>             Clients activity

>         begin               ip         port  state  memory  rows  bytes  exectime txtime sql
>         17:31:27.628807     127.0.0.1  44210 DONE   74205     1     204       91     21     select get_engine_h
>         17:31:27.628970     127.0.0.1  44210 DONE   93447     20   8204       75     11     SELECT "clientid","
>         17:31:28.630348     127.0.0.1  44210 DONE   74205     1     204      134     36     select get_engine_h
>         17:31:28.630676     127.0.0.1  44210 DONE   93447     20   8204      148     15     SELECT "clientid","
>         17:31:29.631780     127.0.0.1  44210 DONE   74205     1     204       83     21     select get_engine_h
>         17:31:29.631958     127.0.0.1  44210 DONE   93447     20   8204       73     10     SELECT "clientid","
>         17:31:30.633323     127.0.0.1  44210 DONE   74205     1     204      121     35     select get_engine_h
>         17:31:30.633591     127.0.0.1  44210 DONE   93447     20   8204      142     13     SELECT "clientid","
>         17:31:31.635174     127.0.0.1  44210 DONE   74205     1     204       78     20     select get_engine_h
>         17:31:31.635350     127.0.0.1  44210 ACTIVE 69584     0       0       31      0      SELECT "clientid","
>         17:30:13.759030     127.0.0.1  44167 DONE   74205     1     204      158      52     select get_engine_h
>         17:30:13.759349     127.0.0.1  44167 DONE   86067     10   4314      184      33     SELECT "clientid","
>         17:30:14.760919     127.0.0.1  44167 DONE   74205     1     204      154      46     select get_engine_h
>         17:30:14.761259     127.0.0.1  44167 DONE   86067     10   4314      137      26     SELECT "clientid","
>         17:30:15.761946     127.0.0.1  44167 DONE   74205     1     204      143      44     select get_engine_h
>         17:30:15.762281     127.0.0.1  44167 DONE   86067     10   4314      148      35     SELECT "clientid","
>         17:30:16.763816     127.0.0.1  44167 DONE   74205     1     204      147      45     select get_engine_h
>         17:30:16.764158     127.0.0.1  44167 DONE   86067     10   4314      148      35     SELECT "clientid","
>         17:30:17.765673     127.0.0.1  44167 DONE   74205     1     204      147      47     select get_engine_h
>         17:30:17.765974     127.0.0.1  44167 DONE   86067     10   4314      150      37     SELECT "clientid","

>         Press 'q' to quit '1..9' to sort 'a' to toggle all 's' to statistic view 'c' to client view

> As the bottom line indicates, the utility accepts the following commands:

> - q - Quit (exit `xtop`)
> - s – View statistics for `xsql_stat` queries
> - c - View statistics for disconnected clients
> - a – View all statistics (including `xsql_stat` queries and disconnected clients)
> - 1..9 - Sort by this column
> - d – Display details on the row
> - up arrow, down arrow - Select a row from the list