Le 24 nov. 2016 7:17 PM, "Juri Lelli" <juri.lelli@arm.com> a écrit :
>
> On 24/11/16 18:24, Vincent Guittot wrote:
> > On 24 November 2016 at 18:06, Juri Lelli <juri.lelli@arm.com> wrote:
> > > On 24/11/16 16:29, Juri Lelli wrote:
> > >> On 24/11/16 17:04, Vincent Guittot wrote:
> > >
> > > [...]
> > >
> > >> >
> > >> > That could be a solution. What worried me a bit with this solution is
> > >> > that we start to put a metric parameter in the description of an
> > >> > event. This parameters will not affect the event only the log.
> > >> > Do we need to have this granularity ? Can't we start with a use case
> > >> > wide slack parameter and we can move it per phase or per event later
> > >> > if we see an interest like we have done for others parameters that
> > >> > were per task at the beg and then have become per phase ?
> > >>
> > >> Fair enough. I'll put it the global section. :)
> > >
> > > Does this looks OK to you?
> >
> > Yes looks good to me
> >
>
> OK, I've put what below on top of the stack. Can I take your "LGTM" as
> an ack? :)

Yes

>
> > >
> > > --->8---
> > > From 629ef6853ed55c6c09bb7add59c8d772a7535a23 Mon Sep 17 00:00:00 2001
> > > From: Juri Lelli <juri.lelli@arm.com>
> > > Date: Thu, 24 Nov 2016 16:59:10 +0000
> > > Subject: [PATCH] rt-app: introduce cumulative_slack global option
> > >
> > > It might be useful, for phases that contains multiple timer events, to
> > > accumulate intermediate slack and report this number once the phase
> > > completes. Implement such behaviour and introduce a global option to
> > > select between current behaivour and the new one.
> > >
> > > Signed-off-by: Juri Lelli <juri.lelli@arm.com>
> > > ---
> > >  doc/tutorial.txt          | 15 ++++++++++++---
> > >  src/rt-app.c              |  5 ++++-
> > >  src/rt-app_parse_config.c |  2 ++
> > >  src/rt-app_types.h        |  2 ++
> > >  4 files changed, 20 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/doc/tutorial.txt b/doc/tutorial.txt
> > > index a4455b601cd3..54488a001381 100644
> > > --- a/doc/tutorial.txt
> > > +++ b/doc/tutorial.txt
> > > @@ -137,6 +137,10 @@ Default value is "/dev/null".
> > >  used to create IO-bounded and memory-bounded busy loop. Default value is
> > >  4194304(4MB).
> > >
> > > +* cumulative_slack : Boolean. Accumulate slack (see below) measured during
> > > +  successive timer events in a phase. Default value is False (time between the
> > > +  end of last event and the end of the phase).
> > > +
> > >  *** default global object:
> > >         "global" : {
> > >                 "duration" : -1,
> > > @@ -150,7 +154,8 @@ used to create IO-bounded and memory-bounded busy loop. Default value is
> > >                 "ftrace" : false,
> > >                 "gnuplot" : false,
> > >                 "io_device" : "/dev/null"
> > > -               "mem_buffer_size" : 4194304
> > > +               "mem_buffer_size" : 4194304,
> > > +               "cumulative_slack" : false
> > >         }
> > >
> > >  **** tasks object ****
> > > @@ -499,8 +504,8 @@ metrics are:
> > >  - start/end : absolute start and end time of a phase. Same time base is used in
> > >    ftrace
> > >  - rel_st: start time of a phase relatively to the beg of the use case
> > > -- slack: for periodic phases (phases that ends with a timer), time between the
> > > -  end of last event and the end of the phase, e.g.
> > > +- slack: if global option "cumulative_slack" (see above) is false, time between
> > > +  the end of last event and the end of the phase, e.g.
> > >
> > >    taskA ...|-- run5 --|- sleep5 -|-- run5--|..timer20.|-- run5 --|- sleep5 -|-- run6 --|.timer20.|
> > >              <--------------- period 20 --------------> <--------------- period 20 -------------->
> > > @@ -513,6 +518,10 @@ metrics are:
> > >              <--------------- period 20 -------------->
> > >                                                         <slack-5>
> > >
> > > +  if global option "cumulative_slack" is true, all the intermediate slacks of a
> > > +  phase with multiple timers are accumulated and reported when the phase
> > > +  completes
> > > +
> > >  - c_duration: sum of the configured duration of run/runtime events
> > >  - c_period: sum of the timer(s) period(s)
> > >  - wu_lat: sum of wakeup latencies after timer events
> > > diff --git a/src/rt-app.c b/src/rt-app.c
> > > index fb4b37d6ff7d..a7a1eb4a27fc 100644
> > > --- a/src/rt-app.c
> > > +++ b/src/rt-app.c
> > > @@ -332,7 +332,10 @@ static int run_event(event_data_t *event, int dry_run,
> > >                         rdata->res.timer.t_next = timespec_add(&rdata->res.timer.t_next, &t_period);
> > >                         clock_gettime(CLOCK_MONOTONIC, &t_now);
> > >                         t_slack = timespec_sub(&rdata->res.timer.t_next, &t_now);
> > > -                       ldata->slack = timespec_to_usec_long(&t_slack);
> > > +                       if (opts.cumulative_slack)
> > > +                               ldata->slack += timespec_to_usec_long(&t_slack);
> > > +                       else
> > > +                               ldata->slack = timespec_to_usec_long(&t_slack);
> > >                         if (timespec_lower(&t_now, &rdata->res.timer.t_next)) {
> > >                                 clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &rdata->res.timer.t_next, NULL);
> > >                                 clock_gettime(CLOCK_MONOTONIC, &t_now);
> > > diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c
> > > index fbc4612b2257..2b27f64f944a 100644
> > > --- a/src/rt-app_parse_config.c
> > > +++ b/src/rt-app_parse_config.c
> > > @@ -784,6 +784,7 @@ parse_global(struct json_object *global, rtapp_options_t *opts)
> > >                 opts->pi_enabled = 0;
> > >                 opts->io_device = strdup("/dev/null");
> > >                 opts->mem_buffer_size = DEFAULT_MEM_BUF_SIZE;
> > > +               opts->cumulative_slack = 0;
> > >                 return;
> > >         }
> > >
> > > @@ -872,6 +873,7 @@ parse_global(struct json_object *global, rtapp_options_t *opts)
> > >                                                 "/dev/null");
> > >         opts->mem_buffer_size = get_int_value_from(global, "mem_buffer_size",
> > >                                                         TRUE, DEFAULT_MEM_BUF_SIZE);
> > > +       opts->cumulative_slack = get_bool_value_from(global, "cumulative_slack", TRUE, 0);
> > >
> > >  }
> > >
> > > diff --git a/src/rt-app_types.h b/src/rt-app_types.h
> > > index 718ce7798cc2..1eb9467fc03e 100644
> > > --- a/src/rt-app_types.h
> > > +++ b/src/rt-app_types.h
> > > @@ -196,6 +196,8 @@ typedef struct _rtapp_options_t {
> > >         int die_on_dmiss;
> > >         int mem_buffer_size;
> > >         char *io_device;
> > > +
> > > +       int cumulative_slack;
> > >  } rtapp_options_t;
> > >
> > >  typedef struct _timing_point_t {
> > > --
> > > 2.10.0