Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            string report_name = null;
            int report_args = args.Length;
            int count = 2;
            Config cfg;
            string cfg_file = Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "config");

            for (int i = 0; i < args.Length; ++i) {
                if (args [i].StartsWith ("--report=")) {
                    report_name = args [i].Substring (9);
                    continue;
                } else if (args [i].StartsWith ("--count=")) {
                    count = int.Parse (args [i].Substring (8));
                    continue;
                } else if (args [i].StartsWith ("--config=")) {
                    cfg_file = args [i].Substring (9);
                    continue;
                }
                report_args = i;
                break;
            }

            cfg = new Config (cfg_file, true);
            if (report_name != null) {
                Report (cfg, report_name, args, report_args, count);
                return;
            }
            Application.Init ();
            MainWindow win = new MainWindow (cfg);
            win.Show ();
            Application.Run ();
        }
Exemplo n.º 2
0
 static void Report(Config cfg, string name, string[] args, int start, int count)
 {
     List<string> instances = new List<string> ();
     for (; start < args.Length; ++start)
         instances.Add (args [start]);
     if (instances.Count == 0) {
         Console.WriteLine ("Need to provide instance names.");
         return;
     }
     CounterSet cset = cfg [name];
     if (cset == null) {
         Console.WriteLine ("Unknown counter set: {0}.", name);
         return;
     }
     List<PerformanceCounter> counters = ReportList (cset, instances);
     for (int i = 0; i < count; ++i) {
         Report (counters);
         System.Threading.Thread.Sleep ((int)cfg.Timeout);
     }
 }
Exemplo n.º 3
0
 public AddSet(Config cfg)
 {
     this.cfg = cfg;
     this.Build();
     CellRendererText renderer = new CellRendererText ();
     instances.AppendColumn ("Instance", renderer, "text", 0);
     instances_store = new TreeStore (typeof (string));
     instances.Model = instances_store;
     for (int i = 0; i <  cfg.sets.Count; ++i) {
         counterset.AppendText (cfg.sets [i].Name);
     }
     instances.Selection.Changed += delegate {
         TreeSelection ts = instances.Selection;
         TreeIter iter;
         TreeModel mod;
         if (ts.GetSelected (out mod, out iter)) {
             instance = mod.GetValue (iter, 0) as string;
         }
     };
     if (cfg.sets.Count > 0) {
         counterset.Active = 0;
     }
 }