18 Retriving statistical information from the Distribution layer: DPStatistics

# 18 Retriving statistical information from the Distribution layer: `DPStatistics`

To be able to understand and tune distributed Mozart programs the distribution layer can produce log files and exposes interfaces to it's inner state.

## 18.1 Interface of `DPStatistics` Module

`DPStatistics.siteStatistics`

  > `{DPStatistics.siteStatistics` `?SiteList``}`

  Returns a list of all currently know remote sites. `SiteList` contains records that has the following fields:

  `ip`

    The ip number of the remote site in string format.

  `lastRTT`

    The last measured round trip to the remote site in ms. If no connection is established the value is `~1`.

  `pid`

    The proces identifier of the remote sites proces.

  `port`

    The tcp port of the remote site. It is used for accepting connection atempts.

  `received`

    Number of received messages from the remote site. This number will be cleared at each invokation to `DPStatistics.siteStatistics`

  `sent`

    Number of messages sent to the remote site from this site. This number will be cleared at each invokation to `DPStatistics.siteStatistics`

  `state`

    The state of the remote site from the current sites point of view.

  `table`

    Internal information.

  `siteid`

    The unique string identifying the remote site.

  `timestamp`

    The time when the remote site was created.

`DPStatistics.getTablesInfo`

  > `{DPStatistics.getTablesInfo` `?TableInfo``}`

  Returns information about the tables holding imported and exported entities. `TableInfo` is a list containing of the following format:

  `[bt(list:BTlist size:BTsize) ot(list:OTlist size:OTsize)]`

  `BTlist`

    A list of all currently imported entities, each entry in the list are of the following format:

    `be(index:OTindex na:NetAddress primCred:PrimCredit secCred:SecCredit type:Type)`

  `BTsize`

    The size of the Borrow table. The borrow table will grow and shrink to fit the number of imported entities.

  `OTlist`

    A list of all currently exported entities, each entry in the list are of the following format:

    `oe(credit:PrimCredit index:OTindex type:Type)`

  `OTsize`

    The size of the Owner table. The owner table will grow and shrink to fit the number of exported entities.

`DPStatistics.getNetInfo`

  > `{DPStatistics.getNetInfo` `?NetInfo``}`

  Returns information about internaly allocated object in the distribution layer. `NetInfo` is a list containing records with the following fields

  `type`

    The type of the object

  `nr`

    The number of allocated objects of this type

  `size`

    The size of this object in bytes.

`DPStatistics.perdioStatistics`

  > `{DPStatistics.perdioStatistics` `?Ans``}`

  The distribution layer keeps information of the number of received and sent messages per message type basis as the number of marshaled and unmarshaled marshaling types. This information is returned in record with the following fields:

  `recv`

    Contains a record with the total number of unmarshaled dif's per type and received messages per message type.

  `sent`

    Contains a record with the total number of marshaled dif's per type and sent messages per message type.

`DPStatistics.createLogFile`

  > `{DPStatistics.createLogFile` `+File``}`

  Directs the loging output from the distribution layer to the file `File`.