MPS issue job003331

Titleeventcnv appears to hang if you specify a small bucket size
Statusclosed
Priorityoptional
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionThe eventcnv program takes a -b command-line argument that specifies a "bucket size": the time granularity with which statistics are reported. If you specify a small bucket size (say, "-b 1000" or less), eventcnv appears to hang, with no output appearing for many seconds.

This behaviour is confusing for a new user (who might not understand the units for the -b option) and hard to explain in the documentation.
AnalysisThere should be no reason why eventcnv should take any longer when a bucket size is specified (other than the small amount of extra time needed to output the extra rows of stats for each populated bucket).

The offending code is this in eventcnv.c:

    /* Output bucket, if necessary, and update counters */
    if (bucketSize != 0 && eventTime >= bucketLimit) {
      reportBucketResults(bucketLimit-1);
      clearBucket();
      do {
        bucketLimit += bucketSize;
      } while (eventTime >= bucketLimit);
    }

The do loop should be replaced with something like

    bucketLimit = ((eventTime / BucketLimit) + 1) * bucketLimit;

See also job003332, job003333, and job003335, which also affect this region of code.
How foundmanual_test
EvidenceOn a small telemetry log (just 483 events) I got the following timings:

    $ time $EVENTCNV -e all > /dev/null
    real 0m0.005s
    $ time $EVENTCNV -e all -b 1000000 > /dev/null
    real 0m0.010s
    $ time $EVENTCNV -e all -b 100000 > /dev/null
    real 0m0.042s
    $ time $EVENTCNV -e all -b 10000 > /dev/null
    real 0m0.368s
    $ time $EVENTCNV -e all -b 1000 > /dev/null
    real 0m3.624s
    $ time $EVENTCNV -e all -b 100 > /dev/null
    real 0m36.194s

I didn't try it, but it looks as though the time taken is inversely proportional to the bucket size, and so "-b 1" would take an hour.
Observed in1.110.0
Created byGareth Rees
Created on2012-10-21 15:34:03
Last modified byGareth Rees
Last modified on2012-10-23 14:28:22
History2012-10-21 GDR Created.

Fixes

Change Effect Date User Description
180028 closed 2012-10-23 14:28:22 Gareth Rees Remove reporting features from eventcnv, as discussed with RB. Eventcnv was always intended to be a simple tool that just translates events, not a report generator. In particular:
* Remove -e option and associated event specification parsing.
* Remove -b option and bucket statistics.
* Don't intern labels (always print addresses).
* Remove -v option (events are always output).
* If -h or -? is specified, exit after printing help message.
* Help text refer to the "Telemetry" section of reference manual.