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
>
> 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