Exemple #1
0
        /// <summary>
        /// Create a suitable amount of users
        /// Create a suitable amount of jobs randomly spread out on users
        /// </summary>
        public void run()
        {
            Owner[] owners = getRandomOwners(10, 100);

            Random random;

            while (true)
            {
                random = new Random();
                scheduler.addJob(createJob(owners[random.Next(0, owners.Length)]));
                Thread.Sleep(100);
            }
        }
        /*** Methods ***/

        public void Submit(Job job)
        {
            changeState(job, State.Submitted);
            scheduler.addJob(job);
        }
Exemple #3
0
        public void setup()
        {
            BS  = new BenchmarkSystem();
            sch = BS.scheduler;

            j1 = new Job(
                (string[] arg) =>
            {
                foreach (string s in arg)
                {
                    Console.Out.WriteLine(s);
                }
                ; return("");
            },
                new Owner("one"),
                1,   // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            delayedJob = new Job(
                (string[] arg) =>
            {
                foreach (string s in arg)
                {
                    Console.Out.WriteLine(s);
                }
                ; return("");
            },
                new Owner("delayed"),
                3,   // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            j3 = new Job(
                (string[] arg) =>
            {
                foreach (string s in arg)
                {
                    Console.Out.WriteLine(s);
                }
                ; return("");
            },
                new Owner("three"),
                1,   // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            j4 = new Job(
                (string[] arg) =>
            {
                foreach (string s in arg)
                {
                    Console.Out.WriteLine(s);
                }
                ; return("");
            },
                new Owner("four"),
                1,   // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            j5 = new Job(
                (string[] arg) =>
            {
                foreach (string s in arg)
                {
                    Console.Out.WriteLine(s);
                }
                ; return("");
            },
                new Owner("five"),
                1,   // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            // remove old jobs from the static scheduler
            while (!sch.Empty())
            {
                sch.popJob(10);
            }

            // add them again

            sch.addJob(j1);
            sch.addJob(delayedJob);
            sch.addJob(j3);
            sch.addJob(j4);
            sch.addJob(j5);
        }
Exemple #4
0
        public void setup()
        {
            BS = new BenchmarkSystem();
            sch = BS.scheduler;

            j1 = new Job(
                (string[] arg) =>
                {
                    foreach (string s in arg)
                    {
                        Console.Out.WriteLine(s);
                    }; return "";
                },
                new Owner("one"),
                1, // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            delayedJob = new Job(
                (string[] arg) =>
                {
                    foreach (string s in arg)
                    {
                        Console.Out.WriteLine(s);
                    }; return "";
                },
                new Owner("delayed"),
                3, // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            j3 = new Job(
                (string[] arg) =>
                {
                    foreach (string s in arg)
                    {
                        Console.Out.WriteLine(s);
                    }; return "";
                },
                new Owner("three"),
                1, // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            j4 = new Job(
                (string[] arg) =>
                {
                    foreach (string s in arg)
                    {
                        Console.Out.WriteLine(s);
                    }; return "";
                },
                new Owner("four"),
                1, // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            j5 = new Job(
                (string[] arg) =>
                {
                    foreach (string s in arg)
                    {
                        Console.Out.WriteLine(s);
                    }; return "";
                },
                new Owner("five"),
                1, // Cpus needed
                1000 // Runtime (in milliseconds)
                );

            // remove old jobs from the static scheduler
            while (!sch.Empty())
            {
                sch.popJob(10);
            }

            // add them again

            sch.addJob(j1);
            sch.addJob(delayedJob);
            sch.addJob(j3);
            sch.addJob(j4);
            sch.addJob(j5);
        }