# The Performance Monitor database

> The performance monitor database stores scalar readings in class `PerfReading` defined as follows:

>         transient class PerfReading
>         {
>             uint2   node; /* cluster node id, or 0 */
>             uint2   db;
>             uint8   stamp;
>             vector  <uint4> values;
>             tree <node,db,stamp> rec_idx;
>             tree <stamp> stamp_idx;
>         };

> Aggregated values are stored in class `PerfTimingReading` defined as follows:

>         transient class PerfTimingReading
>         {
>             uint2   node;
>             uint2   db;
>             uint8   stamp;
>             vector  <uint8> current;
>             vector  <uint8> min;
>             vector  <uint8> max;
>             vector  <uint8> avg;
>             vector  <uint8> total;
>             vector  <uint4> count;
>             tree <node, db, stamp> rec_idx;
>             tree <stamp> stamp_idx;
>         };

> The database also maintains a dictionary of values stored as `PerfCounter` defined as follows:

>         transient class PerfCounter
>         {
>             uint2   no; /* This is actually an index into the values vector
>                     PerfReading.values or PerfTimingReading depending
>                     on the datatype */
>             string  name;
>             string  descr;
>             uint1   datatype;
>             unique tree<no>  no_idx;
>         };