- sched_t sched;
- int i, size;
- char** __argv;
- char arg[MAX_ARG] = {0};
-
-
- xbt_init(&argc, argv);
-
- if(argc != 2)
- {
- INFO1("Usage: %s job count",argv[0]);
- exit(EXIT_FAILURE);
- }
-
-
- size = atoi(argv[1]);
-
- /* create a new scheduler */
- sched = sched_new(size);
-
- if(!sched)
- {
- INFO1("sched_new() failed : errno %d",errno);
- exit(EXIT_FAILURE);
- }
-
- __argv = xbt_new0(char*,MAX_ARGS);
-
- for(i = 0; i < MAX_ARGS; i++)
- {
- sprintf(arg,"arg_%d",i);
- __argv[i] = strdup(arg);
- memset(arg,0,MAX_ARG);
-
- }
-
- for(i = 0; i < size; i++)
- sched_add_job(sched,job_new(job,(i < MAX_ARGS) ? i : MAX_ARGS,__argv));
-
- /* initialize the scheduler */
- if(sched_init(sched) < 0)
- {
- sched_free(&sched);
- INFO1("sched_init() failed : errno %d\n",errno);
- exit(EXIT_FAILURE);
- }
-
- /* schedule the jobs */
- if(sched_schedule(sched) < 0)
- {
- sched_free(&sched);
- INFO1("sched_init() failed : errno %d",errno);
- exit(EXIT_FAILURE);
- }
-
- /* cleanup */
- if(sched_clean(sched) < 0)
- {
- sched_free(&sched);
- INFO1("sched_init() failed : errno %d",errno);
- exit(EXIT_FAILURE);
- }
-
- /* destroy the scheduler */
- sched_free(&sched);
-
- INFO1("sem_sched terminated with exit code %d (success)",EXIT_SUCCESS);
-
- return EXIT_SUCCESS;
-
+ sched_t sched;
+ int i, size;
+ char **__argv;
+ char arg[MAX_ARG] = { 0 };
+
+
+ xbt_init(&argc, argv);
+
+ if (argc != 2) {
+ XBT_INFO("Usage: %s job count", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+
+ size = atoi(argv[1]);
+
+ /* create a new scheduler */
+ sched = sched_new(size);
+
+ if (!sched) {
+ XBT_INFO("sched_new() failed : errno %d", errno);
+ exit(EXIT_FAILURE);
+ }
+
+ __argv = xbt_new0(char *, MAX_ARGS);
+
+ for (i = 0; i < MAX_ARGS; i++) {
+ sprintf(arg, "arg_%d", i);
+ __argv[i] = strdup(arg);
+ memset(arg, 0, MAX_ARG);
+
+ }
+
+ for (i = 0; i < size; i++)
+ sched_add_job(sched,
+ job_new(job, (i < MAX_ARGS) ? i : MAX_ARGS, __argv));
+
+ /* initialize the scheduler */
+ if (sched_init(sched) < 0) {
+ sched_free(&sched);
+ XBT_INFO("sched_init() failed : errno %d\n", errno);
+ exit(EXIT_FAILURE);
+ }
+
+ /* schedule the jobs */
+ if (sched_schedule(sched) < 0) {
+ sched_free(&sched);
+ XBT_INFO("sched_init() failed : errno %d", errno);
+ exit(EXIT_FAILURE);
+ }
+
+ /* cleanup */
+ if (sched_clean(sched) < 0) {
+ sched_free(&sched);
+ XBT_INFO("sched_init() failed : errno %d", errno);
+ exit(EXIT_FAILURE);
+ }
+
+ /* destroy the scheduler */
+ sched_free(&sched);
+
+ XBT_INFO("sem_sched terminated with exit code %d (success)", EXIT_SUCCESS);
+
+ return EXIT_SUCCESS;
+