Spec-Zone .ru
спецификации, руководства, описания, API

5.7.1.1. Connection Probes

The connection-start and connection-done probes enclose a connection from a client, regardless of whether the connection is through a socket or network connection.

connection-start(connectionid, user, host)connection-done(status, connectionid)

The following D script will quantify and summarize the average duration of individual connections, and provide a count, dumping the information every 60 seconds:

#!/usr/sbin/dtrace -smysql*:::connection-start{  self->start = timestamp;}mysql*:::connection-done/self->start/{  @ = quantize(((timestamp - self->start)/1000000));  self->start = 0;}tick-60s{  printa(@);}

When executed on a server with a large number of clients you might see output similar to this:

  1  57413                        :tick-60s           value  ------------- Distribution ------------- count              -1 |                                         0               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 30011               1 |                                         59               2 |                                         5               4 |                                         20               8 |                                         29              16 |                                         18              32 |                                         27              64 |                                         30             128 |                                         11             256 |                                         10             512 |                                         1            1024 |                                         6            2048 |                                         8            4096 |                                         9            8192 |                                         8           16384 |                                         2           32768 |                                         1           65536 |                                         1          131072 |                                         0          262144 |                                         1524288 |                                         0