예제 #1
0
		static void Main (string [] args)
		{
			args = CommandLine.Process (typeof (BludgeonMain), args);

			// BU.CommandLine.Process returns null if --help was passed
			if (args == null)
				return;

			if (list_hammers) {
				foreach (string hammer in Toolbox.HammerNames)
					Console.WriteLine ("  - {0}", hammer);
				return;
			}

			ArrayList hammers_to_use;
			hammers_to_use = new ArrayList ();
			foreach (string name in args) {
				IHammer hammer;
				hammer = Toolbox.GetHammer (name);
				if (hammer != null)
					hammers_to_use.Add (hammer);
				else
					Log.Failure ("Unknown hammer '{0}'", name);
			}

			root = CreateTestRoot ();
			TreeBuilder.Build (root,
					   30,    // number of directories
					   100,   // number of files
					   0, //0.1,   // no archives
					   0, //0.5,   // archive decay, which does nothing here
					   false, // build all directories first, not in random order
					   null); // no need to track events
			if (! root.VerifyOnDisk ())
				throw new Exception ("VerifyOnDisk failed for " + root.FullName);
			
			EventTracker tracker;
			tracker = new EventTracker ();

			abuse = new Abuse (root, tracker, hammers_to_use);

			abuse.TotalCount = total_count;
			abuse.TotalTime = total_time;

			abuse.Cycles = cycles;
			abuse.MinCycles = min_cycles;
			abuse.MaxCycles = max_cycles;

			abuse.Pause = pause;
			abuse.MinPause = min_pause;
			abuse.MaxPause = max_pause;

			GLib.Idle.Add (new GLib.IdleHandler (Startup));
			main_loop = new GLib.MainLoop ();
			main_loop.Run ();
		}
예제 #2
0
        static void Main(string [] args)
        {
            args = CommandLine.Process(typeof(BludgeonMain), args);

            // BU.CommandLine.Process returns null if --help was passed
            if (args == null)
            {
                return;
            }

            if (list_hammers)
            {
                foreach (string hammer in Toolbox.HammerNames)
                {
                    Console.WriteLine("  - {0}", hammer);
                }
                return;
            }

            ArrayList hammers_to_use;

            hammers_to_use = new ArrayList();
            foreach (string name in args)
            {
                IHammer hammer;
                hammer = Toolbox.GetHammer(name);
                if (hammer != null)
                {
                    hammers_to_use.Add(hammer);
                }
                else
                {
                    Log.Failure("Unknown hammer '{0}'", name);
                }
            }

            root = CreateTestRoot();
            TreeBuilder.Build(root,
                              30,             // number of directories
                              100,            // number of files
                              0,              //0.1,   // no archives
                              0,              //0.5,   // archive decay, which does nothing here
                              false,          // build all directories first, not in random order
                              null);          // no need to track events
            if (!root.VerifyOnDisk())
            {
                throw new Exception("VerifyOnDisk failed for " + root.FullName);
            }

            EventTracker tracker;

            tracker = new EventTracker();

            abuse = new Abuse(root, tracker, hammers_to_use);

            abuse.TotalCount = total_count;
            abuse.TotalTime  = total_time;

            abuse.Cycles    = cycles;
            abuse.MinCycles = min_cycles;
            abuse.MaxCycles = max_cycles;

            abuse.Pause    = pause;
            abuse.MinPause = min_pause;
            abuse.MaxPause = max_pause;

            GLib.Idle.Add(new GLib.IdleHandler(Startup));
            main_loop = new GLib.MainLoop();
            main_loop.Run();
        }