Hi Darren,

On Thu, 17 Jan 2008 08:21:29 -0800 Darren Hart <[EMAIL PROTECTED]> wrote:

> On Monday 14 January 2008 01:43:31 Sebastien Dugue wrote:
> >   Make sched_football arguments parsing conform with what is
> > generally done in the other tests.
> >
> >   Also address the withespace issue in the usage() function as
> > noticed by Darren Hart.
> 
> Sebastien, I have looked through the svn logs and diffs in our tree, and 
> I cannot find any mention of the "setup()" call made in the first few 
> lines of main() below.  Do you know anything about it's origins?
> 
> --Darren

  Nope, I wondered myself where it came from and assumed it was added
on your side when merging into the LTP!

  Note that it's been added in nearly all the tests:

$ egrep -rI "setup ?\\(" *
func/gtod_latency/gtod_infinite.c:      setup();
func/gtod_latency/gtod_latency.c:       setup();
func/pthread_kill_latency/pthread_kill_latency.c:       setup();
func/prio-wake/prio-wake.c:     setup();
func/sched_latency/sched_latency.c:     setup();
func/measurement/preempt_timing.c:      setup();
func/measurement/rdtsc-latency.c:       setup();
func/matrix_mult/matrix_mult.c: setup();
func/pi-tests/testpi-2.c:  setup();
func/pi-tests/sbrk_mutex.c:     setup();
func/pi-tests/testpi-4.c:  setup();
func/pi-tests/test-skeleton.c:  setup();
func/pi-tests/testpi-1.c:  setup();
func/pi-tests/testpi-7.c:       setup();
func/sched_jitter/sched_jitter.c:       setup();
func/pi_perf/pi_perf.c: setup();
func/thread_clock/tc-2.c:       setup();
func/periodic_cpu_load/periodic_cpu_load_single.c:      setup();
func/periodic_cpu_load/periodic_cpu_load.c:     setup();
func/sched_football/sched_football.c:   setup();
func/prio-preempt/prio-preempt.c:       setup();
func/hrtimer-prio/hrtimer-prio.c:       setup();
func/async_handler/async_handler_jk.c:  setup();
func/async_handler/async_handler_tsc.c: setup();
func/async_handler/async_handler.c:     setup();
include/librttest.h:extern void setup();
lib/librttest.c:void setup()                    <==== defined here
perf/latency/pthread_cond_many.c:       setup();
perf/latency/pthread_cond_latency.c:    setup();
stress/pi-tests/testpi-3.c:  setup();
stress/pi-tests/lookup_pi_state.c:      setup();

  The setup() functions registers SIGINT, SIGQUIT and SIGTERM handlers for
user termination.

  Sebastien.

> 
> >
> > Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
> > Cc: Darren Hart <[EMAIL PROTECTED]>
> > Cc: Tim Chavez <[EMAIL PROTECTED]>
> > ---
> >  .../realtime/func/sched_football/sched_football.c  |   40
> > ++++++++++---------- 1 files changed, 20 insertions(+), 20
> > deletions(-)
> >
> > diff --git a/testcases/realtime/func/sched_football/sched_football.c
> > b/testcases/realtime/func/sched_football/sched_football.c index
> > 49dc16a..592d9a9 100644
> > --- a/testcases/realtime/func/sched_football/sched_football.c
> > +++ b/testcases/realtime/func/sched_football/sched_football.c
> > @@ -79,12 +79,17 @@ volatile int defense_count;
> >  pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> >
> >  static int run_jvmsim=0;
> > +static int players_per_team = 0;
> > +static int game_length = DEF_GAME_LENGTH;
> >
> >  void usage(void)
> >  {
> > -        rt_help();
> > -        printf("testpi-1 specific options:\n");
> > -        printf("  -j            enable jvmsim\n");
> > +   rt_help();
> > +   printf("sched_football specific options:\n");
> > +   printf("  -j            enable jvmsim\n");
> > +   printf("  -nPLAYERS     players per team (defaults to
> > num_cpus)\n"); +    printf("  -lGAME_LENGTH game length in seconds
> > (defaults to %d s)\n", +           DEF_GAME_LENGTH);
> >  }
> >
> >  int parse_args(int c, char *v)
> > @@ -98,6 +103,12 @@ int parse_args(int c, char *v)
> >                  case 'h':
> >                          usage();
> >                          exit(0);
> > +           case 'n':
> > +                   players_per_team = atoi(v);
> > +                   break;
> > +           case 'l':
> > +                   game_length= atoi(v);
> > +                   break;
> >                  default:
> >                          handled = 0;
> >                          break;
> > @@ -160,12 +171,14 @@ int referee(int game_length)
> >  int main(int argc, char* argv[])
> >  {
> >     struct sched_param param;
> > -   int players_per_team, game_length;
> >     int priority;
> >     int i;
> >     setup();
> 
> ^ I don't have this function in our tree.
> 
> >
> > -   rt_init("jh",parse_args,argc,argv);
> > +   rt_init("n:l:jh",parse_args,argc,argv);
> > +
> > +   if (players_per_team == 0)
> > +           players_per_team = sysconf(_SC_NPROCESSORS_ONLN);
> >
> >     if (run_jvmsim) {
> >                  printf("jvmsim enabled\n");
> > @@ -174,21 +187,8 @@ int main(int argc, char* argv[])
> >                  printf("jvmsim disabled\n");
> >     }
> >
> > -   if (argc < 2 || argc > 3) {
> > -           printf("Usage: %s players_per_team [game_length (seconds)]\n",
> > argv[0]); -         players_per_team = sysconf(_SC_NPROCESSORS_ONLN);
> > -           game_length = DEF_GAME_LENGTH;
> > -           printf("Using default values: players_per_team=%d
> > game_length=%d\n", -                       players_per_team, game_length);
> > -   }
> > -
> > -   else {
> > -           players_per_team = atoi(argv[1]);
> > -           if (argc == 3)
> > -                   game_length = atoi(argv[2]);
> > -           else
> > -                   game_length = DEF_GAME_LENGTH;
> > -   }
> > +   printf("Running with: players_per_team=%d game_length=%d\n",
> > +          players_per_team, game_length);
> >
> >     /* We're the ref, so set our priority right */
> >     param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 80;
> 
> 
> 
> -- 
> Darren Hart
> IBM Linux Technology Center
> Real-Time Linux Team

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to