MPS issue job003756

Titleeventtxt can't process the telemetry output of amcssth
Statusclosed
Priorityessential
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionOn platform xci6ll:

    $ make -f xci6ll.gmk
    $ MPS_TELEMETRY_CONTROL=all xci6ll/cool/amcssth > /dev/null
    $ xci6ll/cool/mpseventcnv mpsio.log > mpsio.txt
    $ xci6ll/cool/mpseventtxt -l mpsio.txt >/dev/null
    xci6ll/cool/mpseventtxt: Couldn't create an intern mapping.
AnalysisLooking at the contents of mpsio.txt reveals the following:

    000001576AD7B078 1B 1098EB588 3
    000001576AD7ADBA 1A 3 "size of tree"
    ...
    00000157BC04309B 1B 1098EB588 8
    00000157BC042F21 1A 8 "size of tree"

That is, the same address (1098EB588) is associated with two different labels. This is the label for the CBS statistic, created in this line in cbs.c.

    METER_INIT(cbs->treeSearch, "size of tree", (void *)cbs);

eventtxt manages these labels using hash table mapping address to label. It thus relies on the assumption that the address of every label is unique. But this test case shows that the assumption is not true.

(Why has this problem only just turned up? Well, it was provoked by change 185430. As of this change, the amcssth test case runs itself twice to test two different modes of operation. Each run creates, exercises and then destroys an arena. The CBS maintaining the arena's free memory is one of the first data structures to be created, so it is not surprising that it is created at the same address on the two runs.)

How should this be fixed? When an address is relabelled, we want events associated with the address to be output with the old label if they occurred before the relabelling, and with the new label if they occurred after the relabelling. And because the log is out of order, eventtxt can't just replace the old label for the address with the new one. It needs to store all labels that have been associated with an address (together with the time of that association) and pick the correct one to use for a particular event E (that is, the newest label which was associated with the address prior to event E).
How foundmanual_test
EvidenceNone
Created byGareth Rees
Created on2014-04-11 00:21:37
Last modified byGareth Rees
Last modified on2014-04-12 15:34:43
History2014-04-11 GDR Created.

Fixes

Change Effect Date User Description
185477 closed 2014-04-12 15:34:43 Gareth Rees eventtxt no longer reports an error if there are multiple labels associated with an address. Instead, it store all the labels encountered, and prints the one that was in force at the time of each event.
Use the MPS to manage memory, not malloc/free.
Recommend sort before mpseventtxt and not afterwards (data is smaller; labelling is more accurate).