Behaviour of reporting - snapshot

Hi,

What is the intended behaviour of the reporting snapshot() function?
When I set Autotrigger to false and attach a periodictask to my reporter, the
reporter still reports periodically. He however reports the same values
multiple times (with the period of the periodictask) untill snapshot is
called again.
When I attach a nonPeriodicTask to my reporter, I only get one rule of data in
my reporter-file, independent on how many times I call snapshot().

Tinne

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Behaviour of reporting - snapshot

> > What is the intended behaviour of the reporting snapshot() function?
> > When I set Autotrigger to false and attach a periodictask to my reporter,
> > the reporter still reports periodically. He however reports the same
> > values multiple times (with the period of the periodictask) untill
> > snapshot is called again.
>
> That is intended, snapshot() determines the time data is 'measured', the
> reporter's activity the moment you write to a file.
>
> > When I attach a nonPeriodicTask to my reporter, I only get one rule of
> > data in my reporter-file, independent on how many times I call
> > snapshot().
>
> Hmm... I didn't forsee that use case, but clearly, snapshot() needs to call
> engine()->getActivity()->trigger() ...This will well behave for periodic
> and non periodic activities.
>
> snapshot() wasn't very well thought out, but the way you use it looks ok.

Despite your thorough answer I don't see how I can get the following behavior:
write a new line to my report file at specific times (which I expected to get
by calling snapshot() ).

This doesn't seem a very excotic behavior, does it?

Tinne

Behaviour of reporting - snapshot

On Tuesday 29 January 2008 15:36:06 Tinne De Laet wrote:
>
> Despite your thorough answer I don't see how I can get the following
> behavior: write a new line to my report file at specific times (which I
> expected to get by calling snapshot() ).

1. Use a non periodic activity
2. Edit ReportingComponent.cpp and change

    void ReportingComponent::snapshot() {
        timestamp = TimeService::Instance()->secondsSince( starttime );
        // execute the copy commands (fast).
        for(Reports::iterator it = root.begin(); it != root.end(); ++it )
            (it->get<2>())->execute();
    }

into

    void ReportingComponent::snapshot() {
        timestamp = TimeService::Instance()->secondsSince( starttime );
        // execute the copy commands (fast).
        for(Reports::iterator it = root.begin(); it != root.end(); ++it )
            (it->get<2>())->execute();
        if ( this->engine()->getActivity() )
            this->engine()->getActivity()->trigger();
    }

3. Disable AutoTrigger

If you just change this and commit it for OCL, you don't need to open a bug
report....imho.

Peter

Behaviour of reporting - snapshot

On Tuesday 29 January 2008 15:43:27 Peter Soetens wrote:
> On Tuesday 29 January 2008 15:36:06 Tinne De Laet wrote:
> > Despite your thorough answer I don't see how I can get the following
> > behavior: write a new line to my report file at specific times (which I
> > expected to get by calling snapshot() ).
>
> 1. Use a non periodic activity
> 2. Edit ReportingComponent.cpp and change
>
> void ReportingComponent::snapshot() {
> timestamp = TimeService::Instance()->secondsSince( starttime );
>
> // execute the copy commands (fast).
> for(Reports::iterator it = root.begin(); it != root.end(); ++it )
> (it->get<2>())->execute();
> }
> into
> void ReportingComponent::snapshot() {
> timestamp = TimeService::Instance()->secondsSince( starttime );
>
> // execute the copy commands (fast).
> for(Reports::iterator it = root.begin(); it != root.end(); ++it )
> (it->get<2>())->execute();
> if ( this->engine()->getActivity() )
> this->engine()->getActivity()->trigger();
> }
> 3. Disable AutoTrigger
>
> If you just change this and commit it for OCL, you don't need to open a bug
> report....imho.
Thanks a lot Peter!
I made the changes you suggested and I have comitted them:

Sending reporting/ReportingComponent.cpp
Transmitting file data .
Committed revision 28889.

Tinne

Behaviour of reporting - snapshot

On Tuesday 29 January 2008 14:02:26 Tinne De Laet wrote:
> Hi,
>
> What is the intended behaviour of the reporting snapshot() function?
> When I set Autotrigger to false and attach a periodictask to my reporter,
> the reporter still reports periodically. He however reports the same values
> multiple times (with the period of the periodictask) untill snapshot is
> called again.

That is intended, snapshot() determines the time data is 'measured', the
reporter's activity the moment you write to a file.

> When I attach a nonPeriodicTask to my reporter, I only get one rule of data
> in my reporter-file, independent on how many times I call snapshot().

Hmm... I didn't forsee that use case, but clearly, snapshot() needs to call
engine()->getActivity()->trigger() ...This will well behave for periodic and
non periodic activities.

snapshot() wasn't very well thought out, but the way you use it looks ok.

Peter