Exemple #1
0
        private ResourceManager mainStrings;  //get strings from resource file

        public ArgumentExecuter(string[] args)
        {
            mainStrings = new ResourceManager(typeof(Properties.Resources));
            arguments   = args;
            argLength   = arguments.Length;

            saveTo       = "";
            errorMessage = "";

            logInterval        = -1;
            logDuration        = -1;
            logTotalIterations = -1;

            processIds = new List <int>();
            threadIds  = new List <int>();

            commandHash = new Dictionary <string, List <string> >();
            commandHash["Process Command"]  = new List <string>(new string[] { "/p", "/process", "/processes" });
            commandHash["Thread Command"]   = new List <string>(new string[] { "/t", "/thread", "/threads" });
            commandHash["Stack Command"]    = new List <string>(new string[] { "/s", "/stack", "/stacks", "/stacktrace" });
            commandHash["Kill Command"]     = new List <string>(new string[] { "/k", "/kill" });
            commandHash["Info Command"]     = new List <string>(new string[] { "/i", "/info" });
            commandHash["Help Command"]     = new List <string>(new string[] { "/h", "/help", "/?" });
            commandHash["Out Command"]      = new List <string>(new string[] { "/o", "/out", "/save" });
            commandHash["Log Command"]      = new List <string>(new string[] { "/l", "/log" });
            commandHash["Interval Command"] = new List <string>(new string[] { "/int", "/interval" });
            commandHash["Duration Command"] = new List <string>(new string[] { "/dur", "/duration" });
            commandHash["Depth Command"]    = new List <string>(new string[] { "/dep", "/depth" });

            processData = new GeneralProcessData();

            timerDelegate = new TimerCallback(LogStack);
            waitTimer     = new ManualResetEvent(false);
        }
Exemple #2
0
        private Dictionary<int, bool> threadViewAscendingSort; //used to determine if a given columns is sorted and in what direction

        #endregion Fields

        #region Constructors

        public MainGui()
        {
            InitializeComponent();
            mainStrings = new ResourceManager(typeof(Properties.Resources));

            genProcessData = new GeneralProcessData();

            //currently diaplyed general information
            selectedGeneralInformation = new List<string>();
            selectedGeneralInformation.AddRange(new string[] {
                genProcessData.GeneralStrings.GetString("physicalMem"),
                genProcessData.GeneralStrings.GetString("virtualMem"),
                genProcessData.GeneralStrings.GetString("timeInGC"),
                genProcessData.GeneralStrings.GetString("processDescription"),
                genProcessData.GeneralStrings.GetString("cpuUsage"),
                genProcessData.GeneralStrings.GetString("cpuTime"),
                genProcessData.GeneralStrings.GetString("managedHeap")}
                );

            //array of label objects to populate general data into it
            labelGroup = new List<Label>();
            labelGroup.AddRange(new Label[] { label1, label2, label3, label4, label5,
                label6, label7, label8, label9, label10,label11,label12});

            //initialize priorities
            priorityPosition = new Dictionary<ProcessPriorityClass, int>();
            priorityPosition[ProcessPriorityClass.RealTime] = 0;
            priorityPosition[ProcessPriorityClass.High] = 1;
            priorityPosition[ProcessPriorityClass.AboveNormal] = 2;
            priorityPosition[ProcessPriorityClass.Normal] = 3;
            priorityPosition[ProcessPriorityClass.BelowNormal] = 4;
            priorityPosition[ProcessPriorityClass.Idle] = 5;

            //set up sorting process columns
            processViewAscendingSort = new Dictionary<int, bool>();
            processViewAscendingSort[(int)ProcessColumnsEnum.Process] = false;
            processViewAscendingSort[(int)ProcessColumnsEnum.ID] = false;

            //set up sorting for thread columns
            threadViewAscendingSort = new Dictionary<int, bool>();
            threadViewAscendingSort[(int)ThreadColumnsEnum.ID] = false;
            threadViewAscendingSort[(int)ThreadColumnsEnum.Reason] = false;
            threadViewAscendingSort[(int)ThreadColumnsEnum.State] = false;

            listProcessIds = new List<int>();//list of process ids
            listThreadIds = new List<int>(); //list of thread ids

            monitorList = new Dictionary<int, List<int>>();//maping of process ids to threads beings logged
            monitorFiles = new Dictionary<int, string>();//mapping of process id to file name to save log to
            threadSelectedIdList = new List<int>(); //currently selected threads

            processes = ProcessInfoCollection.SingleProcessCollection;

            currentlySelectedProcess = -1;
            rightPanelWidth = -1;

            prefForm = new PreferenceForm();
            try
            {
                //customizable preferences
                //this is where I will read from the settings file and get last saved data
                //default preferences
                processListRefreshRate = Properties.Settings.Default.processRefreshRate;
                threadListRefreshRate = Properties.Settings.Default.threadRefreshRate;
                stackRefreshRate = Properties.Settings.Default.stackRefreshRate;
                loggingRate = Properties.Settings.Default.loggingRate;
                stackTraceDepth = Properties.Settings.Default.stackDepth;

            }
            catch (FileNotFoundException)
            {
            }

            //set the timer interval
            processRefreshTimer.Interval = processListRefreshRate;
            threadRefreshTimer.Interval = threadListRefreshRate;
            stackRefreshTimer.Interval = stackRefreshRate;
            stackLogTimer.Interval = loggingRate;
        }
        public ArgumentExecuter(string[] args)
        {
            mainStrings = new ResourceManager(typeof(Properties.Resources));
            arguments = args;
            argLength = arguments.Length;

            saveTo = "";
            errorMessage = "";

            logInterval = -1;
            logDuration = -1;
            logTotalIterations = -1;

            processIds = new List<int>();
            threadIds = new List<int>();

            commandHash = new Dictionary<string, List<string>>();
            commandHash["Process Command"] = new List<string>(new string[] { "/p", "/process", "/processes" });
            commandHash["Thread Command"] = new List<string>(new string[] { "/t", "/thread", "/threads" });
            commandHash["Stack Command"] = new List<string>(new string[] { "/s", "/stack", "/stacks", "/stacktrace" });
            commandHash["Kill Command"] = new List<string>(new string[] { "/k", "/kill" });
            commandHash["Info Command"] = new List<string>(new string[] { "/i", "/info" });
            commandHash["Help Command"] = new List<string>(new string[] { "/h", "/help", "/?" });
            commandHash["Out Command"] = new List<string>(new string[] { "/o", "/out", "/save" });
            commandHash["Log Command"] = new List<string>(new string[] { "/l", "/log" });
            commandHash["Interval Command"] = new List<string>(new string[] { "/int", "/interval" });
            commandHash["Duration Command"] = new List<string>(new string[] { "/dur", "/duration" });
            commandHash["Depth Command"] = new List<string>(new string[] { "/dep", "/depth" });

            processData = new GeneralProcessData();

            timerDelegate = new TimerCallback(LogStack);
            waitTimer = new ManualResetEvent(false);
        }