On Thursday 10 January 2008 03:12:26 Sebastien Dugue wrote:
>   Make sched_football arguments parsing conform with what is
> generally done in the other tests.

White space issue noted below.

>
> Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
> Cc: Darren Hart <[EMAIL PROTECTED]>
> Cc: Tim Chavez <[EMAIL PROTECTED]>
> ---
>  .../realtime/func/sched_football/sched_football.c  |   36
> ++++++++++---------- 1 files changed, 18 insertions(+), 18
> deletions(-)
>
> diff --git a/testcases/realtime/func/sched_football/sched_football.c
> b/testcases/realtime/func/sched_football/sched_football.c index
> 49dc16a..787a666 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("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);
>  }

The white space in the usage function is pretty mangled.  Not all new to 
this patch, but if we're changing those lines, let's fix the whitespace 
at the same time.  Lines should be consistently indented with tabs, not 
spaces.

--Darren Hart

>
>  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();
>
> -     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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to